Re: BUG #5108: plpgsql function name conflict with table alias

From: Balazs Klein <balazs(dot)klein(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5108: plpgsql function name conflict with table alias
Date: 2009-10-12 20:38:40
Message-ID: 2a56a6390910121338i1ae7b4efpc41dd52e0c77bed6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,
the test case below runs fine for me if the function name is not instreq and
returns an error if it is.

Regards.
Balazs

CREATE TABLE aaa (
instreq_id integer
);

INSERT INTO aaa (instreq_id) VALUES (223);
INSERT INTO aaa (instreq_id) VALUES (224);
INSERT INTO aaa (instreq_id) VALUES (225);
INSERT INTO aaa (instreq_id) VALUES (226);
INSERT INTO aaa (instreq_id) VALUES (227);
INSERT INTO aaa (instreq_id) VALUES (228);
INSERT INTO aaa (instreq_id) VALUES (229);

CREATE OR REPLACE FUNCTION instreq(OUT instreq_id integer)
RETURNS SETOF integer AS
$BODY$
DECLARE
rec record;

BEGIN

FOR rec IN
Select instreq.instreq_id From aaa instreq

LOOP
instreq_id =rec.instreq_id;
RETURN NEXT;
End Loop;

END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100
ROWS 1000;

On Mon, Oct 12, 2009 at 4:15 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "Balazs Klein" <Balazs(dot)Klein(at)gmail(dot)com> writes:
> > On 8.4.1 on windows XP running the function gives an error message
> > (Undefined column: 7 ERROR: record "rec" has no field "instreq_id") wich
> is
> > strange because the underlying query does return that column.
>
> There's really no way to investigate that without a *complete* example.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Turner, Ian 2009-10-13 00:42:06 Kerberos authentication, Active Directory, and PostgreSQL
Previous Message Federico 2009-10-12 14:53:24 BUG #5109: Error installing edb_apachephp.bin