Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group