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 */
/*================================================= =========================*/
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster 3 11192
On Thu, Oct 09, 2003 at 05:50:48AM -0700, Terrence Brannon wrote: 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:
Well, when you do a DROP TABLE and there's no table with the name you
give, the system is right in giving you a "table foo does not exist".
However, when you create a foreign key to a table that doesn't exist
(because you are creating it further down in your script), the system
doesn't know it is a table (it could be a view, for example). So it
falls back to using the more general term, "relation".
"Relation" means, in Postgres terms, "anything that can have a pg_class
entry". This means system tables and views, regular tables and views,
indexes, sequences, TOAST tables and special relations like pg_xactlock
if I'm not mistaken.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)
Terrence Brannon writes: I don't understand why Postgres thinks I am creating a relation _and_ I don't know what it considers a relation to be.
In the context of relational databases, relation means the same thing as
table. Because of some implementation artifacts, PostgreSQL internally
treats tables, views, indexes, and sequences alike to some extent and
refers to all of them together as relations. So when you see an error
message telling you that a relation was not found, that means PostgreSQL
was looking for a table, a view, an index, or a sequence. This artificial
terminology isn't ideal, but it creates few problems in practice.
--
Peter Eisentraut pe*****@gmx.net
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org
On Thu, 2003-10-09 at 13:50, Terrence Brannon wrote: 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
All these are errors when you DROP a table that does not yet exist.
37:ERROR: Relation "product_version" does not exist
This is your attempt to have a foreign key reference to product_version
from table "item", when product_version does not yet exist.
38:ERROR: table "product_version" does not exist 43:ERROR: table "ordered_item" does not exist
and again, you are dropping these tables before they exist.
but each and every one of these was created via CREATE TABLE
but only _after_ you try to drop them (and your attempt to create "item"
will have failed because of the bad foreign key reference).
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:
A table is a relation but a relation is not necessarily a table, A view
is a relation. However, the error message for your bad foreign key is
misleading because a foreign key must reference a table, not a relation:
junk=# create view aaa as select * from xxx union select * from zzz;
CREATE VIEW
junk=# create table bbb (id serial, aid integer references aaa(id));
NOTICE: CREATE TABLE will create implicit sequence "bbb_id_seq" for
"serial" column "bbb.id"
ERROR: referenced relation "aaa" is not a table
--
Oliver Elphick Ol************@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Every good gift and every perfect gift is from above,
and cometh down from the Father of lights, with whom
is no variableness, neither shadow of turning."
James 1:17
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sharon |
last post by:
I have two tables in the DataSet, the first present rooms and the other
furniture kinds.
Furniture kind, like chare, can be in more then one...
|
by: Wayne Brantley |
last post by:
I have found what appears to be an error in streaming with Datasets. It
causes an error of 'Cannot find relation 0' when recreating the dataset...
|
by: jaYPee |
last post by:
I have tried almost everything I know but still I can't find a way on
how to resolve this problem.
I'm using ImportRow to copy some record from 1...
|
by: Juris Krumins |
last post by:
I have a problem with postgresql tables. periodicaly, I would say
frequently about 5-10 time per hour i have such errors in my server log
file:
...
|
by: brookhartc |
last post by:
I am working on a program where I am retrieving data from an Access
database through one common dataset. I have already put the database
connection...
|
by: Ambica Jain |
last post by:
I have a data grid called Files, which has some columns like FileName, Col1,
Col2, ... , Col8. Then i have a combobox which allows user to select...
|
by: Ginger Estherskip |
last post by:
I'm setting up a dataset using the GUI to have a Parent Data Table and a few
Child Data Tables.
I then have a form that uses that dataset, and I...
|
by: bugboy |
last post by:
I'm inserting a new word into table 'w' and a definition into table 'c' which are linked in table 's' which is the relation table for the many to...
|
by: Miro |
last post by:
VS2008
I have created 3 tables.
Vendors
Customers
PhoneNumbers
each have their own key
Vendor has: VendorID - int unique identifier...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
| |