Re: \di+ cannot show the same name indexes

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: フブキダイスキ <zhrt1446384557(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: \di+ cannot show the same name indexes
Date: 2023-07-13 07:29:03
Message-ID: 20230713072903.auppqv5eoxkwmcog@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Jul 13, 2023 at 03:17:17PM +0800, フブキダイスキ wrote:
> After I create the same name index on the heap table and the temporary
> table, I can only get the temporary table's index by \di+.
>
> create table t1(c1 int);
> create temp table t2(c1 int);
>
> create index idx1 on t1(c1);
> \di+
> List of relations
> Schema | Name | Type | Owner | Table | Size | Description
> --------+------+-------+-------+-------+--------+-------------
> public | idx1 | index | zhrt | t1 | 128 kB |
> (1 row)
>
> create index idx1 on t2(c1);
> \di+
> List of relations
> Schema | Name | Type | Owner | Table | Size | Description
> -------------+------+-------+-------+-------+--------+-------------
> pg_temp_298 | idx1 | index | zhrt | t2 | 128 kB |
> (1 row)
>
> Is it the expected bavior?

Yes, since the pg_temp schema has higher priority and those command will not
show multiple objects for the same non qualified name. You can either change
the priority with something like

SET search_path TO public, pg_temp;

to look at public (or any other schema) first, or explicitly ask for the schema
you want, e.g. \di+ public.*

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2023-07-13 08:08:38 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message フブキダイスキ 2023-07-13 07:17:17 \di+ cannot show the same name indexes