Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 22A2B9F9A8D for ; Thu, 23 Aug 2007 04:56:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 62286-04 for ; Thu, 23 Aug 2007 04:56:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp-out.neti.ee (barracuda.neti.ee [194.126.101.113]) by postgresql.org (Postfix) with ESMTP id BBD2E9F9CB4 for ; Thu, 23 Aug 2007 04:56:46 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by MXR-4.estpak.ee (Postfix) with ESMTP id 01A978150 for ; Thu, 23 Aug 2007 10:56:43 +0300 (EEST) X-Virus-Scanned: amavisd-new at !change-mydomain-variable!.example.com Received: from smtp-out.neti.ee ([127.0.0.1]) by localhost (MXR-1.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KPwM2YB3f+K7 for ; Thu, 23 Aug 2007 10:56:42 +0300 (EEST) Received: from Relayhost2.neti.ee (Relayhost2 [88.196.174.142]) by MXR-4.estpak.ee (Postfix) with ESMTP id 1DD3580E7 for ; Thu, 23 Aug 2007 10:56:42 +0300 (EEST) Received: from [172.16.27.126] (unknown [194.126.108.2]) by Relayhost2.neti.ee (Postfix) with ESMTP id A655C1DB2F9 for ; Thu, 23 Aug 2007 10:56:43 +0300 (EEST) Mime-Version: 1.0 (Apple Message framework v752.3) To: Postgresql General List Message-Id: <5177DE35-7DAD-4DAF-B314-242DAA2B15D1@skype.net> Content-Type: multipart/alternative; boundary=Apple-Mail-3--912301210 From: Kristo Kaiv Subject: table column vs. out param [1:0] Date: Thu, 23 Aug 2007 08:51:36 +0300 X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/1362 X-Sequence-Number: 119211 --Apple-Mail-3--912301210 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I am trying to implement the new out parameters in functions and stumbled upon a problem. There is an internal requirement for our databases that every function call always returns 2 params status & status_text. The problem now is that plpgsql selects the out params themselves into out params instead of function call results that i need there. If this is the expected behavior of out params it makes using out params a bit complicated if some table attributes happen to have the same name as out params. How can i overcome this situation? I can understand function variables having precedence over column names as you can freely rename them but out params is a different situation. snippet from code -[cut]-- out status int, -- 200 out status_text text -- OK ) AS $$ BEGIN -[cut]-- SELECT status, status_text FROM service._simple_add( i_key_user ,i_key_service ,i_action ,i_subscr_len) INTO status, status_text; -[cut]- Kristo Kaiv http://kaiv.wordpress.com (PostgreSQL blog) --Apple-Mail-3--912301210 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1
I am trying to = implement the new out parameters in functions and stumbled upon a = problem.
There is an internal requirement for our databases = that every function call always returns 2 params status & = status_text.=A0
The problem now=A0is that plpgsql selects the = out params themselves into out params instead of function call results = that i need there.
If this is the expected behavior of out = params it makes using out params a bit complicated if some table = attributes
happen to have the same name as out params. How can = i overcome this situation? I can understand function variables having = precedence
over column names as you can freely rename them but = out params is a different situation.=A0

snippet from = code
-[cut]--

=A0=A0 =A0out status int,=A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 -- 200 =
=A0 =A0 out status_text text=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 -- OK
) AS $$
BEGIN

-[cut]--=A0
=A0 = =A0=A0 =A0=A0 =A0=A0 =A0SELECT status, status_text
=A0 =A0 =A0 = =A0 =A0 =A0 =A0 FROM service._simple_add(
=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 i_key_user
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0=A0 ,i_key_service
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 = ,i_action
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 = ,i_subscr_len)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 INTO status, = status_text;
-[cut]-

Kristo Kaiv
http://kaiv.wordpress.com = (PostgreSQL blog)

=

= --Apple-Mail-3--912301210--