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