Re: [RFC] [PATCH] Flexible "partition pruning" hook

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: mike(dot)palmiotto(at)crunchydata(dot)com
Cc: thomas(dot)munro(at)gmail(dot)com, andres(at)anarazel(dot)de, peter(dot)eisentraut(at)2ndquadrant(dot)com, tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC] [PATCH] Flexible "partition pruning" hook
Date: 2019-07-12 06:05:27
Message-ID: 20190712.150527.145133646.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

I'm on Peter's side. Unlike other similar hooks, this hook is
provided just to introduce arbitrary inconsistency in partition
pruning.

# By the way, InvokePartitionPruningHook seems useless if the
# reason for it is to avoid duplicate if()'s .

Adding check constraint on children works as far as the RLSish
function is immutable. Do you have any concrete example or
picture of what you want to achieve?

By the way, while considering this, I noticed the following table
definition passes.

> create table t (id serial, a text check (a = '' or a = CURRENT_USER::text));

I don't think it is the right behavior.

> grant all on t to public;
> grant all on t_id_seq to public;
> \c postgres u1
> insert into t(a) values ('u1');
> \c postgres u2
> insert into t(a) values ('u2');
> \c postgres horiguti
> insert into t(a) values ('horiguti');

> select * from t;
> id | a
> ----+----------
> 1 | u1
> 2 | u2
> 3 | horiguti

Broken... The attached patch make parser reject that but I'm not
sure how much it affects existing users.

> =# create table t (id serial, a text check (a = '' or a = CURRENT_USER::text));
> ERROR: mutable functions are not allowed in constraint expression

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
restrict_nonimutable_in_check_constraint.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shawn Debnath 2019-07-12 06:08:13 Re: Introduce timeout capability for ConditionVariableSleep
Previous Message Michael Paquier 2019-07-12 05:57:17 Re: Add parallelism and glibc dependent only options to reindexdb