Re: Array string casts with SELECT but not SELECT DISTINCT
От | sridhar bamandlapally |
---|---|
Тема | Re: Array string casts with SELECT but not SELECT DISTINCT |
Дата | |
Msg-id | CAGuFTBUwK-k1d8iV2pvcc4v=dktL8scTPF2_RiiJu419R9=X8Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Array string casts with SELECT but not SELECT DISTINCT (Ken Tanzer <ken.tanzer@gmail.com>) |
Ответы |
Re: Array string casts with SELECT but not SELECT DISTINCT
Re: Array string casts with SELECT but not SELECT DISTINCT |
Список | pgsql-general |
>>>ERROR: column "my_array" is of type character varying[] but expression is of type text
please try this below, may be this should help
CREATE CAST (text AS varchar) WITH INOUT AS IMPLICIT;
just for info:
actually this should be available in default
On Fri, Feb 20, 2015 at 9:48 AM, Ken Tanzer <ken.tanzer@gmail.com> wrote:
Hi. Here's a boiled down example of something that caught me by surprise:ag_reach_test=> CREATE TEMP TABLE foo (my_array varchar[]);CREATE TABLEag_reach_test=> INSERT INTO foo (my_array) SELECT '{TEST}';INSERT 0 1ag_reach_test=> SELECT my_array[1],array_length(my_array,1) FROM foo;my_array | array_length----------+--------------TEST | 1(1 row)ag_reach_test=> INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}';ERROR: column "my_array" is of type character varying[] but expression is of type textLINE 1: INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}';^HINT: You will need to rewrite or cast the expression.It's easy enough to add a cast, but I was curious if this was expected and desired behavior. Thanks.Ken--AGENCY SoftwareA Free Software data systemBy and for non-profits(253) 245-3801learn more about AGENCY orfollow the discussion.
В списке pgsql-general по дате отправления: