\d omits schema on inherited tables (Was: EXPLAIN omits schema?)
On 6/13/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Josh Tolley" <eggyknap@gmail.com> writes:
On a different sideline based on the original note of this thread,
much as EXPLAIN doesn't include the schema, \d doesn't include the
schema to describe INHERIT relationships in 8.2.4. If you have two
tables called PARENT, in two different schemas, and a child that
inherits from one of them, \d won't tell you which of the two it
inherits from.Yes it does, because that's actually regclass output. It'll be
schema-qualified if the table is not visible in your search path.
I figured it was better to start a new thread, since this changes from
the original topic. My test didn't display the schema despite the
parent not being in my search path, as shown below:
[jtolley@polonium ~]$ psql
Welcome to psql 8.2.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
jtolley=# create schema a;
CREATE SCHEMA
jtolley=# create schema b;
CREATE SCHEMA
jtolley=# set search_path to a, public;
SET
jtolley=# create table parent (f int);
CREATE TABLE
jtolley=# set search_path to b, public;
SET
jtolley=# create table parent (g text);
CREATE TABLE
jtolley=# create table child () inherits (a.parent);
CREATE TABLE
jtolley=# \d child
Table "b.child"
Column | Type | Modifiers
--------+---------+-----------
f | integer |
Inherits: parent
jtolley=# \d parent
Table "b.parent"
Column | Type | Modifiers
--------+------+-----------
g | text |
jtolley=# \d a.parent
Table "a.parent"
Column | Type | Modifiers
--------+---------+-----------
f | integer |
jtolley=# set search_path to b;
SET
jtolley=# \d child
Table "b.child"
Column | Type | Modifiers
--------+---------+-----------
f | integer |
Inherits: parent
jtolley=# set search_path to a;
SET
jtolley=# \d b.child
Table "b.child"
Column | Type | Modifiers
--------+---------+-----------
f | integer |
Inherits: parent
"Josh Tolley" <eggyknap@gmail.com> writes:
On 6/13/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Yes it does, because that's actually regclass output. It'll be
schema-qualified if the table is not visible in your search path.
I figured it was better to start a new thread, since this changes from
the original topic. My test didn't display the schema despite the
parent not being in my search path, as shown below:
Oh, that's what I get for looking at CVS HEAD instead of the 8.2
branch... it was changed here:
http://archives.postgresql.org/pgsql-committers/2007-02/msg00397.php
regards, tom lane