Re: dubious optimization of the function in SELECT INTO target list - Mailing list pgsql-general

From Oleksii Kliukin
Subject Re: dubious optimization of the function in SELECT INTO target list
Date
Msg-id 763CDDD6-66DC-4440-81F0-7A5672784157@hintbits.com
Whole thread Raw
In response to Re: dubious optimization of the function in SELECT INTO target list  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general

On 08 Oct 2015, at 19:54, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:

Oleksii Kliukin wrote:

Thank you, now it’s clear. I have to say there is no guarantee that
the computation would be useless. Someone might be calling a function
that updates/deletes rows in the SELECT INTO block, being forced to
use SELECT INTO by inability of pl/pgSQL to just discard the result of
a normal SELECT. I know one can use a loop or call PERFORM, but in
some cases (a complex CTE computing the data for the function being
called at the end, which updates the tables with this data) actually
using SELECT INTO looks like the easiest path to achieve the desired
result.

So this whole issue is just because it is not possible to use PERFORM
alongside WITH?

The issue is in the SELECT INTO behaviour, but the root cause is exactly the lack of support for perform in CTEs in pl/pgSQL.

Kind regards,
--
Oleksii

pgsql-general by date:

Previous
From: Oleksii Kliukin
Date:
Subject: Re: dubious optimization of the function in SELECT INTO target list
Next
From: Albe Laurenz
Date:
Subject: Re: Version management for extensions