From: | Adriaan Joubert <a(dot)joubert(at)albourne(dot)com> |
---|---|
To: | Postgresql <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in user-defined types? |
Date: | 2001-04-03 05:29:25 |
Message-ID: | 3AC95FB5.F9E6C11D@albourne.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
>
> Seems unlikely that that code could have worked either way, since you
> forgot to mark type uint2 as PASSEDBYVALUE...
>
Aargh! Thanks! Yes, when implementing it in the backend, that was just a
field to fill in, so I did it there. All seems well now.
One ends up with a vast number of combinations of types combinations for
different operators. As C takes care of the conversions, I wrote a
30-line perl script to generate me nearly 1600 lines of C for all the
type combinations (+ ~1700 lines of sql to define the
functions/operators). I cannot help feeling that that is not the right
way: if it can be done in a few lines of perl and relies on C cross-type
operations underneath anyway, it seems wrong to have to generate all
this code.
The problem is that there is not a clean hierarchy of SQL types, but for
many cases one could either convert the operands to int4 or float8 and
then numeric(?) and then convert back. At least the conversion operators
check for overflow, which is better than the current situation. And
precision wise it cannot be much worse: after all, large integer
constants already end up as floats. Is the SQL standard pedantic about
this?
BTW I could not find the discussion on entry-points to shared libraries
that Thomas mentioned. I've got some rushed dead-lines at the moment, so
I will not be able to look at anything for the next 3-4 weeks though.
Adriaan
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Warner | 2001-04-03 06:01:31 | Re: Re: Changing the default value of an inherited column |
Previous Message | Tom Lane | 2001-04-03 04:43:18 | Do we have any platforms that allow null pointer dereference? |