"Joel Jacobson" <joel@compiler.org> writes:
> A bit of background:
> I'm working on an extension where I need SQL access to this reference
> information. My extension is successfully automatically helping me to
> find problems in extension update-scripts, where an update from a
> version to a version would give a different result than directly
> installing the to-version from scratch.
> Currently, I'm parsing findoidjoins/README and importing the "from
> column" and "to column" to a lookup-table, which is used by my
> extension.
Hmm. That README was certainly never intended to be used that way ;-)
> So I think adding this as a lookup table in pg_catalog is the best solution,
> since extension writers could then use this information in various ways.
I'm definitely -1 on adding a catalog for that. But it seems like the
idea of not-really-enforced FK entries in pg_constraint would serve your
purposes just as well (and it'd be better from the standpoint of getting
the planner to be aware of these relationships).
> The information is theoretically already available via catalogs.sgml,
> but a) it's not easy to parse, and b) it's not available from SQL.
Well, SGML is actually plenty easy to parse as long as you've got xml
tooling at hand. We'd never want to introduce such a dependency in the
normal build process, but making something like findoidjoins depend on
such tools seems within reason. I recall having whipped up some one-off
Perl scripts of that sort when I was doing that massive rewrite of the
func.sgml tables last year. I didn't save them though, and in any case
I'm the world's worst Perl programmer, so it'd be better for someone
with more Perl-fu to take point if we decide to go that route.
regards, tom lane