Re: BUG #14715: Constraint exclusion isn't used in function using language sql

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: cliveevans(at)ntlworld(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14715: Constraint exclusion isn't used in function using language sql
Date: 2017-06-23 01:39:57
Message-ID: 20170623.103957.31224862.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello,

At Wed, 21 Jun 2017 14:00:56 +0000, cliveevans(at)ntlworld(dot)com wrote in <20170621140056(dot)27883(dot)82221(at)wrigleys(dot)postgresql(dot)org>
> PostgreSQL version: 9.6.3
...
> The same query written using PL/PGSQL will only scan the expected partition
> tables.

The two are different in that the parameters of the PL/PgSQL
function are regarded as constants at the time of planning of the
inner SQL statement, while those of the SQL function are
not. Constraint exclusion is considered while planning so the SQL
function doesn't get benefit of it.

This doesn't seem a bug, but I couldn't find such a description
in the documentation, though. Maybe it should be here.

https://www.postgresql.org/docs/9.6/static/ddl-partitioning.html#DDL-PARTITIONING-CAVEATS

regareds,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Clive Evans 2017-06-23 08:59:32 Re: BUG #14715: Constraint exclusion isn't used in function using language sql
Previous Message Amit Langote 2017-06-23 00:35:55 Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS