From: Marko Tiikkaja <marko@joh.to>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PG Docs <pgsql-docs@postgresql.org>
Subject: Re: PL/PgSQL: stmt_fors and variable value after loop
Date: Mon, 19 Jan 2015 18:10:59 +0100
Message-ID: <54BD3AA3.1020107@joh.to> (raw)
In-Reply-To: <54BD2E05.2090004@joh.to>
References: <54BD24C1.4060601@joh.to>
<26441.1421682246@sss.pgh.pa.us>
<54BD2E05.2090004@joh.to>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>
FWIW, I went with this method:
On 1/19/15 5:17 PM, I wrote:
> 3) Use a count(*) OVER () inside the query and EXIT if that count is 1
I guess defining this behavior wouldn't be such a big win, since the
approach I showed would only work if the loop body keeps a count of the
number of iterations somewhere; FOR doesn't appear to be setting
row_count. I'm having a hard time imagining actual use cases where the
count doesn't matter but you'd like to look at the last values anyway.
If you think there's any chance that this would prevent us from changing
the implementation for the better in the future, I think we should just
drop this issue.
.marko
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: marko@joh.to, tgl@sss.pgh.pa.us
Subject: Re: PL/PgSQL: stmt_fors and variable value after loop
In-Reply-To: <54BD3AA3.1020107@joh.to>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox