Re: enum types and binary queries
От
Andrew Dunstan
Тема
Re: enum types and binary queries
Дата
Msg-id
46D710E2.3070604@dunslane.net
Ответ на
enum types and binary queries (Merlin Moncure)
Список
Дерево обсуждения
enum types and binary queries "Merlin Moncure" <mmoncure@gmail.com>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Tom Lane <tgl@sss.pgh.pa.us>
Re: enum types and binary queries "korry.douglas" <korry.douglas@enterprisedb.com>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Tom Lane <tgl@sss.pgh.pa.us>
Re: enum types and binary queries "Merlin Moncure" <mmoncure@gmail.com>
Re: enum types and binary queries Decibel! <decibel@decibel.org>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Decibel! <decibel@decibel.org>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Tom Lane <tgl@sss.pgh.pa.us>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Re: enum types and binary queries Gregory Stark <stark@enterprisedb.com>
Re: enum types and binary queries Alvaro Herrera <alvherre@commandprompt.com>
Re: enum types and binary queries Gregory Stark <stark@enterprisedb.com>
Re: enum types and binary queries Tom Lane <tgl@sss.pgh.pa.us>
Re: enum types and binary queries Andrew Dunstan <andrew@dunslane.net>
Merlin Moncure wrote:
> I noticed that enums are not available to be queried as binary through
> the protocol. Is this a known issue? Too late to fix for 8.3? This
> is kind of a pain, because it forces any query that returns an enum to
> return the entire result as text. afaik, enums are the only POD type
> to behave this way.
>
> postgres=# create type foo as enum('foo');
> CREATE TYPE
>
> postgres=# copy (select 'foo'::foo) to '/home/postgres/foo.txt' binary;
> ERROR: no binary output function available for type foo
>
The trouble is that an enum doesn't have an immutable internal binary value.
I guess we could say that the binary value is the integer offset of the
value in the enum ordering, and translate it back on input. Providing
the binary IO funcs shouldn't be too hard if we do that, unless I'm
missing something.
cheers
andrew
В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата: