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

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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-03 18:25:49
Message-ID: CAKYtNApjxOchnoqJByLEmXQVEgvK6kQ0L2JrJHC2U+GfPEFFkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 3 Jan 2020 at 00:40, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > 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.
>
> It's also documented:
>
> Whenever the pattern parameter is omitted completely, the \d commands
> display all objects that are visible in the current schema search path
> — this is equivalent to using * as the pattern. (An object is said to
> be visible if its containing schema is in the search path and no
> object of the same kind and name appears earlier in the search
> path. This is equivalent to the statement that the object can be
> referenced by name without explicit schema qualification.) To see all
> objects in the database regardless of visibility, use *.* as the
> pattern.
>
> Perhaps that's not clear enough, but the behavior is certainly as-intended.
>
> regards, tom lane

Thanks Robert and Tom for quick detailed response.

--
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2020-01-03 18:34:55 Re: Greatest Common Divisor
Previous Message Tom Lane 2020-01-03 18:17:53 Re: pgsql: Add basic TAP tests for psql's tab-completion logic.