Re: Foreign key bugs (Re: [BUGS] "New" bug?? Serious - crashesbackend.) - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: Foreign key bugs (Re: [BUGS] "New" bug?? Serious - crashesbackend.)
Date
Msg-id 026001bfeb86$48510ec0$0c64010a@kick.com
Whole thread Raw
In response to Re: Foreign key bugs (Re: [BUGS] "New" bug?? Serious - crashes backend.)  (JanWieck@t-online.de (Jan Wieck))
List pgsql-hackers
> "Stephan Szabo" <sszabo@kick.com> writes:
> > Also, I realized something else that is a little wierd.  When a
temporary
> > table shadows a permanent table that you've made a foreign key reference
> > to, which table should it be going to check the constraint?
>
> Seems to me it should certainly be going to the permanent table, which
> is another argument in favor of making the link via OID not table name.
> The existing code will get this wrong.

Can I force the SPI query that's being generated to use the permanent
table rather than the shadowed table when they have the same name?
If not, then storing the oid isn't sufficient without moving away from
SPI.  I do agree that storing the oids is a good idea (and am planning to
change it unless someone comes up with a compelling reason not to)
since the only way via something like SPI that I can think of is once
we have schemas, using schemaname.tablename which may not be
shadowed by the temp table and it'll just be easier for everyone
involved if we store the oid.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: update on TOAST status'
Next
From: "Stephan Szabo"
Date:
Subject: Re: Foreign key bugs + other problems