mimi
mimi

Reputation: 1

How to fix syntax error at or near “CREATE” in psql

please why is this code not working?

nodelogin-# CREATE TABLE user
nodelogin-# (id BIGSERIAL PRIMARY KEY NOT NULL,
nodelogin(# name VARCHAR(200) NOT NULL,
nodelogin(# email VARCHAR(200) NOT NULL,
nodelogin(# password VARCHAR(200) NOT NULL,
nodelogin(# UNIQUE (email));
ERROR:  syntax error at or near "CREATE"
LINE 2: CREATE TABLE user
        ^

Upvotes: 0

Views: 4300

Answers (1)

bfris
bfris

Reputation: 5805

user is a reserved key word in PostgreSQL. Basically, PostgreSQL doesn't like the name. If you try a different name (user2, user_, comp_user) it should work

Upvotes: 1

Related Questions