Re: Recording foreign key relationships for the system catalogs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joel Jacobson" <joel(at)compiler(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, "Peter Eisentraut" <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: Recording foreign key relationships for the system catalogs
Date: 2021-02-02 03:27:42
Message-ID: 3683750.1612236462@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Joel Jacobson" <joel(at)compiler(dot)org> writes:
> Could it be an idea to also add
> OUT can_be_zero boolean
> to pg_get_catalog_foreign_keys()'s out parameters?

I was initially feeling resistant to that idea, but warmed to it
once I realized that a majority of the FK referencing columns
actually should not contain zeroes. So we can get a useful
improvement in the strictness of the test coverage if we make this
distinction --- and we can enforce it in the initial catalog data,
too.

So here's a v2 that does that. In the interests of brevity,
I spelled the declaration macros that allow a zero as BKI_LOOKUP_OPT,
DECLARE_FOREIGN_KEY_OPT, etc; and thus the output column is
also is_opt. I'm not wedded to that term but I think we need
something pretty short.

This also moves the oidjoins regression test to run near the
end of the test suite. As I commented earlier, that test was
originally mainly meant to validate the handwritten initial
data; but nowadays it's hard to see what it would catch that
genbki.pl doesn't. So the usefulness is in looking at rows
that get added later, and therefore we ought to run it after
the regression tests have created stuff. I've tried here
to run it in parallel with event_triggers, which might be
foolish.

I also added some documentation. I feel like this might
be committable at this point.

regards, tom lane

Attachment Content-Type Size
add-catalog-foreign-key-info-2.patch text/x-diff 174.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2021-02-02 04:15:46 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Previous Message Peter Geoghegan 2021-02-02 03:17:04 Re: New IndexAM API controlling index vacuum strategies