plpgsql assigning RECORD := RECORD - Mailing list pgsql-general

From bsides2@hotmail.com (MK)
Subject plpgsql assigning RECORD := RECORD
Date
Msg-id 3eb0886f.0409150029.321cbc1e@posting.google.com
Whole thread Raw
Responses Re: plpgsql assigning RECORD := RECORD  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi all,

I have a question regarding the RECORD type in plpgsql functions.

How do I assign a RECORD variable to another RECORD variable?

For example,

DECLARE
rs1 RECORD;
rs2 RECORD;
BEGIN

FOR rs1 IN SELECT * FROM mytable LOOP

  rs2 := rs1; --IS THIS POSSIBLE!?
END LOOP;
END;

When executing my function I  receive 'syntax error at or near "rs2"'.
So, obviously my syntax is not correct. Is there another way to
perform this?

In my loop I need to have access to the PREVIOUS record. There are A
LOT of fields being selected so storing each in its own variable is
not a desirable solution.

Any ides?

Thanks in advance

pgsql-general by date:

Previous
From: Vincent.Desloges@alcatel.fr
Date:
Subject: support on postgres
Next
From: tmp
Date:
Subject: Re: psql + autocommit