From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: attndims, typndims still not enforced, but make the value within a sane threshold |
Date: | 2025-01-21 20:23:31 |
Message-ID: | 3431627.1737491011@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruce Momjian <bruce(at)momjian(dot)us> writes:
> I did write a patch in Novemer 2023 to pass the dimension to the layers
> that needed it, but it was considered too much code compared to its
> value:
> https://www.postgresql.org/message-id/ZVwI_ozT8z9MCnIZ@momjian.us
Ah, I'd forgotten that discussion. It looks like the main differences
between your patch and mine are
(1) you did nothing about getting a nonzero attndims value for views
and CREATE TABLE AS cases.
(2) you found a way to get pg_dump to preserve attndims, which you
then also applied to psql's \d.
I'm not really thrilled with (2): it's messy and incomplete, and
I'm not entirely sure it won't break some uses of atttypname within
pg_dump. I do think we should try to get to a place where attndims
is guaranteed nonzero for array-typed columns.
I checked the regression database after applying my patch, and see
that this test works:
regression=# select relname, relkind, attname, attndims, typname from pg_attribute a join pg_type t on (a.atttypid = t.oid) join pg_class c on (a.attrelid = c.oid) where typsubscript = 'array_subscript_handler'::regproc and attndims = 0;
relname | relkind | attname | attndims | typname
---------+---------+---------+----------+---------
(0 rows)
but the reverse case not so much:
regression=# select relname, relkind, attname, attndims, typname from pg_attribute a join pg_type t on (a.atttypid = t.oid) join pg_class c on (a.attrelid = c.oid) where typsubscript != 'array_subscript_handler'::regproc and attndims != 0;
relname | relkind | attname | attndims | typname
------------------+---------+---------+----------+---------
gin_test_idx | i | i | 1 | int4
botharrayidx | i | i | 1 | int4
botharrayidx | i | t | 1 | text
gin_relopts_test | i | i | 1 | int4
(4 rows)
I wonder if we should try to fix the GIN AM to avoid that.
The column being indexed is of an array type in these cases, but the
index entries aren't. It seems inconsistent that it sets up the index
column's attndims and atttypid this way.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2025-01-21 20:47:08 | Re: Replace current implementations in crypt() and gen_salt() to OpenSSL |
Previous Message | Corey Huinker | 2025-01-21 19:50:33 | Re: Statistics Import and Export |