Re: Array value from table as parameter

Поиск
Список
Период
Сортировка
От Charles Clavadetscher
Тема Re: Array value from table as parameter
Дата
Msg-id 006901d1e414$f48f35c0$ddada140$@swisspug.org
обсуждение исходный текст
Ответ на Array value from table as parameter  (Aislan Luiz Wendling <aislanluiz@hotmail.com>)
Ответы Re: Array value from table as parameter  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-general
Hello

> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Aislan Luiz
Wendling
> Sent: Mittwoch, 20. Juli 2016 19:17
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] 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
thinkthat 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




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

Предыдущее
От: Alex Ignatov
Дата:
Сообщение: Re: pg_dump without any SET command in header of output plain text sql file
Следующее
От: Attacker One
Дата:
Сообщение: d88a45e680327e0b22a34020d8f78252 - Re: MongoDB 3.2 beating Postgres 9.5.1?