Subject: Re: information_schema.view attgenerated

From: Peter Eisentraut <[email-masked]>
Date: Wed, 18 Sep 2024 10:09:38 +0200

On 16.09.24 06:12, jian he wrote:
> hi.
> one minor issue in src/backend/catalog/information_schema.sql
> /*
>   * 6.22
>   * COLUMNS view
>   */
> CREATE VIEW columns ....
> 
> 
> CAST(CASE WHEN a.attgenerated = '' THEN pg_get_expr(ad.adbin,
> ad.adrelid) END AS character_data) AS column_default,
> can change to
> 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.attgenerated <> '' THEN 'ALWAYS' ELSE 'NEVER' END AS
> character_data) AS is_generated,
> can change to
> CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef 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,
> can change to
> CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef THEN
> pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
> generation_expression,
> 
> 
> 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.?