Re: partitioned tables referenced by FKs

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: partitioned tables referenced by FKs
Дата
Msg-id 0057bbc0-b099-701f-9f92-ef1c7a68e7d6@lab.ntt.co.jp
обсуждение исходный текст
Ответ на partitioned tables referenced by FKs  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Hi,

On 2019/03/27 8:27, Alvaro Herrera wrote:
> On 2019-Mar-26, Alvaro Herrera wrote:
> 
>> Thanks for the thorough testing and bug analysis!  It was spot-on.  I've
>> applied your two proposed fixes, as well as added a new test setup that
>> covers both these bugs.  The attached set is rebased on 7c366ac969ce.
> 
> Attached is rebased on 126d63122232.  No further changes.

Noticed something -- I was expecting that your earlier commit 1af25ca0c2d9
would've taken care of this, but apparently it didn't.

-- pk
create table p (a int primary key) partition by list (a);
create table p1 partition of p for values in (1) partition by list (a);
create table p11 partition of p1 for values in (1);

-- fk (partitioned)
create table q (a int references p) partition by list (a);
create table q1 partition of q for values in (1) partition by list (a);
create table q11 partition of q1 for values in (1);

-- prints only the top-level constraint as expected
\d q
           Partitioned table "public.q"
 Column │  Type   │ Collation │ Nullable │ Default
────────┼─────────┼───────────┼──────────┼─────────
 a      │ integer │           │          │
Partition key: LIST (a)
Foreign-key constraints:
    "q_a_fkey" FOREIGN KEY (a) REFERENCES p(a)
Number of partitions: 1 (Use \d+ to list them.)

-- fk (regular table)
create table r (a int references p);

-- this prints all, which seems unintentional
\d r
                 Table "public.r"
 Column │  Type   │ Collation │ Nullable │ Default
────────┼─────────┼───────────┼──────────┼─────────
 a      │ integer │           │          │
Foreign-key constraints:
    "r_a_fkey" FOREIGN KEY (a) REFERENCES p(a)
    "r_a_fkey1" FOREIGN KEY (a) REFERENCES p1(a)
    "r_a_fkey2" FOREIGN KEY (a) REFERENCES p11(a)

So, 0002 needs to include some psql tweaks.

Thanks,
Amit




В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Nagaura, Ryohei"
Дата:
Сообщение: RE: Timeout parameters
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: Timeout parameters