Re: How can I pass an array to SPI_execute_with_args()?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I pass an array to SPI_execute_with_args()?
Date: 2009-11-04 20:26:17
Message-ID: 20614.1257366377@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
> I would like to execute the code below.

Since you're apparently deconstructing and reconstructing the array
anyway, why don't you do the insertion at the C-array stage, and
do just one construct_array() that yields the final result?

> If the above marked line sets oids[1] = INT8OID, I get this error:

> ERROR: function array_append(anyarray, bigint) does not exist
> LINE 1: UPDATE product.t_product_inv SET ids = array_append($1, $2) ...
> ^

You'd need to use the types int8[] and int8, explicitly. No ANYARRAY.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-11-04 20:32:29 Re: Search system catalog for mystery type
Previous Message Sam Mason 2009-11-04 18:06:44 Re: Search system catalog for mystery type