float4/float8/int64 passed by value with tsearch fixup

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-patches(at)postgresql(dot)org, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: float4/float8/int64 passed by value with tsearch fixup
Date: 2008-03-31 11:08:36
Message-ID: 47F0C634.5010801@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


I tried to split the previous patch up to see where the tsearch regression
comes from. So, it turned out that:
- float4 conversion is risk free (patch #1)
- float8 conversion is okay, too, if coupled with time[stamp[tz]] conversion
(patch #2) but with int64 timestamps enabled, the next one is also
- int64 conversion (patch #3) is mostly okay but it is the one that's
the tsearch regression

I looked at the tsearch code and found only one thing that can be
suspicious, namely:

typedef uint64 TSQuerySign;

TSQuerySign is handled almost everywhere as an allocated,
passed-by-reference value. I converted it with the attached patch (#4)
so it uses Int64GetDatum() and DatumGetInt64() functions internally
and the regression went away. Please, consider applying all four patches.

Best regards,
Zoltán Böszörményi

Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH

Attachment Content-Type Size
01-pg84-passedbyval-float4.patch.gz application/x-tar 2.6 KB
02-pg84-passedbyval-float8.patch.gz application/x-tar 2.9 KB
03-pg84-passedbyval-int64.patch.gz application/x-tar 2.2 KB
04-pg84-passedbyval-tsearch.patch.gz application/x-tar 2.0 KB

In response to


Browse pgsql-patches by date

  From Date Subject
Next Message Marcello Ceschia 2008-03-31 12:26:54 BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data
Previous Message Brendan Jurd 2008-03-31 11:04:05 Re: Consistent \d commands in psql