Re: information_schema and not-null constraints

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: information_schema and not-null constraints
Date: 2023-09-14 08:20:01
Message-ID: 09489196-0bc1-e796-c43e-63425f7c5910@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.09.23 19:52, Alvaro Herrera wrote:
> + SELECT current_database()::information_schema.sql_identifier AS constraint_catalog,
> + rs.nspname::information_schema.sql_identifier AS constraint_schema,
> + con.conname::information_schema.sql_identifier AS constraint_name,
> + format('CHECK (%s IS NOT NULL)', at.attname)::information_schema.character_data AS check_clause

Small correction here: This should be

pg_catalog.format('%s IS NOT NULL', at.attname)::information_schema.character_data AS check_clause

That is, the word "CHECK" and the parentheses should not be part of the
produced value.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2023-09-14 08:28:26 Re: [dynahash] do not refill the hashkey after hash_search
Previous Message Amit Langote 2023-09-14 08:14:51 Re: remaining sql/json patches