Re: \d is not showing global(normal) table info if we create temporary table with same name as global table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mahendra Singh <mahi6run(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: \d is not showing global(normal) table info if we create temporary table with same name as global table
Date: 2020-01-02 18:39:39
Message-ID: CA+TgmoYiebnrAb+h=_gC8oU7m0vu7dLEMDcVaTm+BFhY6gPN=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 2, 2020 at 12:59 PM Mahendra Singh <mahi6run(at)gmail(dot)com> wrote:
> While reading code and doing some testing, I found that if we create a temporary table with same name as we created a normal(global) table, then \d is showing only temporary table info.

That's because the query that \d issues to the backend includes:

AND pg_catalog.pg_table_is_visible(c.oid)

So I'd say it's not a bug, because that bit of SQL didn't get included
in the query by accident.

Whether it is the behavior that everybody wants is debatable, but I
think it's been this way since 2002. See commit
039cb479884abc28ee494f6cf6c5e7ec26b88fc8.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-01-02 19:10:23 Re: \d is not showing global(normal) table info if we create temporary table with same name as global table
Previous Message Robert Haas 2020-01-02 18:34:44 Re: backup manifests