Re: [BUGS] BUG #14666: Question on money type as the key ofpartitioned table - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: [BUGS] BUG #14666: Question on money type as the key ofpartitioned table
Date
Msg-id CAB7nPqS65UhQG34AG7KACB_kLaFSB=M1iNMSrR531CptD8AMCQ@mail.gmail.com
Whole thread Raw
In response to [BUGS] BUG #14666: Question on money type as the key of partitioned table  (tianbing@highgo.com)
Responses Re: [BUGS] BUG #14666: Question on money type as the key ofpartitioned table  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-bugs
On Tue, May 23, 2017 at 10:45 PM,  <tianbing@highgo.com> wrote:
> When I use the money type as the key to create the partition table as
> follows:
>
> postgres=# create table test(m money) partition by list(m);
> CREATE TABLE
> postgres=# create table test_1 partition of test for values in (10);
> CREATE TABLE
>
> Partition bounds without apostrophe can be created, but it store the null
> value,not '10' value.
>
> In fact, Correct grammar for creating partition is with apostrophe like
> this:
> postgres=# create table test_1 partition of test for values in ('10');
>
> But the first creating partition without apostrophe should report an error
> like "ERROR:  operator does not exist: money = integer"  as adding a check
> constraint.
>
> Looking forward to your reply.

This looks like a justified complain to me, so added to the open item
list. Those INSERTs should work:
=# insert into test_1 values (10);
ERROR:  23514: new row for relation "test_1" violates partition constraint
DETAIL:  Failing row contains ($10.00).
LOCATION:  ExecConstraints, execMain.c:2037
=# insert into test values (10);
ERROR:  23514: no partition of relation "test" found for row
DETAIL:  Partition key of the failing row contains (m) = ($10.00).
LOCATION:  ExecFindPartition, execMain.c:3343
=# insert into test values ('10');
ERROR:  23514: no partition of relation "test" found for row
DETAIL:  Partition key of the failing row contains (m) = ($10.00).
LOCATION:  ExecFindPartition, execMain.c:3343
The shape of the partition definition looks broken.
--
Michael


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] Can't restore view with pg_restore