Re: pg_dump outputs invalid syntax for partitions with bool partkeys in pg10

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump outputs invalid syntax for partitions with bool partkeys in pg10
Date: 2018-03-02 07:09:16
Message-ID: 519c1972-9959-d86e-8c3c-c8b2334464d1@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi David.

On 2018/03/02 12:41, David Rowley wrote:
> 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.

Thanks for the report.

I guess we don't have a Boolean partitioned table in tests covered by
pg_dump or I'd have heard about this syntax glitch before Horiguchi-san
mentioned it a few months back [1].

> 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.

I agree about going ahead with adding the syntax support, but there are
some arguments against the design of the proposed patches or rather about
the original design of partition bound parsing itself.

> 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.

Certainly.

Thanks,
Amit

[1]
https://www.postgresql.org/message-id/20171128.203915.26713586.horiguchi.kyotaro%40lab.ntt.co.jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-02 07:15:04 Re: [PATCH] Add support for ON UPDATE/DELETE actions on ALTER CONSTRAINT
Previous Message 陈天舟 2018-03-02 07:04:51 Last archived timestamp/xid for Point-in-Time Recovery