Re: Plperl Safe version check fails for Safe 2.09 - Mailing list pgsql-hackers

From Mark Kirkwood
Subject Re: Plperl Safe version check fails for Safe 2.09
Date
Msg-id 41A408EF.5060306@coretech.co.nz
Whole thread Raw
In response to Re: Plperl Safe version check fails for Safe 2.09  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
A bit more thinking led me to try:

   float       safe_version;
   ...
   eval_pv((safe_version < (float)2.09 ? safe_bad : safe_ok), FALSE);

which seems to fix the issue. (after all float *should* be accurate
enough in this case)

cheers

Mark

P.s : trivial patch attached

Andrew Dunstan wrote:

>
> Could be a rounding issue. What happens if you try this instead:?
>
>   eval_pv((safe_version <= 2.08 ? safe_bad : safe_ok), FALSE);
>
> Alternatively, what happens if we make safe_version a double rather
> than a float?
>
> (If nothing else works we might have to fall back on a lexical
> comparison)
>
> cheers
>
> andrew
>
--- plperl.c.orig    2004-11-24 17:04:07.000000000 +1300
+++ plperl.c    2004-11-24 17:04:21.000000000 +1300
@@ -244,7 +244,7 @@

     safe_version = SvNV(res);

-    eval_pv((safe_version < 2.09 ? safe_bad : safe_ok), FALSE);
+    eval_pv((safe_version < (float)2.09 ? safe_bad : safe_ok), FALSE);

     plperl_safe_init_done = true;
 }

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Beta5 now Available
Next
From: "Pawe³ Niewiadomski"
Date:
Subject: Bitmap index