| From: | Marko Tiikkaja <marko(at)joh(dot)to> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | PG Docs <pgsql-docs(at)postgresql(dot)org> | 
| Subject: | Re: PL/PgSQL: stmt_fors and variable value after loop | 
| Date: | 2015-01-19 17:10:59 | 
| Message-ID: | 54BD3AA3.1020107@joh.to | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thom Brown | 2015-01-20 13:50:22 | Aggregate expression syntax | 
| Previous Message | Marko Tiikkaja | 2015-01-19 16:33:59 | Re: PL/PgSQL: stmt_fors and variable value after loop |