Re: failed SQL CREATE TABLE - Mailing list pgsql-novice

From Chris
Subject Re: failed SQL CREATE TABLE
Date
Msg-id 5.1.0.14.0.20020409140551.045d0ec0@cooee.cybersydney.com.au
Whole thread Raw
In response to failed SQL CREATE TABLE  (Tim Wilson <wilson@isis.visi.com>)
List pgsql-novice
Hi Tim,

The initial thing that springs to mind is that 'end' is a reserved keyword
(for use with transactions), so if you want to use it in a table you have
to quote it ("end").

Either that, or, rename the field to for example end_time.

>I'm trying to create a database and I'm getting some errors when I try
>to create some of the tables. I'm going to post the SQL and the errors
>and I'd appreciate it if there's a guru on the list who'd have a look
>and let me know where I'm messing up. Everything looks OK to me, but
>doesn't it always in situations like this. :-)
>
>Here's the SQL:

<snip>

>CREATE TABLE event (
>   event_id SERIAL PRIMARY KEY,
>   event_name VARCHAR(30),
>   location_id INTEGER,
>   start TIMESTAMP,
>   end TIMESTAMP,
>   description TEXT,
>   username CHAR(10),
>   CONSTRAINT location_exists FOREIGN KEY (location_id)
>     REFERENCES location
>     ON UPDATE CASCADE
>     ON DELETE SET NULL,
>   CONSTRAINT username_exists FOREIGN KEY (username)
>     REFERENCES submitter
>     ON UPDATE CASCADE
>     ON DELETE SET NULL
>);

<snip>

>psql:/home/wilson/make_eventdb.sql:37: ERROR:  parser: parse error at or
>near "end"


-----------------
      Chris Smith
http://www.squiz.net/


pgsql-novice by date:

Previous
From: virka prasetia
Date:
Subject: installation problem
Next
From: Tom Lane
Date:
Subject: Re: failed SQL CREATE TABLE