Re: information_schema.view attgenerated

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: information_schema.view attgenerated
Date: 2024-09-30 01:49:09
Message-ID: 19f4e454-d4c5-4d57-b052-c41365aff81f@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18.09.24 10:23, jian he wrote:
> On Wed, Sep 18, 2024 at 4:09 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>>
>>>
>>> i guess, it will have some minor speed up, also more accurate.
>>
>> I'm having a hard time interpreting this report. Could you be more
>> clear about what is the existing code, and what is the code you are
>> proposing as new.?
>>
>
> sorry for confusion. The changes I propose, also attached.

I think this change is not technically wrong, but I think it doesn't
make a difference either way, so I don't see why we should make a change
here.

> diff --git a/src/backend/catalog/information_schema.sql
> b/src/backend/catalog/information_schema.sql
> index c4145131ce..ff8b9305e4 100644
> --- a/src/backend/catalog/information_schema.sql
> +++ b/src/backend/catalog/information_schema.sql
> @@ -688,7 +688,7 @@ CREATE VIEW columns AS
> CAST(c.relname AS sql_identifier) AS table_name,
> CAST(a.attname AS sql_identifier) AS column_name,
> CAST(a.attnum AS cardinal_number) AS ordinal_position,
> - CAST(CASE WHEN a.attgenerated = '' THEN
> pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
> column_default,
> + CAST(CASE WHEN a.attgenerated = '' AND a.atthasdef THEN
> pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
> column_default,
> CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND
> t.typnotnull) THEN 'NO' ELSE 'YES' END
> AS yes_or_no)
> AS is_nullable,
> @@ -777,8 +777,8 @@ CREATE VIEW columns AS
> CAST(seq.seqmin AS character_data) AS identity_minimum,
> CAST(CASE WHEN seq.seqcycle THEN 'YES' ELSE 'NO' END AS
> yes_or_no) AS identity_cycle,
>
> - CAST(CASE WHEN a.attgenerated <> '' THEN 'ALWAYS' ELSE
> 'NEVER' END AS character_data) AS is_generated,
> - CAST(CASE WHEN a.attgenerated <> '' THEN
> pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
> generation_expression,
> + CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef THEN
> 'ALWAYS' ELSE 'NEVER' END AS character_data) AS is_generated,
> + CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef THEN
> pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
> generation_expression,

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-09-30 02:09:22 Re: Virtual generated columns
Previous Message Takeshi Ideriha 2024-09-30 01:16:00 Re: BUG #18641: Logical decoding of two-phase commit fails with TOASTed default values