describe working as intended? - Mailing list pgsql-hackers

From Melanie Plageman
Subject describe working as intended?
Date
Msg-id CAAKRu_Yo=ahEZ8sAaO3vEph0WrifjvG48Bp+6S0dtjCCxHJ5DQ@mail.gmail.com
Whole thread Raw
Responses Re: describe working as intended?
Re: describe working as intended?
List 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

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Calling PrepareTempTablespaces in BufFileCreateTemp
Next
From: Tom Lane
Date:
Subject: Re: Is it safe to ignore the return value of SPI_finish and SPI_execute?