On Thu, Sep 4, 2014 at 3:06 PM, Marko Tiikkaja <ma...@joh.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
From 1f90090a65c48bba0057b3866f454e28e3f45f55 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp <ma...@juffo.org> Date: Wed, 8 Oct 2014 22:23:43 +0300 Subject: [PATCH] Fix PL/pgSQL ambiguity in RETURNS TABLE example Author: Marko Tiikkaja --- doc/src/sgml/plpgsql.sgml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index f008e93..f195495 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -487,8 +487,8 @@ $$ LANGUAGE plpgsql; CREATE FUNCTION extended_sales(p_itemno int) RETURNS TABLE(quantity int, total numeric) AS $$ BEGIN - RETURN QUERY SELECT quantity, quantity * price FROM sales - WHERE itemno = p_itemno; + RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s + WHERE s.itemno = p_itemno; END; $$ LANGUAGE plpgsql; </programlisting> -- 2.1.2
-- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs