Re: Plperl Safe version check fails for Safe 2.09
| От | Mark Kirkwood | 
|---|---|
| Тема | Re: Plperl Safe version check fails for Safe 2.09 | 
| Дата | |
| Msg-id | 41A408EF.5060306@coretech.co.nz обсуждение исходный текст | 
| Ответ на | Re: Plperl Safe version check fails for Safe 2.09 (Andrew Dunstan <andrew@dunslane.net>) | 
| Список | 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 по дате отправления: