Sqlite: "Row value misused" error in sqlite

I'm getting an error from an sqlite3 query for which I can't find any reference material. Googling the string takes me deep in the SQLite code itself, and that's so opaque I can't make heads or tails of it.

The table schema:

CREATE TABLE quote (
    seqnum INTEGER,
    session STRING,
    timestamp_sip INTEGER,
    timestamp_1 INTEGER,
    market_center STRING,
    symbol STRING,
    bid_price INTEGER,
    bid_lots INTEGER,
    offer_price INTEGER,
    offer_lots INTEGER,
    flags INTEGER,
    PRIMARY KEY (symbol, seqnum) );

The query:

select (seqnum, session, timestamp_sip, timestamp_1, market_center, symbol)
    from quote
    where symbol = 'QQQ';

The error:

Error: row value misused

I have no idea how to proceed here. There is plenty of data in the table that would match the query:

sqlite> select count(*) from quote where symbol = 'QQQ';
2675931

Can anyone offer any guidance here? Sqlite version is 3.16.2.


Nevermind. Those parentheses around the select columns (left over from a copy/paste) are the problem. Poor error message, maybe. But my fault.


I had a similar when working with a Rails 5.2 Application.

For my case I was trying to write a search query for a model in application:

def self.search(params)
  applications = all.order('created_at DESC') # for not existing params args
  applications = applications.where("cast(id as text) like ?, email like ?, first_name like ?, last_name like ?, appref like ?", "#{params[:search]}", "%#{params[:search]}%", "#{params[:search]}", "#{params[:search]}", "#{params[:search]}",) if params[:search]
  applications
end

The issue was that I was using a comma (,) to separate the search parameters, I simply corrected by using an OR instead:

def self.search(params)
  applications = all.order('created_at DESC') # for not existing params args
  applications = applications.where("cast(id as text) like ? OR email like ? OR first_name like ? OR last_name like ? OR appref like ?", "#{params[:search]}", "%#{params[:search]}%", "#{params[:search]}", "#{params[:search]}", "#{params[:search]}",) if params[:search]
  applications
end

That's all.

I hope this helps