Thread: problem creating table

problem creating table

From
blackgr
Date:
I haven't been able to get following definition for table entity to work. I
keep getting a "parse error at or near position." The definition for table
phone works fine. I can delete the line with the definition for position and
the table is created, but why escapes me at the moment. Any clues appreciated.

Glynn Black    blackgr@alltel.net

CREATE SEQUENCE entity_id_seq;

CREATE TABLE entity (entity_id_number int4 DEFAULT NEXTVAL('entity_id_seq'),name    varchar(60) not null,address1
varchar(60)not null,address2 varchar(60),city varchar(60) not null,state char(2) not null,zip char(10) not
null,descriptionvarchar(60),type int2 not null,position int2 not null,
 
PRIMARY KEY (entity_id_number));

CREATE SEQUENCE phone_id_seq;

CREATE TABLE phone (phone_id_number int4 DEFAULT NEXTVAL('phone_id_seq'),entity int4 not null,type int2 not
null,phone_numberchar(7) not null,area_code char(3) not null,
 
PRIMARY KEY (phone_id_number));




Re: [SQL] problem creating table

From
Tom Lane
Date:
blackgr <blackgr@alltel.net> writes:
> I haven't been able to get following definition for table entity to work. I
> keep getting a "parse error at or near position."

Not certain, but I think "position" may be a reserved word in SQL.  Pick
a different name for the field.
        regards, tom lane


Re: [SQL] problem creating table

From
blackgr
Date:
Correct... Thanks.

Glynn Black blackgr@alltel.net

On Sat, 3 Jul 1999, Tom Lane wrote:

> blackgr <blackgr@alltel.net> writes:
> > I haven't been able to get following definition for table entity to work. I
> > keep getting a "parse error at or near position."
> 
> Not certain, but I think "position" may be a reserved word in SQL.  Pick
> a different name for the field.
> 
>             regards, tom lane
> 



Re: [SQL] problem creating table

From
Oliver Graf
Date:
> [...]
> CREATE TABLE entity (
>     [...]
>     position int2 not null,
CONSTRAINT entitiy_pk
> PRIMARY KEY (entity_id_number));
> 
> [...]
> 
> CREATE TABLE phone (
>     [...]
>     area_code char(3) not null,
CONSTRAINT phone_pk
> PRIMARY KEY (phone_id_number));


--
Oliver Graf
Oberhofstr. 11
D-44575 Castrop-Rauxel, Germany
Phone: +49 2305 14230
http://www.ruhr.de/home/casbah/