Re: BUG #5108: plpgsql function name conflict with table alias - Mailing list pgsql-bugs

From Balazs Klein
Subject Re: BUG #5108: plpgsql function name conflict with table alias
Date
Msg-id 2a56a6390910121338i1ae7b4efpc41dd52e0c77bed6@mail.gmail.com
Whole thread Raw
In response to Re: BUG #5108: plpgsql function name conflict with table alias  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #5108: plpgsql function name conflict with table alias
List 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@sss.pgh.pa.us> wrote:

> "Balazs Klein" <Balazs.Klein@gmail.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
>

pgsql-bugs by date:

Previous
From: "Federico"
Date:
Subject: BUG #5109: Error installing edb_apachephp.bin
Next
From: "Turner, Ian"
Date:
Subject: Kerberos authentication, Active Directory, and PostgreSQL