Using Variables in dblink_build_sql_insert

From: ldrlj1 <russelljanusz(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using Variables in dblink_build_sql_insert
Date: 2013-04-01 17:18:59
Message-ID: 1364836739700-5750332.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here is what I get from the documentation:

The last two arguments are:
text[] src_pk_att_vals_array,
text[] tgt_pk_att_vals_array
SELECT dblink_build_sql_insert('foo', '1 2', 2, '{"1", "a"}', '{"1",
"b''a"}');

How do I replace the src and tgt with variables from within my function? I
can easily create the insert statement with a true value, but if I loop over
a record and try to dynamically set the src and tgt I get errors.

declare

bob_record record;
frank character varying[];

for bob_record in select bob from table;
loop
frank = bob_record.bob;
SELECT dblink_build_sql_insert('foo', '1',1, '{"frank"}', '{frank"}');
end loop;

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Using-Variables-in-dblink-build-sql-insert-tp5750332.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ldrlj1 2013-04-01 18:17:56 Re: Using Variables in dblink_build_sql_insert
Previous Message Lee Hachadoorian 2013-04-01 15:25:35 Re: Current Schema for Functions called within other Functions