From: basic <basic@mozdev.org>
To: Phil Endecott <spam_from_postgresql_sql@chezphil.org>
Cc: Riccardo G. Facchini <abief_ag_-postgresql@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: plpgsql - Insert from a record variable?
Date: Tue, 22 Jun 2004 08:57:19 +0800
Message-ID: <40D783EF.7020706@mozdev.org> (raw)
In-Reply-To: <2179249@chezphil.org>
References: <20040619060330.83941.qmail@web13901.mail.yahoo.com>
<17840.1087670348@sss.pgh.pa.us>
<4357626@chezphil.org>
<2179249@chezphil.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: basic@mozdev.org, spam_from_postgresql_sql@chezphil.org, abief_ag_-postgresql@yahoo.com
Subject: Re: plpgsql - Insert from a record variable?
In-Reply-To: <40D783EF.7020706@mozdev.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox