Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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: 01-pg84-passedbyval-float4.patch.gz
Description: application/x-tar (2.6 KB)
Attachment: 02-pg84-passedbyval-float8.patch.gz
Description: application/x-tar (2.9 KB)
Attachment: 03-pg84-passedbyval-int64.patch.gz
Description: application/x-tar (2.2 KB)
Attachment: 04-pg84-passedbyval-tsearch.patch.gz
Description: application/x-tar (2.0 KB)

In response to


pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group