pg_dump outputs invalid syntax for partitions with bool partkeys in pg10

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_dump outputs invalid syntax for partitions with bool partkeys in pg10
Date: 2018-03-02 03:41:15
Message-ID: CAKJS1f-BL+r5FXSejDu=+MAvzRARaawRnQ_ZFtbv_o6tha9NJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Quite simply:

d1=# create table bp (b bool) partition by list(b);
CREATE TABLE
d1=# create table bp_f partition of bp for values in('f');
CREATE TABLE
d1=# \q
$ createdb d2
$ pg_dump d1 | psql d2

...

ERROR: syntax error at or near "false"
LINE 2: FOR VALUES IN (false);
^
ERROR: relation "public.bp_f" does not exist
ERROR: relation "public.bp_f" does not exist
invalid command \.

I understand there's a thread [1] which is discussing making this
valid syntax, but on skimming it, there's no mention of any bugs.

I'd thought about something like the attached patch (against master)
to fix, but that leaves pg_dumps that have already been taken a bit
out in the cold, so perhaps we need to think harder about allowing
this syntax.

Thoughts?

This was noticed by Jesper Pedersen in [2], but I've diagnosed this as
an existing bug rather than a bug in the patch that thread relates to.

[1] https://www.postgresql.org/message-id/flat/e05c5162-1103-7e37-d1ab-6de3e0afaf70(at)lab(dot)ntt(dot)co(dot)jp#e05c5162-1103-7e37-d1ab-6de3e0afaf70@lab.ntt.co.jp

[2] https://www.postgresql.org/message-id/c3eb3284-24c8-eff0-f930-a33984d1168a@redhat.com

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
very_minimal_bool_partition_syntax_fix.patch application/octet-stream 3.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-03-02 03:53:38 Re: zheap: a new storage format for PostgreSQL
Previous Message Andres Freund 2018-03-02 03:29:48 Re: [HACKERS] PATCH: multivariate histograms and MCV lists