Re: Two questions about "pg_constraint"

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Bryn Llewellyn <bryn(at)yugabyte(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Two questions about "pg_constraint"
Date: 2022-08-24 20:17:20
Message-ID: 18c9f65f-2487-e3ff-fefb-2133805e0d42@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/24/22 13:11, Bryn Llewellyn wrote:
> *Question 1: why does "pg_constraint" have a "connamespace" column?*
>

> What do you think?
>
> *Question 2: what happened to the column "consrc"?*
>
> The PG 11 account of "pg_constraint"
> https://www.postgresql.org/docs/11/catalog-pg-constraint.html
> <https://www.postgresql.org/docs/11/catalog-pg-constraint.html>
>
> describes "consrc" (text) thus:
>
> « If a check constraint, a human-readable representation of the expression »
>
> Ad hoc queries in my PG 11.9 env show results like « (v = lower(v)) » in
> this column for my tables. This is useful information. But the PG 14
> version of "pg_constraint" has no such column (and nor does the doc
> mention it). Is this information now exposed somewhere else?
>

It was in 11 but not later, so lets look at release notes from 12 --> 14

Here in 12:

"

Remove obsolete pg_constraint.consrc column (Peter Eisentraut)

This column has been deprecated for a long time, because it did not
update in response to other catalog changes (such as column renamings).
The recommended way to get a text version of a check constraint's
expression from pg_constraint is pg_get_expr(conbin, conrelid).
pg_get_constraintdef() is also a useful alternative.
"

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2022-08-24 20:19:34 Re: Two questions about "pg_constraint"
Previous Message Bryn Llewellyn 2022-08-24 20:11:17 Two questions about "pg_constraint"