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

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: 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-24 20:22:16
Message-ID: CA+HiwqEEGSwPHEkj05q+mOaVWypaf=o8v8HDsPjwCokaqyy42Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 24, 2017 at 10:54 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, May 23, 2017 at 10:45 PM, <tianbing(at)highgo(dot)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.

Yep, looks like a bug; will look into it.

Thanks for adding to the open items list.

Regards,
Amit

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message mohd.akram 2017-05-24 20:46:37 BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names
Previous Message ineyman 2017-05-24 17:36:44 BUG #14669: logical replication isn't working