On Fri, Aug 31, 2007 at 08:49:05AM -0400, Merlin Moncure wrote:
> On 8/30/07, Tom Lane <[EMAIL PROTECTED]> wrote:
> > "Merlin Moncure" <[EMAIL PROTECTED]> writes:
> > > I noticed that enums are not available to be queried as binary through
> > > the protocol.
> >
> > What do you think the binary representation ought to be?  Copying OIDs
> > seems pretty useless.
> I'm on the fence on this one.
> I actually think this would be ok, if you mean pg_enum.oid, or the
> string would be fine too.  I agree that binary protocol is supposed to
> be fast, and I can prefetch the pg_enum table to the client and do the
> magic there.  Many other binary formats do similarly inscrutable
> things.

The last time I worked on a project where we had C code access the
database, we added stuff to map C enums to ints in the database (along
with a parent table to store the enum label). ISTM it'd be good if we
had a way to get the numeric index out of an enum. I also like the idea
of having a fixed ordering to the labels in an enum.

> One other very small observation: afaict, there appears to be no way
> to list enum contents in psql (although you can list the enums
> themselves in the type listing).  Maybe this should be possible?  I'm
> willing to take a stab at these things if Andrew is busy.

Is there an SRF that will return this info? ISTM you should be able to
get the labels programmatically as well as via psql.
Decibel!, aka Jim Nasby                        [EMAIL PROTECTED]
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Attachment: pgpZvVNayt8p0.pgp
Description: PGP signature

Reply via email to