Postgresql and scripting

From: Jerome Lyles <susemail(at)hawaii(dot)rr(dot)com>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Postgresql and scripting
Date: 2004-09-08 10:23:02
Message-ID: 200409080023.02755.susemail@hawaii.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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??

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jerome Lyles 2004-09-08 10:38:04 Re: Postgresql and scripting
Previous Message Oliver Elphick 2004-09-08 10:08:57 Re: Postgresql and scripting