Lists: | pgsql-docs |
---|
From: | Marko Tiikkaja <marko(at)joh(dot)to> |
---|---|
To: | PG Docs <pgsql-docs(at)postgresql(dot)org> |
Subject: | Broken example in PL/PgSQL documentation |
Date: | 2014-09-04 12:06:40 |
Message-ID: | 540855D0.4020108@joh.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-docs |
Hi,
Just came across a broken example in the docs:
local:marko=#* select * from extended_sales(1);
ERROR: column reference "quantity" is ambiguous
LINE 1: SELECT quantity, quantity * price FROM sales
^
DETAIL: It could refer to either a PL/pgSQL variable or a table column.
QUERY: SELECT quantity, quantity * price FROM sales
WHERE itemno = p_itemno
CONTEXT: PL/pgSQL function "extended_sales" line 3 at RETURN QUERY
Patch to fix this attached.
.marko
Attachment | Content-Type | Size |
---|---|---|
plpgsql_return_query.patch | text/plain | 687 bytes |
From: | Marti Raudsepp <marti(at)juffo(dot)org> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | PG Docs <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: Broken example in PL/PgSQL documentation |
Date: | 2014-10-08 19:25:56 |
Message-ID: | CABRT9RASN=r8uQt+iC7JRnVo4t0h5XVf9UtvCmhLLxOeZrV0dA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-docs |
On Thu, Sep 4, 2014 at 3:06 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
> Just came across a broken example in the docs
+1. New version works. I would slightly prefer adding an alias to the table:
RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s
WHERE s.itemno = p_itemno;
Other than that, there's not much to review here, marking as "Ready
for Committer"
Alternative patch attached, let the committer decide.
Regards,
Marti
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-PL-pgSQL-ambiguity-in-RETURNS-TABLE-example.patch | text/x-patch | 914 bytes |
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marti Raudsepp <marti(at)juffo(dot)org> |
Cc: | Marko Tiikkaja <marko(at)joh(dot)to>, PG Docs <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: Broken example in PL/PgSQL documentation |
Date: | 2014-10-09 17:37:17 |
Message-ID: | CAFj8pRARV2uk=h8YO8AiW-P=HcqqvbQ2YxSWAb+r7QmGVXQ62A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-docs |
2014-10-08 21:25 GMT+02:00 Marti Raudsepp <marti(at)juffo(dot)org>:
> On Thu, Sep 4, 2014 at 3:06 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
> > Just came across a broken example in the docs
>
> +1. New version works. I would slightly prefer adding an alias to the
> table:
>
> RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s
> WHERE s.itemno = p_itemno;
>
> Other than that, there's not much to review here, marking as "Ready
> for Committer"
>
This last patch is good. I it good fix of this problem - and usage of
qualified identifiers is common and recommended solution.
It is really ready for commiter.
Regards
Pavel
>
> Alternative patch attached, let the committer decide.
>
> Regards,
> Marti
>
>
> --
> Sent via pgsql-docs mailing list (pgsql-docs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-docs
>
>
From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Marti Raudsepp <marti(at)juffo(dot)org>, Marko Tiikkaja <marko(at)joh(dot)to>, PG Docs <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: Broken example in PL/PgSQL documentation |
Date: | 2014-10-09 18:23:05 |
Message-ID: | CAHGQGwGA5nYH=LPW5g4LN3c1t1nqX1n9qpBOcmYSb1Q6zu_GwQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-docs |
On Fri, Oct 10, 2014 at 2:37 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
>
> 2014-10-08 21:25 GMT+02:00 Marti Raudsepp <marti(at)juffo(dot)org>:
>>
>> On Thu, Sep 4, 2014 at 3:06 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
>> > Just came across a broken example in the docs
>>
>> +1. New version works. I would slightly prefer adding an alias to the
>> table:
>>
>> RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s
>> WHERE s.itemno = p_itemno;
>>
>> Other than that, there's not much to review here, marking as "Ready
>> for Committer"
>
>
> This last patch is good. I it good fix of this problem - and usage of
> qualified identifiers is common and recommended solution.
>
> It is really ready for commiter.
Applied. Thanks!
Regards,
--
Fujii Masao