Re: variable value in array_to_string

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Armand Pirvu (home)" <armand(dot)pirvu(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: variable value in array_to_string
Date: 2016-11-22 01:12:22
Message-ID: CAKFQuwaf8Wnpzw-d30t7Y22asNZ5fwjE2iUpvFnoyrtk7DO0_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)pirvu(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Armand Pirvu (home) 2016-11-22 01:33:37 Re: variable value in array_to_string
Previous Message John McKown 2016-11-21 23:48:42 Re: Postgresql 9.5 and Shell scripts/variables vs. C programming/defining a value to be used