Re: convert custom datatype to array

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: convert custom datatype to array
Дата
Msg-id 20071119150846.GB18602@alvh.no-ip.org
обсуждение исходный текст
Ответ на convert custom datatype to array  (Mike Charnoky <noky@nextbus.com>)
Ответы Re: convert custom datatype to array
Список pgsql-general
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).

--
Alvaro Herrera                  http://www.amazon.com/gp/registry/5ZYLFMCVHXC
"La tristeza es un muro entre dos jardines" (Khalil Gibran)

В списке pgsql-general по дате отправления:

Предыдущее
От: "Josh Harrison"
Дата:
Сообщение: postgresql storage and performance questions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: possible to create multivalued index from xpath() results in 8.3?