Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fg9u9-0004gD-In for pgsql-general@arkaria.postgresql.org; Thu, 19 Jul 2018 14:27:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fg9u8-0005pe-1b for pgsql-general@arkaria.postgresql.org; Thu, 19 Jul 2018 14:27:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fg9u7-0005pX-PV for pgsql-general@lists.postgresql.org; Thu, 19 Jul 2018 14:27:39 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fg9u4-0000An-QJ for pgsql-general@postgresql.org; Thu, 19 Jul 2018 14:27:39 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 2C04641238; Thu, 19 Jul 2018 16:27:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 9a5MlRDLo7D9; Thu, 19 Jul 2018 16:27:33 +0200 (CEST) Message-ID: <1532010452.2387.1.camel@cybertec.at> Subject: Re: functions with side effect From: Laurenz Albe To: Torsten =?ISO-8859-1?Q?F=F6rtsch?= , PostgreSQL mailing lists Date: Thu, 19 Jul 2018 16:27:32 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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