anyway.
Gary
On Thursday 19 May 2011 01:09:07 David W Noon wrote:
> 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)
>
>
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 book
I have the following tables (individual seat allocation removed to make it
simpler)
create table coaches ( -- carriages
c_id serial primary key,
c_namevarchar(20) not null
);
create table trains ( -- one for each train
t_id serial primary key
);
create table train_coaches
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
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,code). However, in the table I want the key
to apply to, I only hav
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
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
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
Hello,
I often create foreign keys with "on delete cascade" so I can
conviniently delete rows in multiple tables which are referenced by (a
chain) of foreign keys. Now I've run into an issue and I'd like to
have some opinions if the current behaviour of PostgreSQL is desired.
If have made my tests
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
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
> 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
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
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 ..
"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
I'm not sure if I'm looking at (for) the right thing or not, but if I am,
then I'm not finding any useful examples :(
I have two tables, simplified as:
CREATE TABLE incident_summary (
id serial,
subject text,
status boolean
);
CREATE TABLE incident_comments (
id serial,
incident_id
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
If I have table A, which contains a primary key,
and table B which inherits from A.
How can I Create a Foreign Key on table C that references A, but will
also pass if a record in inserted in to B.
for instance:
create table A
(
prim_key char(20) not null primary key
);
create table B
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?
I have PostgreSQL 6.5, and I can't get foreign keys to work! What seems to
be the problem?
20 matches
Mail list logo