Bug: Cannot assign ROWTYPE, RECORD variables in PL/pgSQL Affects: PL/pgSQL Severity: Annoyance Priority: Minor Enhancement Confirmed On: 7.3beta2, Linux
Given the following function: ======================================= create or replace function rowtype_test () returns text as ' declare this_row candidates%rowtype; that_row candidates%rowtype; begin select * into this_row from candidates; that_row := this_row; return that_row.first_name; end;' language 'plpgsql'; ======================================= ... it will error out at the assignment "that_row := this_row". For that matter, any attempt to assign the contents of two ROWTYPE or RECORD variables directly to each other will error out: that_record := this_record; SELECT this_row INTO that_row; SELECT * INTO that_row FROM this_row; The only way to populate that_row with a copy of this_row is by re-querying the source table. While a relatively easy workaround, this behaviour is annoying and inconsistent. It would be nice to fix in 7.3.1 or 7.4. Thanks for your attention. -- -Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly