Skip site navigation (1) Skip section navigation (2)

Re: cast bytea to double precision[]

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Mathieu Dubois <mathieu(dot)dubois(at)limsi(dot)fr>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: cast bytea to double precision[]
Date: 2011-07-25 15:54:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Sun, Jul 24, 2011 at 2:03 PM, Mathieu Dubois <mathieu(dot)dubois(at)limsi(dot)fr> wrote:
> I have found a solution by myself for the conversion:
> regexp_split_to_array(sig_vector, E',')::double precision[] (elements are in
> fact separated by commas).
> To convert my column I have used:
> ALTER TABLE my_table ALTER sig_vector TO double precision[] USING
> regexp_split_to_array(sig_vector, E',')::double precision[];
> Is that correct?
> Is it correct to pass the column name to regexp_split_to_array()?

Yeah -- you are just passing a column's data into a function as an
argument -- standard practice.  This will work -- your bytea is really
a text column, so it's just a matter of breaking up the string.
regexp_* functions are great for that.


In response to


pgsql-novice by date

Next:From: Mathieu DuboisDate: 2011-07-25 15:58:02
Subject: Re: cast bytea to double precision[]
Previous:From: Mathieu DuboisDate: 2011-07-24 19:03:36
Subject: Re: cast bytea to double precision[]

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group