deviation of 12 from 10 or 11

From: bx <holybolt(at)rambler(dot)ru>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: deviation of 12 from 10 or 11
Date: 2020-07-24 19:39:26
Message-ID: bf4729a8-3c45-f390-7705-47e76753886c@rambler.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi, all.

Have upgraded 10 to 12, but have a some trouble with ::name(?) to ::text
conversion:

in 10 and 11 this works fine:

create schema kpi_test;
create table kpi_test.ttest0 ( a int, b text, c text);

with
cols as (
    select column_name, udt_name from information_schema.columns where
table_schema = 'kpi_test' and table_name = 'ttest0' order by
ordinal_position
),
cols_sel as (
    select
    string_agg(
        case when column_name = 'a' then repeat('x', 256)
        else column_name
        end,
    ', ') x0
    from cols
)
select length(x0)from cols_sel
;

with
cols as (
    select column_name::text, udt_name from information_schema.columns
where table_schema = 'kpi_test' and table_name = 'ttest0' order by
ordinal_position
),
cols_sel as (
    select
    string_agg(
        case when column_name = 'a' then repeat('x', 256)
        else column_name::text
        end,
    ', ') x0
    from cols
)
select length(x0)from cols_sel
;

The results are expected: 262 and 262. Ok.

But in 12 the results are 69 and 262. I'm think the ::name is more
"efficient" and ::text was converted to ::name ?

 length
════════
     69
(1 row)

 length
════════
    262
(1 row)

Please help.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2020-07-24 20:08:49 Re: deviation of 12 from 10 or 11
Previous Message Tom Lane 2020-07-23 21:30:14 Re: How to change the default storage strategy for varlena?