Обсуждение: BUG #18290: \di+ can not show the same name indexes
The following bug has been logged on the website:
Bug reference: 18290
Logged by: Yongtao Huang
Email address: yongtaoh2022@gmail.com
PostgreSQL version: 16.1
Operating system: centos7
Description:
``` SQL
gpadmin@gpadmin-host:~$ psql
psql (16.1)
Type "help" for help.
gpadmin=# create table t1(c1 int);
CREATE TABLE
gpadmin=# create temp table t2(c1 int);
CREATE TABLE
gpadmin=#
gpadmin=# create index idx1 on t1(c1);
CREATE INDEX
gpadmin=# create index idx1 on t2(c1);
CREATE INDEX
gpadmin=# \d+ t1
Table "public.t1"
Column | Type | Collation | Nullable | Default | Storage | Compression |
Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
c1 | integer | | | | plain | |
|
Indexes:
"idx1" btree (c1)
Access method: heap
gpadmin=# \d+ t2
Table "pg_temp_3.t2"
Column | Type | Collation | Nullable | Default | Storage | Compression |
Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
c1 | integer | | | | plain | |
|
Indexes:
"idx1" btree (c1)
Access method: heap
gpadmin=# \di+
List of relations
Schema | Name | Type | Owner | Table | Persistence | Access method |
Size | Description
-----------+------+-------+---------+-------+-------------+---------------+------------+-------------
pg_temp_3 | idx1 | index | gpadmin | t2 | temporary | btree |
8192 bytes |
(1 row)
```
Both table `t1` and temp table `t2` have index idx, but `\di` only shows the
index of table `t2`.
Related link: https://github.com/greenplum-db/gpdb/issues/15791
Bug catcher: Hao Zhang <hao-hz.zhang@broadcom.com> and Yongtao Huang
<yongtaoh2022@gmail.com>
PG Bug reporting form <noreply@postgresql.org> writes: > gpadmin=# \di+ > List of relations > Schema | Name | Type | Owner | Table | Persistence | Access method | > Size | Description > -----------+------+-------+---------+-------+-------------+---------------+------------+------------- > pg_temp_3 | idx1 | index | gpadmin | t2 | temporary | btree | > 8192 bytes | > (1 row) > Both table `t1` and temp table `t2` have index idx, but `\di` only shows the > index of table `t2`. This is not a bug: \di is operating as documented, namely showing you the indexes that are visible in your current search_path. The temp index masks the similarly-named one in public. You could see both of them with "\di+ *.*", "\di+ *.idx1", or other forms. For more info see https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-PATTERNS regards, tom lane
On Sun, Jan 14, 2024 at 6:33 PM PG Bug reporting form <noreply@postgresql.org> wrote: > > The following bug has been logged on the website: > > Bug reference: 18290 > Logged by: Yongtao Huang > Email address: yongtaoh2022@gmail.com > PostgreSQL version: 16.1 > Operating system: centos7 > Description: > > > gpadmin=# \di+ > List of relations > Schema | Name | Type | Owner | Table | Persistence | Access method | > Size | Description > -----------+------+-------+---------+-------+-------------+---------------+------------+------------- > pg_temp_3 | idx1 | index | gpadmin | t2 | temporary | btree | > 8192 bytes | > (1 row) > > ``` > Both table `t1` and temp table `t2` have index idx, but `\di` only shows the > index of table `t2`. > > Related link: https://github.com/greenplum-db/gpdb/issues/15791 > > Bug catcher: Hao Zhang <hao-hz.zhang@broadcom.com> and Yongtao Huang > <yongtaoh2022@gmail.com> > you can use \set ECHO_HIDDEN to figure out the magic behind \di related post: https://stackoverflow.com/questions/11024099/postgresql-outputting-query-of-underlying-function