Re: Current enums patch

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Current enums patch
Date: 2007-04-01 14:40:13
Message-ID: 460FC44D.1030306@tomd.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> text_enum: same problem as above, plus not acceptable to assume that it
> gets the right enum OID, plus very definitely not acceptable to assume
> that OID and typmod are the same size, plus I don't like the
> undocumented kluge in getBaseTypeAndTypmod that is pretending to supply
> the type OID for some small fraction of possible invocation cases.
>
> I think text_enum is probably toast.

This was the ugliest part of the patch, and I mentioned it explicitly in
the original submission because I was uncomfortable about it. The proper
solution seemed to be to have another allowed cast function signature
that would take the regtype rather than the typmod. That got just a
little beyond what I wanted to do in the patch, and ugly as the
getBaseTypeAndTypmod hack was, it seemed less intrusive.

Another way to skirt the issue was to simply set the typmod of enum
types to have their own OID, but a) I wasn't sure what other things the
system might be inferring from the presence of a typmod, and b) you just
stated that we can't assume that typmod is big enough to hold an OID anyway.

I'm less concerned about the generic return type in this case, since the
parser should know the return type when an explicit cast has been
called. <Goes to check> Hmm, ok, maybe not. Looks like it's using the
return type of the cast function and throwing away the explicit cast
information. That's not very nice, but can probably be fixed in the parser.

Thoughts?

Tom

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-04-01 17:15:51 Re: Updateable cursors patch
Previous Message Tom Dunstan 2007-04-01 14:27:27 Re: Current enums patch