From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | damir(dot)ciganovic(dot)jankovic(at)gmail(dot)com |
Subject: | BUG #15042: Parition by list using enums odd behaviour |
Date: | 2018-02-01 08:58:29 |
Message-ID: | 151747550943.1247.2111555422760537959@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15042
Logged by: Damir Ciganović-Janković
Email address: damir(dot)ciganovic(dot)jankovic(at)gmail(dot)com
PostgreSQL version: 10.1
Operating system: Windows 10
Description:
First time asking question, if you like stackoverflow, check this link
https://stackoverflow.com/questions/48502345/postgresql-10-partition-by-list-using-enums?noredirect=1#comment84079025_48502345
If not, I will explain. I am trying to partition my table using enum as
partition condition, this is what I did:
create type positivity as enum (
'POSITIVE',
'NEGATIVE'
);
create table test (id int, polarity positivity) partition by list
(polarity);
create table test_1 partition of test for values in ('POSITIVE');
create table test_2 partition of test for values in ('NEGATIVE');
####
explain select * from test where polarity = 'NEGATIVE';
(output:)
explain select * from test where polarity = 'NEGATIVE';
QUERY PLAN
--------------------------------------------------------------
Append (cost=0.00..76.50 rows=22 width=8)
-> Seq Scan on test_1 (cost=0.00..38.25 rows=11 width=8)
Filter: (polarity = 'NEGATIVE'::positivity)
-> Seq Scan on test_2 (cost=0.00..38.25 rows=11 width=8)
Filter: (polarity = 'NEGATIVE'::positivity)
(5 rows)
####
I expected that it will only scan test_2, adding constraints on both
partitions will get me desired behaviour:
alter table test_1 add constraint test_1_check check(polarity='POSITIVE');
alter table test_2 add constraint test_2_check check(polarity='NEGATIVE');
explain select * from test where polarity = 'NEGATIVE';
(output:)
QUERY PLAN
--------------------------------------------------------------
Append (cost=0.00..38.25 rows=11 width=8)
-> Seq Scan on test_2 (cost=0.00..38.25 rows=11 width=8)
Filter: (polarity = 'NEGATIVE'::positivity)
(3 rows)
###
Is this a bug or is it not implemented yet maybe? Or is it working as
intended?
Thank you in advance
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2018-02-01 09:27:23 | Re: BUG #15042: Parition by list using enums odd behaviour |
Previous Message | Amit Kapila | 2018-02-01 06:51:53 | Re: Re: BUG #15039: some question about hash index code |