On Mon, 7 Aug 2000, Tom Lane wrote:
> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > Tom had suggested storing a more
> > understandable form of the foreign key constraint
> > to make dumping more reasonable in its own table.
> > I'd guess like the src stored for check constraints.
>
> I wasn't actually thinking of storing source, but rather precompiled
> expressions (as I remarked awhile ago, I think pg_relcheck's rcsrc
I guess you could store the fk_constraint node that is generated for fk
constraints, but that's not really an expression... I think I must
be missing something, because I can't quite see what the precompiled
expression for an fk constraint would be...
> However, digging those references out of the expression tree is a little
> bit painful; you're right that we shouldn't expect applications to do
> that for themselves. We could store an additional list of referenced
> items. We wouldn't necessarily have to store that explicitly either,
> though --- functions to say "is this OID referenced in this stored
> expression" or perhaps "give me an array of all function OIDs in this
> expression" would get the job done AFAICS.
The reason I was thinking of storing things was also so you could do
things like: is this oid stored in any constraint. For example,
I'm removing a column, is there any constraint that references this
column, etc, rather than having to code stuff for all of the special
cases in all places that might need it.