1
CREATE TABLE members (
    memberID SERIAL,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(60) NOT NULL,
    email VARCHAR(255) NOT NULL,
    active VARCHAR(255) NOT NULL,
    resetToken VARCHAR(255) DEFAULT NULL,
    resetComplete VARCHAR(3) DEFAULT 'No',
    CONSTRAINT members_pk PRIMARY KEY (memberID)
);

I am trying to use the provided statement in my PostgreSQL db, but when I attempt to execute it I am getting a syntax error:

ERROR:  syntax error at or near "CREATE"
LINE 1: SELECT COUNT(*) AS total FROM (CREATE TABLE members (

As far as I know, my SQL is fine. I am not sure what is going wrong here.

2
  • 9
    It's not Postgres' fault. It's a bug in the tool you're using to run the query, which I'm guessing is phpPgAdmin. If so, you can prevent it by disabling pagination. Commented Apr 1, 2015 at 2:36
  • 1
    Nick, you were correct in your assumption and your suggestion. Thanks! This is my first go-round with PostgreSQL and it's been a frustrating experience. Since you posted as a comment, however, I cannot accept your response as the answer. Commented Apr 1, 2015 at 6:01

1 Answer 1

-3
CREATE TABLE members (
    memberID SERIAL CONSTRAINT members_pk PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(60) NOT NULL,
    email VARCHAR(255) NOT NULL,
    active VARCHAR(255) NOT NULL,
    resetToken VARCHAR(255) DEFAULT NULL,
    resetComplete VARCHAR(3) DEFAULT 'No'
);

Does moving constraint syntax help?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.