From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | "klimych(at)tut(dot)by" <klimych(at)tut(dot)by>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14275: cursor's variable in pgsql doesn't respect scope |
Date: | 2016-08-04 14:23:53 |
Message-ID: | CAKFQuwbMNt4yyKYRPEAVy5CdkYZ0Qf52fsQsTfiiDPwDxrOd-w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Aug 4, 2016 at 10:10 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
wrote:
>
>
> 2016-08-04 15:03 GMT+02:00 klimych(at)tut(dot)by <klimych(at)tut(dot)by>:
>
>> Thank you!
>> Sorry, I should read the documentation more carefully (athough I didnt't
>> expect to find explanation of such behaviour in "Returning Cursors"
>> section, as well as I didn't belive such behaviour could be made on
>> purpose).
>> And thanks again for workaround! It seems to be the only way to use
>> cursors in pl/pgsql (the weirdest thing I've ever seen, I should say)
>>
>
> I agree so this is little bit strange - it looks like workaround of some
> historical limit of SPI. It is too late to change. But it has some
> advantage. Postgres can't to pass parameters by ref. With named cursors you
> can do it.
>
>
The docs could maybe be improved, though it is documented and being
mis-informed simply results in an error and a question on the lists, so
expending get mental effort here isn't that appealing.
Improving the code would involve something like:
OPEN unbound_cursorvar [ [ NO ] SCROLL ] [ NAME system_name ] FOR query
Also, would a hint on the error message be too much to ask?
HINT: by default the global name of the cursor is equal to the variable
name to which it is assigned
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-08-04 14:25:39 | Re: BUG #14277: when define USE_NAMED_POSIX_SEMAPHORES , make error |
Previous Message | Pavel Stehule | 2016-08-04 14:10:20 | Re: BUG #14275: cursor's variable in pgsql doesn't respect scope |