What's wrong about this sql statement?

Started by Cornover 24 years ago3 messagesgeneral
Jump to latest
#1Corn
corn@tryit.com

I am newbie. Try to create a table like this.

CREATE TABLE usersright (
userid INTEGER NOT NULL,
rightid INTEGER NOT NULL,
allow BOOLEAN NOT NULL DEFAULT FALSE
CONSTRAINT pk_usersright PRIMARY KEY (userid, rightid)
);

But I got the following error message:

ERROR: parser: parse error at or near "("

I am following the syntax of SQL statement reference from postgresql web
site.

please help.

thx.

corn

#2Arne Weiner
aswr@gmx.de
In reply to: Corn (#1)
Re: What's wrong about this sql statement?

Corn wrote:

There is a comma missing. The Statement must be

CREATE TABLE usersright (
userid INTEGER NOT NULL,
rightid INTEGER NOT NULL,
allow BOOLEAN NOT NULL DEFAULT FALSE,
^^^^^^^
CONSTRAINT pk_usersright PRIMARY KEY (userid, rightid)
);

Tableconstraints mus be seperated by comma from coulmn definiftion.

Arne.

Show quoted text

I am newbie. Try to create a table like this.

CREATE TABLE usersright (
userid INTEGER NOT NULL,
rightid INTEGER NOT NULL,
allow BOOLEAN NOT NULL DEFAULT FALSE
CONSTRAINT pk_usersright PRIMARY KEY (userid, rightid)
);

But I got the following error message:

ERROR: parser: parse error at or near "("

I am following the syntax of SQL statement reference from postgresql web
site.

please help.

thx.

corn

#3Richard Poole
richard.poole@vi.net
In reply to: Corn (#1)
Re: What's wrong about this sql statement?

On Fri, Aug 31, 2001 at 03:58:45PM +0800, Corn wrote:

I am newbie. Try to create a table like this.

CREATE TABLE usersright (
userid INTEGER NOT NULL,
rightid INTEGER NOT NULL,
allow BOOLEAN NOT NULL DEFAULT FALSE
CONSTRAINT pk_usersright PRIMARY KEY (userid, rightid)
);

But I got the following error message:

ERROR: parser: parse error at or near "("

I am following the syntax of SQL statement reference from postgresql web
site.

Not quite. You need another comma after the FALSE:

CREATE TABLE usersright (
userid INTEGER NOT NULL,
rightid INTEGER NOT NULL,
allow BOOLEAN NOT NULL DEFAULT FALSE,
CONSTRAINT pk_usersright PRIMARY KEY (userid, rightid)
);

Richard