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

Поиск
Список
Период
Сортировка
От Boszormenyi Zoltan
Тема Re: How can I pass an array to SPI_execute_with_args()?
Дата
Msg-id 4AF270D5.6060908@cybertec.at
обсуждение исходный текст
Ответ на Re: How can I pass an array to SPI_execute_with_args()?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: How can I pass an array to SPI_execute_with_args()?
Список pgsql-general
Tom Lane írta:
> Boszormenyi Zoltan <zb@cybertec.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?
>

Okay, that's a good idea. :-)

>> 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.
>

OK, so the OID for int8[] is (looking at pg_type.h...) 1016,
i.e. for type "_int8"? It worked this way. Thank you very much.

A question, though: why are there symbolic names for certain
array types (FLOAT4ARRAYOID, etc) but not for the most?

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: error caused by FOREIGN KEY on composite type
Следующее
От: Hitoshi Harada
Дата:
Сообщение: Re: sudoku in an sql statement