From: | William Garrison <postgres(at)mobydisk(dot)com> |
---|---|
To: | Jorge Godoy <jgodoy(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Passing arrays to stored procedures |
Date: | 2007-04-21 05:38:04 |
Message-ID: | 4629A33C.9000904@mobydisk.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Yeah, I meant bytea[].
It still doesn't work. Same error:
ERROR: cannot cast type character varying to bytea[]
Not that this is not the same as doing
select '{1, 2, 3}'::int[].
This is the equivalent of doing
SELECT ('{10000, 10000, 10000, 10000}'::varchar(255))::int[];
I can't pass in a string then cast it to something other than a string.
You have made me realize though, that what you are suggesting might work
if I call this as an ad-hoc SELECT statement instead of calling the
stored procedure directly. Less efficient, but then I should be able to
do what you suggest. I'll have to try that. Or maybe that is what you
meant all along.
Jorge Godoy wrote:
> William Garrison <postgres(at)mobydisk(dot)com> writes:
>
>> 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
>
> You meant array or bytea?
>
>
> neo=# select '{1, 2, 3}'::int[];
> int4
> ---------
> {1,2,3}
> (1 record)
>
> neo=#
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2007-04-21 06:37:43 | Re: Modify existing index |
Previous Message | RPK | 2007-04-21 05:12:21 | Re: Schema relationship diagram |