Home > front end >  PostgreSQL conditional select throwing error
PostgreSQL conditional select throwing error

Time:02-14

I have a PostgreSQL database hosted on Heroku which is throwing me this error that I can't wrap my head around.

CREATE TABLE people (id INTEGER PRIMARY KEY AUTOINCREMENT, age SMALLINT, right_handed BOOLEAN)
SELECT 1 id FROM people WHERE age IN (1) AND right_handed IN (1)

It gives me the error:

Error in query: ERROR: syntax error at or near "IN"

Don't know how to proceed, any help would be greatly appreciated.

CodePudding user response:

AUTOINCREMENT is not a valid option for CREATE TABLE in Postgres

You can use SERIAL or BIGSERIAL:

ALTER TABLE myTable ADD COLUMN myColumn BIGSERIAL PRIMARY KEY;
  • Related