machineghost
machineghost

Reputation: 35790

Using Knex/Postgresql What Does This Mean? "error: column "*" does not exist"

I had a project that I shelved for awhile, but recently I dusted it off and updated all the NPM packages. Now when I try to do anything database related (using Knex/Postgresql) I get the error:

error: column "*" does not exist

This will happen with a seemingly harmless query like:

select "*" from "some_table" where "id" = $1

If I run that query directly against the DB:

select * from "some_table" where "id" = 1;

it works fine. But no matter what I try with knex, whether it's running a regular query or trying to reset my whole database, I keep getting that seemingly nonsensical error.

Can anyone explain what it means?

Upvotes: 0

Views: 1789

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246568

The double quotes around the * cause it not to be interpreted as “all columns”, but as a column with that very name.

Upvotes: 2

Related Questions