Re: cast bytea to double precision[] - Mailing list pgsql-novice

From Merlin Moncure
Subject Re: cast bytea to double precision[]
Date
Msg-id CAHyXU0z9MpaW8GY9eu-Jc3ag=ndpQhfctBUwHjNEz1c=A5cPYQ@mail.gmail.com
Whole thread Raw
In response to Re: cast bytea to double precision[]  (Mathieu Dubois <mathieu.dubois@limsi.fr>)
Responses Re: cast bytea to double precision[]  (Mathieu Dubois <mathieu.dubois@limsi.fr>)
List pgsql-novice
On Sun, Jul 24, 2011 at 2:03 PM, Mathieu Dubois <mathieu.dubois@limsi.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.

merlin

pgsql-novice by date:

Previous
From: Mathieu Dubois
Date:
Subject: Re: cast bytea to double precision[]
Next
From: Mathieu Dubois
Date:
Subject: Re: cast bytea to double precision[]