Re: BUG #14666: Question on money type as the key of partitioned table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, tianbing(at)highgo(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14666: Question on money type as the key of partitioned table
Date: 2017-05-28 21:04:25
Message-ID: 30475.1496005465@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> Just mentioning... I found surprising to see that failing with a
> partition error:
> =# create table test(m money) partition by list(m);
> CREATE TABLE
> =# create table test_1 partition of test for values in (10::money);
> ERROR: 42601: syntax error at or near "::"

Well, this is a misunderstanding of the syntax: the values in the
values list have to be simple literals, not expressions.

However, it's arguably not your fault, because the CREATE TABLE
reference page says that the list elements are "bound_literal"s,
a term which AFAICS is defined nowhere. I'm inclined to change
that to something like

IN ( { numeric_literal | string_literal | NULL } [, ...] )

which seems less likely to leave the reader wondering what is meant.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-05-28 21:53:29 Re: BUG #14666: Question on money type as the key of partitioned table
Previous Message Tom Lane 2017-05-28 18:53:39 Re: BUG #14637: Tests fail with pl_PL.UTF-8 locale