Re: plpgsql - Insert from a record variable?

From: basic <basic(at)mozdev(dot)org>
To: Phil Endecott <spam_from_postgresql_sql(at)chezphil(dot)org>
Cc: "Riccardo G(dot) Facchini" <abief_ag_-postgresql(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql - Insert from a record variable?
Date: 2004-06-22 00:57:19
Message-ID: 40D783EF.7020706@mozdev.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-06-22 01:30:49 Re: plpgsql - Insert from a record variable?
Previous Message Phil Endecott 2004-06-21 18:51:04 Re: plpgsql - Insert from a record variable?