Re: [SQL] foreign keys and lots of tables

2011-05-18 Thread David W Noon
On Wed, 18 May 2011 20:10:19 +0100, Gary Stainburn wrote about [SQL] foreign keys and lots of tables: >I have the following tables (individual seat allocation removed to >make it simpler) Omitting details makes the problem more difficult to comprehend. [snip] >create table booking_seats ( > b_i

Re: [SQL] Foreign keys and fixed values...

2009-07-30 Thread Daryl Richter
Hi- On Jul 29, 2009, at 4:16 PM, Kjell Rune Skaaraas wrote: Hello, I'm having a problem using foreign keys, or at least in a way i find good. Basicly I have a table I wish to use as a foreign key with lookup "id" and "code", like: 1,a 1,b 1,c 2,a 2,d I have of course an UNIQUE on (id,c

Re: [SQL] foreign keys with on delete cascade and triggers

2006-01-12 Thread Tom Lane
Dirk Jagdmann <[EMAIL PROTECTED]> writes: > Now I'd like to know if the current order of deletions in PostgreSQL > is intended in the top-down way or if that could be changed? Sorry, I don't see much chance of changing it. regards, tom lane ---(end

Re: [SQL] foreign keys with on delete cascade and triggers

2006-01-12 Thread Dirk Jagdmann
Hello Tom, > If you want the whole transaction rolled back, raise an error instead > of returning NULL. You're right, that's working. But now I have a slightly different problem. I assume that the trigger which watches the cascaded deletions first deletes the row in the monitored table and then

Re: [SQL] foreign keys with on delete cascade and triggers

2006-01-11 Thread Tom Lane
Dirk Jagdmann <[EMAIL PROTECTED]> writes: > The idea behind the sample commands below is, that the whole deletion > should be denied, because a trigger in a cascaded table blocked the > deletion. The trigger works as expected and prevents rows with a value > of "5" being deleted from table "b". How

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-05 Thread Marc G. Fournier
Thanks to everyone for the responses ... ended up doing a trigger on the comments table that updates another table to maintain a "pointer" to the active record ... sped up the query that was hampering us from ~26 000ms to 47ms ... the killer part of the query was that each time it was havin g

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-05 Thread Leif B. Kristensen
On Thursday 05 January 2006 04:58, [EMAIL PROTECTED] wrote: >That's not what foreign keys do. The only thing a foreign key > provides is a guarantee that if any records in B (the referencing > table) still reference a record in table A (the referenced table) > then you cannot delete that reference

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-04 Thread nospam
> Now, what I want to do is add a FOREIGN KEY (again, I think) that when > incident_summary.status is changed (either closed, or reopened), the > associated records in incident_comments are changed to the same state ... As the other responders mentioned, from the schema you described, it doesn't l

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-04 Thread Jim Johannsen
Marc Is the "assumption" that anytime there are comments the status changes? If I'm reading between the lines correctly, there could be a large number of comments before the status changes. So no need to change status until explicitly needed. If there is a specific "comment" th

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-04 Thread Marc G. Fournier
On Wed, 4 Jan 2006, Tom Lane wrote: "Marc G. Fournier" <[EMAIL PROTECTED]> writes: Now, what I want to do is add a FOREIGN KEY (again, I think) that when incident_summary.status is changed (either closed, or reopened), the associated records in incident_comments are changed to the same state ..

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-04 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > Now, what I want to do is add a FOREIGN KEY (again, I think) that when > incident_summary.status is changed (either closed, or reopened), the > associated records in incident_comments are changed to the same state ... Why not just get rid of the s

Re: [SQL] foreign keys again

2002-10-18 Thread wishy wishy
hi folks, For a certain table A, I need to find out the names of the columns who have a foreign key to a specific table B using the catalog.Has anyone done this before entirely using pgsql.I have been through the archieves and have not been able to find the required information. thanks kprasad

Re: [SQL] Foreign Keys

2001-02-05 Thread Colin Faber
Foreign keys are not supported in that version :p see: http://www.postgresql.org/devel-corner/docs/ "" wrote: > I have PostgreSQL 6.5, and I can't get foreign keys to work! What seems to > be the problem?