Re: Passing arrays to stored procedures

Поиск
Список
Период
Сортировка
Искать
От
William Garrison
Тема
Re: Passing arrays to stored procedures
Дата
Msg-id
46295CFF.3010900@mobydisk.com
Ответ на
Список
Дерево обсуждения
Passing arrays to stored procedures William Garrison <postgres@mobydisk.com>
Re: Passing arrays to stored procedures Tom Lane <tgl@sss.pgh.pa.us>
Re: Passing arrays to stored procedures William Garrison <postgres@mobydisk.com>
Re: Passing arrays to stored procedures Jorge Godoy <jgodoy@gmail.com>
Re: Passing arrays to stored procedures William Garrison <postgres@mobydisk.com>
Tom Lane wrote:
> William Garrison  writes:
>> I'm using npgsql and C#, and I've realized it doesn't support passing 
>> arrays.  Barring things like updating npgsql, what form of hackiness 
>> would work best here?
> 
>> The customerIDs are GUIDs represented as 16-byte arrays.  I can pass 
>> them as encoded strings separated by commas or some such silliness.  But 
>> I don't see a nice clean split() function that returns me an array. :-(
> 
> Do you need one?  Can't you just pass the array as one parameter?
> The text form of an array is like
> 	{value,value,value}
> which shouldn't be that hard to deal with if you can generate the text
> form of the individual bytea values.
> 
> 			regards, tom lane
> 

That doesn't work.  If I pass a string, then it is a string.

CREATE OR REPLACE FUNCTION CalculateTotals(
    customerList character varying,
.
.
.
     WHERE customerid = ANY($1);
Results in the error:
     ERROR: op ANY/ALL (array) requires array on right side

I tried casting the character string to an array afterward:

     WHERE customerid = ANY($1::bytea);
which results in:
     ERROR: cannot cast type character varying to bytea
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
От: Jorge Godoy
Дата:
FAQ