pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phil Endecott <spam_from_postgresql_sql@chezphil.org>
To: basic <basic@mozdev.org>
To: pgsql-sql@postgresql.org
Subject: Re: plpgsql - Insert from a record variable?
Date: Tue, 22 Jun 2004 10:05:20 -0400
Message-ID: <6249353@chezphil.org> (raw)
In-Reply-To: <40D783EF.7020706@mozdev.org>
References: <20040619060330.83941.qmail@web13901.mail.yahoo.com>
	<17840.1087670348@sss.pgh.pa.us>
	<4357626@chezphil.org>
	<2179249@chezphil.org>
	<40D783EF.7020706@mozdev.org>

Phil> execute ''column_values :=
Phil>  column_values || quote_literal(r.'' || cr.column_name || '')'';

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

I think your code will try to execute a query like this:

select column_values || quote_literal(r.something) alias column_values

This will fail because column_values and r are both plpgsql variables, and so are not visible to the SQL interpreter.

Any other suggestions?

--Phil.



view thread (8+ messages)

Message-ID: <6249353@chezphil.org>
Permalink:  ../6249353@chezphil.org/
Also on:    postgresql.org/message-id/6249353@chezphil.org

 · 

reply

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: spam_from_postgresql_sql@chezphil.org, basic@mozdev.org
  Subject: Re: plpgsql - Insert from a record variable?
  In-Reply-To: <6249353@chezphil.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