Re: functions with side effect

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: functions with side effect
Date: 2018-07-19 14:27:32
Message-ID: 1532010452.2387.1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Torsten Förtsch wrote:
> assuming
>
> SELECT nextval('s'), currval('s');
>
> or
>
> SELECT * FROM (VALUES (nextval('s'), currval('s'))) t;
>
> is there any guarantee that the 2 output values are the same?

You can use at EXPLAIN (VERBOSE) output to see if it will work
in this special case, but I wouldn't depend on it in general.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-07-19 14:41:19 Re: cache lookup failed for attribute 1 of relation XXXXXX
Previous Message Torsten Förtsch 2018-07-19 14:15:28 functions with side effect