Re: convert custom datatype to array

From: Mike Charnoky <noky(at)nextbus(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: convert custom datatype to array
Date: 2007-11-19 15:45:30
Message-ID: 4741AF9A.9000606@nextbus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OK, forgive my ignorance here, but the maintainer of our custom data
type code is no longer with us and this is new territory for me. We do
have a function which takes our custom data type and returns a cstring.
Is there a pg function which converts a cstring to text type? This
seems to be the missing link to eventually get the data to float4[].

Mike

Alvaro Herrera wrote:
> Mike Charnoky wrote:
>> Our database schema was designed before postgresql supported arrays and
>> contains a custom type which is basically a float4 array. I would like
>> to clean things up and convert the custom datatype to float4[], as this
>> would obviate the need for us to compile a custom shared object. We are
>> hitting problems with pg8.3 and I would rather just drop the custom stuff.
>>
>> Problem is, I cannot do an ALTER COLUMN:
>>
>> mydb=# alter table mytable alter column mycolumn float4[];
>> ERROR: column "mycolumn" cannot be cast to type "float4[]"
>
> You can specify a USING clause to let the system know exactly how to
> convert your type to float[]. I suspect you can use float4in() and
> something to read out your type into the format that float4in expects (a
> hacked up version of your out function perhaps).
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-11-19 15:50:56 Re: convert custom datatype to array
Previous Message Tom Hart 2007-11-19 15:42:24 Re: convert access sql to postgresql