\d doesn't show partitioned table foreign keys

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: \d doesn't show partitioned table foreign keys
Date: 2018-05-14 02:50:40
Message-ID: a66879e5-636f-d4dd-b4a4-92bdca5a828f@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I just noticed $subject, which attached seems to fix, although not sure if
that's the correct fix for the issue.

create table foo (a int primary key);
create table doo (a int primary key);
create table bar (a int references foo references doo) partition by list (a);
create table bar1 partition of bar for values in (1);

\d bar
Table "public.bar"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
Partition key: LIST (a)
Number of partitions: 1 (Use \d+ to list them.)

But can see the key on the partition.

\d bar1
Table "public.bar1"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
Partition of: bar FOR VALUES IN (1)
Foreign-key constraints:
"bar_a_fkey" FOREIGN KEY (a) REFERENCES foo(a)
"bar_a_fkey1" FOREIGN KEY (a) REFERENCES doo(a)

After applying the patch:

\d bar
Table "public.bar"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
Partition key: LIST (a)
Foreign-key constraints:
"bar_a_fkey" FOREIGN KEY (a) REFERENCES foo(a)
"bar_a_fkey1" FOREIGN KEY (a) REFERENCES doo(a)
Number of partitions: 1 (Use \d+ to list them.)

Will add this to open items.

Thanks,
Amit

Attachment Content-Type Size
describe-partitioned-table-fkey-v1.patch text/plain 484 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-05-14 02:55:41 Re: \d doesn't show partitioned table foreign keys
Previous Message Robert Haas 2018-05-14 02:50:34 Re: [HACKERS] Surjective functional indexes