REFERENCES to foreign tables
| От | D.C. |
|---|---|
| Тема | REFERENCES to foreign tables |
| Дата | |
| Msg-id | 1b8e18687ec78f05325ef462c2ec440e@yahoo.fr обсуждение исходный текст |
| Ответы |
Re: REFERENCES to foreign tables
Re: REFERENCES to foreign tables |
| Список | pgsql-novice |
Hi (not sure if the Subject: field is correct, but here goes ..), I'm trying to build some more complexity into the db that I mentioned recently. If in the 'clients' table, I have client_id int NOT NULL PRIMARY KEY CHECK (client_id > 0) name varchar(50) NOT NULL [...] ... and in the 'sales' table, I have ... sale_id int NOT NULL PRIMARY KEY CHECK (sale_id > 0) sold_to INT NOT NULL REFERENCES clients (client_id) [...] So when a sale is entered, postgreSQL keeps a record of who it was sold to. Now what happens if I want to delete the client who bought the item in question ? I'm going to have a 'sales' table that references a buyer who no longer exists (in db terms, naturally). I wondered aloud (talking to the wall, sort of) if I could reference clients.client_id to sales.sale_id, but wouldn't that stop my adding a client who hasn't yet made a purchase ? Thanks in advance. D.
В списке pgsql-novice по дате отправления: