Re: variable value in array_to_string - Mailing list pgsql-general

From David G. Johnston
Subject Re: variable value in array_to_string
Date
Msg-id CAKFQuwaf8Wnpzw-d30t7Y22asNZ5fwjE2iUpvFnoyrtk7DO0_A@mail.gmail.com
Whole thread Raw
In response to Re: variable value in array_to_string  ("Armand Pirvu (home)" <armand.pirvu@gmail.com>)
Responses Re: variable value in array_to_string  ("Armand Pirvu (home)" <armand.pirvu@gmail.com>)
List pgsql-general
Please don't top-post - it makes following the thread a lot harder.

On Mon, Nov 21, 2016 at 4:15 PM, Armand Pirvu (home) <armand.pirvu@gmail.com> wrote:
Played with unnest  but not much luck

If you want help you will need to show your work - ideally with examples that can execute with meaningful data on an empty database.

The follow gives the expected results:

DO $$
DECLARE
foo text[];
foo1 text;
delim text := ',';
begin
foo := ARRAY['one','two']::text[];
foo1 := array_to_string(foo, delim);
RAISE NOTICE '%', foo1;
END;
$$;

NOTICE: one,two

David J.

pgsql-general by date:

Previous
From: John McKown
Date:
Subject: Re: Postgresql 9.5 and Shell scripts/variables vs. C programming/defining a value to be used
Next
From: "Armand Pirvu (home)"
Date:
Subject: Re: variable value in array_to_string