Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3667 closed defect (fixed)

Handle Nan, Infinite and -Infinite numeric values in pg driver

Reported by: chaitanya Owned by: chaitanya
Priority: normal Milestone: 1.7.3
Component: OGR_SF Version: unspecified
Severity: normal Keywords: pg
Cc: warmerdam

Description

The pg driver is crashing when the numeric value NaN is being inserted. These special cases should be enclosed in single quotes.

Change History (5)

comment:1 by chaitanya, 14 years ago

Resolution: fixed
Status: newclosed

Corrected pg driver in trunk (r19971) and 1.7 branch (r19972). I'm not touching the 1.6 branch as there have been too many changes.

comment:2 by Even Rouault, 14 years ago

Milestone: 1.6.41.7.3
  • r19973 /trunk/autotest/ogr/ogr_pg.py: Compatibility fix for Python < 2.6 and Python > 2.6
  • r19974 /trunk/gdal/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp: PG driver: handling of Nan & Infinity : remove special case for OFTInteger and OFTIntegerList, fix for OFTRealList in COPY mode (#3667)
  • r19975 /branches/1.7/gdal/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp: PG driver: handling of Nan & Infinity : remove special case for OFTInteger and OFTIntegerList, fix for OFTRealList in COPY mode (#3667)
  • r19976 /trunk/autotest/ogr/ogr_pg.py: PG driver : Add test for NaN values in OFTRealList fields (#3667)

in reply to:  2 comment:3 by chaitanya, 14 years ago

Resolution: fixed
Status: closedreopened

Replying to rouault:

Thanks Even. I overlooked the OFTRealList format. However, I think OFTInteger values should be quoted for NaN because the SQL parser will look for a column named "nan". What do you think?

I'll incorporate your changes into the 1.7 branch.

comment:4 by Even Rouault, 14 years ago

Resolution: fixed
Status: reopenedclosed

My changes have been done in trunk (r19974) and in branches/1.7 (r19975) as well

And nan & infinity are concepts that only make sense for floating-point values, not integers (all values from 0x00000000 to 0xFFFFFFFF are "regular" integers), hence my removal of the special case for OFTInteger.

comment:5 by chaitanya, 14 years ago

I thought signed integers had a representation for NaN in some representations. I misremembered.

Note: See TracTickets for help on using tickets.