Re: Boolean partitions syntax

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Mark Dilger <hornschnorter(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Boolean partitions syntax
Date: 2018-02-02 21:40:59
Message-ID: 1b9e7eb1-cd8b-9e7a-4291-5ed664b5a675@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/2/18 04:39, Amit Langote wrote:
> Most of the code does treat partition bound values as Node values doing
> coercing before calling the input value good and failing upon not being
> able to convert to the desired type for whatever reason.
>
> create table b (a bool) partition by list (a);
> create table bt partition of b for values in (1);
> ERROR: specified value cannot be cast to type boolean for column "a"
> LINE 1: create table bt partition of b for values in (1);
>
> Can you say a bit more about the compatibility issues if we extend the syntax?

Without getting into the technicial details too much, this thread
surprised me. Why do we need to add support for each kind of constant
literal separately? That seems wrong.

There might be other options, but one way to solve this would be to
treat partition bounds as a general expression in the grammar and then
check in post-parse analysis that it's a constant.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-02-02 21:58:25 Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)
Previous Message Peter Geoghegan 2018-02-02 21:35:59 Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)