Re: plpgsql - Insert from a record variable? - Mailing list pgsql-sql

From basic
Subject Re: plpgsql - Insert from a record variable?
Date
Msg-id 40D783EF.7020706@mozdev.org
Whole thread Raw
In response to Re: plpgsql - Insert from a record variable?  ("Phil Endecott" <spam_from_postgresql_sql@chezphil.org>)
Responses Re: plpgsql - Insert from a record variable?  ("Phil Endecott" <spam_from_postgresql_sql@chezphil.org>)
List pgsql-sql
Phil Endecott wrote:> !!  execute ''column_values :=> !!     column_values || quote_literal(r.'' || cr.column_name ||
'')'';
I'm guessing you want something like

FOR rec IN EXECUTE ''select column_values || quote_literal(r.'' || cr.column_name || '') alias column_values''; LOOP
column_values:= rec.column_values;
 
END LOOP;

another suggestion, rather than do>    if not first then>      column_names := column_names || '', '';>
column_values:= column_values || '', '';>      first := false;>    end if;
 
why not use two arrays and append the name/values using array_append() and use array_to_string() to join them after
that?

--
basic


pgsql-sql by date:

Previous
From: "Phil Endecott"
Date:
Subject: Re: plpgsql - Insert from a record variable?
Next
From: Tom Lane
Date:
Subject: Re: plpgsql - Insert from a record variable?