Re: RE : Record unassigned yet - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: RE : Record unassigned yet
Date
Msg-id 415D4372.8090303@archonet.com
Whole thread Raw
In response to RE : Record unassigned yet  ("Johann Robette" <jrobette@onyme.com>)
List pgsql-hackers
Johann Robette wrote:
> Oh sorry about that!
> No, I was alright in the syntax. Both are defined as current.
> I can't find where the problem lies...

The following works fine for me.

=== BEGIN test ===
DROP TABLE employees;

CREATE TABLE employees (id integer, name text);
COPY employees FROM stdin;
1   Aaron Aardvark
2   Betty Bee
3   Carl Cat
\.

CREATE OR REPLACE FUNCTION emp_test_fn() RETURNS boolean AS '
DECLARE    current RECORD;    Tmp     integer;
BEGIN    FOR current IN SELECT * FROM employees LOOP        Tmp := current.id;        RAISE NOTICE ''tmp = %'', Tmp;
ENDLOOP;    RETURN true;
 
END
'
LANGUAGE 'plpgsql';

SELECT emp_test_fn();
=== END test ===

PS - please reply to the -general list not -hackers.

--   Richard Huxton  Archonet Ltd


pgsql-hackers by date:

Previous
From: "Johann Robette"
Date:
Subject: RE : Record unassigned yet
Next
From: "Marc G. Fournier"
Date:
Subject: Re: CREATE INDEX speeds up query on 31 row table ...