Ticket #3667 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

  Changed 3 years ago by chaitanya

  • status changed from new to closed
  • resolution set to fixed

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.

follow-up: ↓ 3   Changed 3 years ago by rouault

  • milestone changed from 1.6.4 to 1.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   Changed 3 years ago by chaitanya

  • status changed from closed to reopened
  • resolution fixed deleted

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.

  Changed 3 years ago by rouault

  • status changed from reopened to closed
  • resolution set to fixed

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.

  Changed 3 years ago by chaitanya

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

Note: See TracTickets for help on using tickets.