From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Gustavo Tonini <gustavotonini(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Varchar -> Integer[] conversion |
Date: | 2007-08-25 16:46:08 |
Message-ID: | 46D05CD0.9010809@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Gustavo Tonini wrote:
> Someone have a function that converts a string literal (a varchar
> argument) to an integer array?
It isn't clear from your question if you want this:
select string_to_array('1,2,3'::varchar,',')::int[];
string_to_array
-----------------
{1,2,3}
(1 row)
or this:
select array['1'::varchar]::int[];
array
-------
{1}
(1 row)
or this:
select array(select '1'::varchar)::int[];
int4
------
{1}
(1 row)
or maybe this:
select ('{}'::varchar[] || '1'::varchar)::int[];
int4
------
{1}
(1 row)
Please provide more detail on what you need to accomplish.
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2007-08-25 16:52:55 | Re: Add Column BEFORE/AFTER another column |
Previous Message | Joshua D. Drake | 2007-08-25 16:18:18 | Re: [PERFORM] Partioning tsearch2 a table into chunks and accessing via views |