Opened 18 years ago
Last modified 18 years ago
#1298 closed defect (fixed)
GetNextFeature core dumps when ExecuteSQL used with distinct and query returns no results
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | ethan@… |
Description
I'm getting a core dump from the attached example script. It appears to be related to using ExecuteSQL with "select distinct" but only when the query returns no results. If I remove the "distinct" the script functions properly. The core dump occurrs at line 2233 of swq.c during a GetNextFeature call. I'm getting this in 1.3.2 and a browse of the CVS shows swq.c has not been modified recently. I don't see the option to attach a file here. Hopefully I can from the bug page.
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | test_gdal_bug_1298.zip added |
---|
comment:1 by , 18 years ago
Afaict if PrepareSummary() returns FALSE GetFeature will return NULL (the desired result for no results). To accomplish this I inserted the following check at line 507 of ogr_gensql.cpp: if(psSelectInfo->column_summary == NULL) { return FALSE; } This may be the patch needed since swq_select_summarize is what allocates the column_summary. If there are no results it doesn't get allocated. -e
comment:2 by , 18 years ago
I have made some changes in /gdal/ogr/ogrsf_frmts/generic/ogr_gensql.cpp's PrepareSummary() to deal with this issue. I've also extended the gdalautotest/ogr/ogr_sqltest.py script to test DISTINCT and MAX() on a result with no records. Thanks!
Note:
See TracTickets
for help on using tickets.
contains a shapefile and a perl script that demonstrates the core dump