Postgresql and scripting

Поиск
Список
Период
Сортировка
От Jerome Lyles
Тема Postgresql and scripting
Дата
Msg-id 200409080023.02755.susemail@hawaii.rr.com
обсуждение исходный текст
Ответы Re: Postgresql and scripting
Список pgsql-general
I took the white space between characters out of my script 'create.txt4' and
ran it on database 'test'.  There were errors:

26
27 -- Create Orders Table
28
29  CREATE TABLE Orders
30 (
31    Order_num    int        NOT NULL,
32    Order_date    datetime    NOT NULL,
33    cust_id    char(10)    NOT NULL
34 );

CREATE TABLE
psql:create.txt4:34: ERROR:  type "datetime" does not exist

Does this mean this datatype doesn't exist on this line (34) or that it
doesn't exist at all?  If it doesn't exist at all what is the correct
datatype to use here?

Also:

66
67 -- Define Foreign Keys
68 ALTER TABLE OrderItems ADD CONSTRAINT FK_OrderItems_Orders FOREIGN
KEY(order_num) REFERENCE Orders(order_num);
69 ALTER TABLE OrderItems ADD CONSTRAINT FK_OrderItems_Products FOREIGN KEY
(prod_id) REFERENCE Products(prod_id);
70 ALTER TABLE Orders ADD CONSTRAINT FK_Orders_Customers FOREIGN KEY (cust_id)
REFERENCE Customers(cust_id);
71 ALTER TABLE Products ADD CONSTRAINT FK_Products_Vendors FOREIGN KEY
(vend_id) REFERENCE Vendors(vend_id);

generates these errors:
psql:create.txt4:68: ERROR:  syntax error at or near "REFERENCE" at character
83
psql:create.txt4:69: ERROR:  syntax error at or near "REFERENCE" at character
84
psql:create.txt4:70: ERROR:  syntax error at or near "REFERENCE" at character
77
psql:create.txt4:71: ERROR:  syntax error at or near "REFERENCE" at character
79

What, where is the syntac error??

В списке pgsql-general по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: Postgresql and scripting
Следующее
От: Jerome Lyles
Дата:
Сообщение: Re: Postgresql and scripting