Re: Broken example in PL/PgSQL documentation
От | Amit Kapila |
---|---|
Тема | Re: Broken example in PL/PgSQL documentation |
Дата | |
Msg-id | CAA4eK1JqNwuqkVi7tS=uLcELX57zo0GjiaGdv6rz5AeKXji5wg@mail.gmail.com обсуждение исходный текст |
Ответ на | Broken example in PL/PgSQL documentation (Marko Tiikkaja <marko@joh.to>) |
Список | pgsql-docs |
>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.
Patch will surely fix the broken example, however I
SELECT s.quantity, s.quantity * s.price FROM sales s
WHERE s.itemno = p_itemno;
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
> 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.
Patch will surely fix the broken example, however I
am wondering if it is better to write the query using
alias.
..SELECT s.quantity, s.quantity * s.price FROM sales s
WHERE s.itemno = p_itemno;
Note - I have cc'ed to hackers as the review for CF patches
are posted on hackers list.
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-docs по дате отправления: