Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-05-01 Thread Tom Lane
Andrew Dunstan writes: > On 04/30/2018 02:41 PM, Tom Lane wrote: >> I was just about to propose exactly that fix. This undef'ing of isnan >> traces back to Andrew's 2006 commit ea73a78b0. I think perhaps that's not >> necessary with any still-supported version of Perl; I see no evidence on >> my

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-05-01 Thread Tom Lane
I wrote: > I googled a bit and found these recommendations on stackoverflow: > my $inf= 9**9**9; > my $neginf = -9**9**9; > my $nan= -sin(9**9**9); > These do seem to produce the desired results, at least on the > couple of Perl versions I checked, including 5.8.3. Nope, buildfarm shows th

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Tom Lane
Andrew Dunstan writes: > Fingers crossed we'll be OK. Looking at the perl headers on a Windows > machine I'm doing some other stuff on, the #define is protected by an > #ifndef. I'm always happy when my hacks can be removed :-) Well, the early returns on that are promising, but we have another pr

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Andrew Dunstan
On 04/30/2018 02:41 PM, Tom Lane wrote: > Peter Eisentraut writes: >> On 4/30/18 13:56, Tom Lane wrote: >>> So this isn't working on Windows: ... >>> The reason seems to be this kluge in plperl.h: >>> >>> /* stop perl headers from hijacking stdio and other stuff on Windows */ >>> #ifdef WIN32 >>

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Tom Lane
Peter Eisentraut writes: > On 4/30/18 13:56, Tom Lane wrote: >> So this isn't working on Windows: ... >> The reason seems to be this kluge in plperl.h: >> >> /* stop perl headers from hijacking stdio and other stuff on Windows */ >> #ifdef WIN32 >> #define WIN32IO_IS_STDIO >> /* >> * isnan is def

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Peter Eisentraut
On 4/30/18 13:56, Tom Lane wrote: > So this isn't working on Windows: > > contrib/jsonb_plperl/jsonb_plperl.c(226): warning C4013: 'isnan' undefined; > assuming extern returning int > [c:\pgbuildfarm\pgbuildroot\HEAD\pgsql.build\jsonb_plperl.vcxproj] > ... > .\Release\jsonb_plperl\jsonb_plperl.d

Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Tom Lane
Peter Eisentraut writes: > Prevent infinity and NaN in jsonb/plperl transform So this isn't working on Windows: contrib/jsonb_plperl/jsonb_plperl.c(226): warning C4013: 'isnan' undefined; assuming extern returning int [c:\pgbuildfarm\pgbuildroot\HEAD\pgsql.build\jsonb_plperl.vcxproj] ... .\Rel

pgsql: Prevent infinity and NaN in jsonb/plperl transform

2018-04-30 Thread Peter Eisentraut
Prevent infinity and NaN in jsonb/plperl transform jsonb uses numeric internally, and numeric can store NaN, but that is not allowed by jsonb on input, so we shouldn't store it. Also prevent infinity to get a consistent error message. (numeric input would reject infinity anyway.) Reported-by: D