relation vs table... - Mailing list pgsql-general
From | Terrence Brannon |
---|---|
Subject | relation vs table... |
Date | |
Msg-id | 3F8559A8.8020803@urth.org Whole thread Raw |
Responses |
Re: relation vs table...
Re: relation vs table... Re: relation vs table... |
List | pgsql-general |
I don't know what Postgres considers a relation and had no intention of creating one when piping my schema to it... I always DROP TABLE before CREATE TABLE, so here are the ERRORS emitted when building the database: 3:ERROR: table "country" does not exist 6:ERROR: table "customer" does not exist 11:ERROR: table "product" does not exist 15:ERROR: table "license" does not exist 19:ERROR: table "enduser" does not exist 24:ERROR: table "orders" does not exist 29:ERROR: table "enduser_license" does not exist 33:ERROR: table "item" does not exist 37:ERROR: Relation "product_version" does not exist 38:ERROR: table "product_version" does not exist 43:ERROR: table "ordered_item" does not exist but each and every one of these was created via CREATE TABLE I don't understand why Postgres thinks I am creating a relation _and_ I don't know what it considers a relation to be. Create stmts follow: /*==========================================================================*/ /* Tables */ /*==========================================================================*/ DROP TABLE country; CREATE TABLE country ( country_id VARCHAR(3) PRIMARY KEY, country VARCHAR(80) ); DROP TABLE customer; CREATE TABLE customer ( customer_id SERIAL PRIMARY KEY, country_id VARCHAR(3) REFERENCES country(country_id), name VARCHAR(100) NOT NULL, companyname VARCHAR(100) NOT NULL, address1 VARCHAR(100) NOT NULL, address2 VARCHAR(100) NOT NULL, city VARCHAR(100) NOT NULL, zipcode VARCHAR(10) NOT NULL, state VARCHAR(10) NOT NULL, phone VARCHAR(20), fax VARCHAR(20), email VARCHAR(100), vatid VARCHAR(20) ); DROP TABLE product; CREATE TABLE product ( product_id SERIAL PRIMARY KEY, productdesc VARCHAR(100) NOT NULL, productname VARCHAR(100) NOT NULL ); DROP TABLE license; CREATE TABLE license ( license_id SERIAL PRIMARY KEY, lickey VARCHAR(80) NOT NULL, liccode VARCHAR(80) NOT NULL ); DROP TABLE enduser; CREATE TABLE enduser ( enduser_id SERIAL PRIMARY KEY, customer_id INTEGER REFERENCES customer(customer_id), name VARCHAR(40), companyname VARCHAR(40) ); DROP TABLE orders; CREATE TABLE orders ( orders_id SERIAL PRIMARY KEY, country_id VARCHAR(3) REFERENCES country(country_id), customer_id INTEGER REFERENCES customer(customer_id), name VARCHAR(100) NOT NULL, companyname VARCHAR(100) NOT NULL, address1 VARCHAR(100) NOT NULL, address2 VARCHAR(100) NOT NULL, city VARCHAR(100) NOT NULL, state VARCHAR(10) NOT NULL, zipcode VARCHAR(10) NOT NULL, orderdate DATE, phone VARCHAR(20), fax VARCHAR(20), email VARCHAR(100), vatid VARCHAR(20), refno VARCHAR(100), promotion VARCHAR(100) ); DROP TABLE enduser_license; CREATE TABLE enduser_license ( license_id INTEGER REFERENCES license(license_id), enduser_id INTEGER REFERENCES enduser(enduser_id), PRIMARY KEY (license_id, enduser_id) ); DROP TABLE item; CREATE TABLE item ( item_id SERIAL, product_version_id INTEGER REFERENCES product_version(product_version_id), active INTEGER NOT NULL, itemname VARCHAR(100) NOT NULL, unitprice DECIMAL, numberoflic INTEGER, PRIMARY KEY (item_id, product_version_id) ); DROP TABLE product_version; CREATE TABLE product_version ( product_version_id SERIAL PRIMARY KEY, product_id INTEGER REFERENCES product(product_id) ); DROP TABLE ordered_item; CREATE TABLE ordered_item ( orders_id INTEGER REFERENCES orders(orders_id), item_id INTEGER NOT NULL, product_id INTEGER NOT NULL, quantity INTEGER NOT NULL, product_version_id VARCHAR(10), unitprice DECIMAL, PRIMARY KEY (orders_id, item_id, product_id) ); /*==========================================================================*/ /* Indexes */ /*==========================================================================*/ /*==========================================================================*/ /* Procedures */ /*==========================================================================*/ /*==========================================================================*/ /* Triggers */ /*==========================================================================*/
pgsql-general by date: