From: | Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com> |
---|---|
To: | PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: fix empty array expression in get_qual_for_list() |
Date: | 2017-06-26 11:30:15 |
Message-ID: | CAOgcT0OQnK3G5SghCUvO=DfXc_xO5tnVD3ojMn-n+Tjse5VKAg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Here is an example:
create table t1 ( a int) partition by list (a);
create table t11 partition of t1 for values in (null);
*Current constraints:*
postgres=# \d+ t11;
Table "public.t11"
Column | Type | Collation | Nullable | Default | Storage | Stats target
| Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain |
|
Partition of: t1 FOR VALUES IN (NULL)
Partition constraint: ((a IS NULL) OR (a = ANY (ARRAY[]::integer[])))
*Constraints after fix:*
postgres=# \d+ t11;
Table "public.t11"
Column | Type | Collation | Nullable | Default | Storage | Stats target
| Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain |
|
Partition of: t1 FOR VALUES IN (NULL)
Partition constraint: (a IS NULL)
Regards,
Jeevan Ladhe
On Mon, Jun 26, 2017 at 4:53 PM, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com
> wrote:
> Hi,
>
> In case of list partitioned table:
> 1. If there is a partition accepting only null values and nothing else,
> then
> currently the partition constraints for such a partition are constructed as
> "((a IS NULL) OR (a = ANY (ARRAY[]::integer[])))".
> I think there it is better to avoid constructing an empty array to avoid
> executing ANY expression.
>
> 2.Also, we are constructing an expression using index 0 of arrays in
> PartitionKey since currently we have only one column for list partition in
> key,
> added an assert for this.
>
> PFA.
>
> Regards,
> Jeevan Ladhe
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-06-26 13:54:04 | Re: A mistake in a comment |
Previous Message | Jeevan Ladhe | 2017-06-26 11:23:27 | fix empty array expression in get_qual_for_list() |