describe working as intended?

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: describe working as intended?
Date: 2019-05-18 00:58:06
Message-ID: CAAKRu_Yo=ahEZ8sAaO3vEph0WrifjvG48Bp+6S0dtjCCxHJ5DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

So, I noticed that if I make a table in one schema and then a table with the
same name in another schema that describe only shows me one of them.
Demonstrating with temp table and regular table just for simplicity:
If I make a temp table t1 and a normal table t1 (it doesn't
matter which one I create first), describe only shows the temp table.

test=# create table t1();
CREATE TABLE
test=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+-----------
public | t1 | table | mplageman
(1 row)

test=# create temp table t1();
CREATE TABLE
test=# \d
List of relations
Schema | Name | Type | Owner
-----------+------+-------+-----------
pg_temp_4 | t1 | table | mplageman
(1 row)

I'm not sure if this is the intended behavior or if it is a bug.

I looked briefly at the describe code and ran the query in
describeTableDetails
which it constructs at the beginning and this, of course, returns the
results I
would expect.

test=# select c.oid, n.nspname, c.relname from pg_catalog.pg_class c left
join
pg_catalog.pg_namespace n on n.oid = c.relnamespace where c.relname = 't1';
oid | nspname | relname
-------+-----------+---------
23609 | public | t1
23612 | pg_temp_4 | t1
(2 rows)

So, without much more digging, is the current behavior of describe intended?
I couldn't find an email thread discussing this with the search terms I
tried.

(I noticed it on master and checked 11 as well and got the same behavior.)

--
Melanie Plageman

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-05-18 01:12:15 Re: Is it safe to ignore the return value of SPI_finish and SPI_execute?
Previous Message Peter Geoghegan 2019-05-18 00:52:18 Re: Calling PrepareTempTablespaces in BufFileCreateTemp