Re: information_schema and not-null constraints

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>, Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2023-09-18T06:15:53Z
Lists: pgsql-hackers
On 14.09.23 10:20, Peter Eisentraut wrote:
> 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.

I have committed this fix.



Commits

  1. Simplify information schema check constraint deparsing

  2. Fix information schema for catalogued not-null constraints

  3. Update information_schema definition for not-null constraints