On Tue, May 31, 2011 at 12:06 PM, Heikki Linnakangas <
heikki.linnakan...@enterprisedb.com> wrote:

> The documentation should be fixed too.
>
Patch with documentation fix is attached.

I tried to reproduce this problem on another computer with Windows, but
problem doesn't occurs. So, seems that it can be OS, compiler, optimization
level or CPU specific.
I provide some information about my laptop where I've encountered with
problem. I hope this helps to reproduce this problem if needed.

$ uname -a
Linux smagen-notebook 2.6.38-8-generic-pae #42-Ubuntu SMP Mon Apr 11
05:17:09 UTC 2011 i686 i686 i386 GNU/Linux

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"

$ gcc --version
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz
stepping : 10
cpu MHz : 800.000
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3
cx16 xtpr pdcm lahf_lm ida dts tpr_shadow vnmi flexpriority
bogomips : 3990.66
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz
stepping : 10
cpu MHz : 800.000
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc
arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3
cx16 xtpr pdcm lahf_lm ida dts tpr_shadow vnmi flexpriority
bogomips : 3989.97
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

------
With best regards,
Alexander Korotkov.
*** a/doc/src/sgml/gist.sgml
--- b/doc/src/sgml/gist.sgml
***************
*** 377,383 **** my_decompress(PG_FUNCTION_ARGS)
        <para>
         Returns a value indicating the <quote>cost</quote> of inserting the new
         entry into a particular branch of the tree.  Items will be inserted
!        down the path of least <function>penalty</function> in the tree.
        </para>
  
        <para>
--- 377,385 ----
        <para>
         Returns a value indicating the <quote>cost</quote> of inserting the new
         entry into a particular branch of the tree.  Items will be inserted
!        down the path of least <function>penalty</function> in the tree. Value
!        returned by <function>penalty</function> should be non-negative. Negative
!        values returned by <function>penalty</function> are treating as zero.
        </para>
  
        <para>
*** a/src/backend/access/gist/gistutil.c
--- b/src/backend/access/gist/gistutil.c
***************
*** 526,536 **** gistpenalty(GISTSTATE *giststate, int attno,
--- 526,540 ----
  
  	if (giststate->penaltyFn[attno].fn_strict == FALSE ||
  		(isNullOrig == FALSE && isNullAdd == FALSE))
+ 	{
  		FunctionCall3Coll(&giststate->penaltyFn[attno],
  						  giststate->supportCollation[attno],
  						  PointerGetDatum(orig),
  						  PointerGetDatum(add),
  						  PointerGetDatum(&penalty));
+ 		if (penalty < 0.0)
+ 			penalty = 0.0;
+ 	}
  	else if (isNullOrig && isNullAdd)
  		penalty = 0.0;
  	else
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to