Re: information_schema.view attgenerated - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: information_schema.view attgenerated
Date
Msg-id 19f4e454-d4c5-4d57-b052-c41365aff81f@eisentraut.org
Whole thread Raw
In response to information_schema.view attgenerated  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On 18.09.24 10:23, jian he wrote:
> On Wed, Sep 18, 2024 at 4:09 PM Peter Eisentraut <peter@eisentraut.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,




pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition
Next
From: px shi
Date:
Subject: a litter question about mdunlinkfiletag function