Search Postgresql Archives

Re: Array value from table as parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

> From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Aislan Luiz Wendling
> Sent: Mittwoch, 20. Juli 2016 19:17
> To: pgsql-general@xxxxxxxxxxxxxx
> Subject:  Array value from table as parameter
>
> Hi,
>
> I need to pass an array as a parameter in a function, but it is a part of a trigger that get a "new" value.
>
> I've tested it like 
>
> select function_x(10000,555555,array[['xxxxx'],['yyyyy']]) 
> or
> select function_x(10000,555555,array[['xxxxx','yyyyy']]) 
>
> and it worked.
>
> But if I use 
>
> select function_x(10000,555555,new.situations)
>
> it doesn't work, as the value comes like this: {"xxxxx","yyyyy"}
> I couldn't find a function that converts {} values back to [] without treat it as a string and use replace, what I think that is
not the ideal solution because it may can't satisfy more complex arrays.

Would it help to simply cast the argument to TEXT[]?

select function_x(10000,555555,(new.situations)::TEXT[]);

I am not sure if the extra parenthesis are necessary.

Regards
Charles




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux