Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, pgsql-sql(at)hub(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
Date: 2000-01-27 17:52:37
Message-ID: 5406.948995557@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> Could you try the follwoing patch ?

> Hiroshi, I don't see this in the main tree, nor do I see it having been
> requested for application. Should I apply it?

If this does fix things, I would venture that the blame really belongs
to whatever caller of the comparison function is failing to interpret
the return value correctly ...

BTW there is a somewhat-related issue that has been bothering me:
the system is pretty erratic about converting between Datum and bool.
Some places use "DatumGetInt32(datum) != 0" as their effective test
for whether a Datum value is "true", some places use
"DatumGetInt8(datum) != 0", some places just do "(bool) datum", and
there may be other variants.

I am thinking of introducing DatumGetBool and BoolGetDatum macros and
trying to make the code use those uniformly, but there's a lot of code
to clean up. I was intending to do it during the function manager
interface rewrite, since all these same places will need to be looked
at for that.

Perhaps we should also try to clean up btree's sort comparison functions
in the same way, with some macros that provide a well-defined conversion
between Datum and the "<", "=", ">" return conditions that are intended.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Terence Gannon 2000-01-27 17:58:22 Large Functions and Index Rebuild
Previous Message Nicolas Huillard 2000-01-27 17:52:07 RE: [GENERAL] Problem with SELECT on large negative INT4

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-27 17:52:43 Re: [HACKERS] Column ADDing issues
Previous Message Peter Eisentraut 2000-01-27 17:41:55 Re: [HACKERS] Column ADDing issues

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2000-01-27 17:59:00 Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
Previous Message Nicolas Huillard 2000-01-27 17:52:07 RE: [GENERAL] Problem with SELECT on large negative INT4