Re: failed SQL CREATE TABLE

Поиск
Список
Период
Сортировка
Искать
От
Chris
Тема
Re: failed SQL CREATE TABLE
Дата
Msg-id
5.1.0.14.0.20020409140551.045d0ec0@cooee.cybersydney.com.au
Ответ на
Список
Дерево обсуждения
failed SQL CREATE TABLE Tim Wilson <wilson@isis.visi.com>
Re: failed SQL CREATE TABLE Tom Lane <tgl@sss.pgh.pa.us>
Re: failed SQL CREATE TABLE Chris <csmith@squiz.net>
Re: failed SQL CREATE TABLE "Joshua b. Jore" <josh@greentechnologist.org>
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:



>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
>);



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


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

В списке pgsql-novice по дате отправления
От: virka prasetia
Дата:
Сообщение: installation problem
От: Tom Lane
Дата:
Сообщение: Re: failed SQL CREATE TABLE
FAQ