pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18290: \di+ can not show the same name indexes
3+ messages / 3 participants
[nested] [flat]

* BUG #18290: \di+ can not show the same name indexes
@ 2024-01-14 06:57 PG Bug reporting form <noreply@postgresql.org>
  2024-01-14 15:57 ` Re: BUG #18290: \di+ can not show the same name indexes Tom Lane <tgl@sss.pgh.pa.us>
  2024-01-15 01:08 ` Re: BUG #18290: \di+ can not show the same name indexes jian he <jian.universality@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: PG Bug reporting form @ 2024-01-14 06:57 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: yongtaoh2022@gmail.com

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>



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18290: \di+ can not show the same name indexes
  2024-01-14 06:57 BUG #18290: \di+ can not show the same name indexes PG Bug reporting form <noreply@postgresql.org>
@ 2024-01-14 15:57 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-01-14 15:57 UTC (permalink / raw)
  To: yongtaoh2022@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18290: \di+ can not show the same name indexes
  2024-01-14 06:57 BUG #18290: \di+ can not show the same name indexes PG Bug reporting form <noreply@postgresql.org>
@ 2024-01-15 01:08 ` jian he <jian.universality@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: jian he @ 2024-01-15 01:08 UTC (permalink / raw)
  To: yongtaoh2022@gmail.com; pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-01-15 01:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14 06:57 BUG #18290: \di+ can not show the same name indexes PG Bug reporting form <noreply@postgresql.org>
2024-01-14 15:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-01-15 01:08 ` jian he <jian.universality@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox