Re: pg_get_constraintdef: Schema qualify foreign tables unless pretty printing is enabled

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Subject: Re: pg_get_constraintdef: Schema qualify foreign tables unless pretty printing is enabled
Date: 2022-08-10 00:33:07
Message-ID: 105329.1660091587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lukas Fittl <lukas(at)fittl(dot)com> writes:
> Whilst debugging an issue with the output of pg_get_constraintdef, we've
> discovered that pg_get_constraintdef doesn't schema qualify foreign tables
> mentioned in the REFERENCES clause, even if pretty printing
> (PRETTYFLAG_SCHEMA) is turned off.

> This is a problem because it means there is no way to get a constraint
> definition that can be recreated on another system when multiple schemas
> are in use, but a different search_path is set. It's also different from
> pg_get_indexdef, where this flag is correctly respected.

I would say that pg_get_indexdef is the one that's out of step.
I count 11 calls of generate_relation_name in ruleutils.c,
of which only three have this business of being overridden
when not-pretty. What is the rationale for that, and why
would we move pg_get_constraintdef from one category to the
other?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Fittl 2022-08-10 01:07:30 Re: pg_get_constraintdef: Schema qualify foreign tables unless pretty printing is enabled
Previous Message Nathan Bossart 2022-08-10 00:13:43 Re: optimize lookups in snapshot [sub]xip arrays