[postgis-tickets] r15086 - Really fix callback reading Edge data in presence of unexpected NULLs
Sandro Santilli
strk at kbt.io
Thu Sep 8 09:06:47 PDT 2016
Author: strk
Date: 2016-09-08 09:06:47 -0700 (Thu, 08 Sep 2016)
New Revision: 15086
Modified:
branches/2.2/topology/postgis_topology.c
Log:
Really fix callback reading Edge data in presence of unexpected NULLs
Modified: branches/2.2/topology/postgis_topology.c
===================================================================
--- branches/2.2/topology/postgis_topology.c 2016-09-08 16:06:29 UTC (rev 15085)
+++ branches/2.2/topology/postgis_topology.c 2016-09-08 16:06:47 UTC (rev 15086)
@@ -589,12 +589,13 @@
if ( isnull ) {
lwpgwarning("Found edge with NULL edge_id");
edge->edge_id = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (edge_id)"
+ " has int32 val of %d",
+ colno, val);
+ edge->edge_id = val;
}
- val = DatumGetInt32(dat);
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (edge_id)"
- " has int32 val of %d",
- colno, val);
- edge->edge_id = val;
}
if ( fields & LWT_COL_EDGE_START_NODE ) {
@@ -602,66 +603,72 @@
if ( isnull ) {
lwpgwarning("Found edge with NULL start_node");
edge->start_node = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (start_node)"
+ " has int32 val of %d", colno, val);
+ edge->start_node = val;
}
- val = DatumGetInt32(dat);
- edge->start_node = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (start_node)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_END_NODE ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
if ( isnull ) {
lwpgwarning("Found edge with NULL end_node");
edge->end_node = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (end_node)"
+ " has int32 val of %d", colno, val);
+ edge->end_node = val;
}
- val = DatumGetInt32(dat);
- edge->end_node = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (end_node)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_FACE_LEFT ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
if ( isnull ) {
lwpgwarning("Found edge with NULL face_left");
edge->face_left = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (face_left)"
+ " has int32 val of %d", colno, val);
+ edge->face_left = val;
}
- val = DatumGetInt32(dat);
- edge->face_left = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (face_left)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_FACE_RIGHT ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
if ( isnull ) {
lwpgwarning("Found edge with NULL face_right");
edge->face_right = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (face_right)"
+ " has int32 val of %d", colno, val);
+ edge->face_right = val;
}
- val = DatumGetInt32(dat);
- edge->face_right = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (face_right)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_NEXT_LEFT ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
if ( isnull ) {
lwpgwarning("Found edge with NULL next_left");
edge->next_left = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (next_left)"
+ " has int32 val of %d", colno, val);
+ edge->next_left = val;
}
- val = DatumGetInt32(dat);
- edge->next_left = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (next_left)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_NEXT_RIGHT ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
if ( isnull ) {
lwpgwarning("Found edge with NULL next_right");
edge->next_right = -1;
+ } else {
+ val = DatumGetInt32(dat);
+ POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (next_right)"
+ " has int32 val of %d", colno, val);
+ edge->next_right = val;
}
- val = DatumGetInt32(dat);
- edge->next_right = val;
- POSTGIS_DEBUGF(2, "fillEdgeFields: colno%d (next_right)"
- " has int32 val of %d", colno, val);
}
if ( fields & LWT_COL_EDGE_GEOM ) {
dat = SPI_getbinval(row, rowdesc, ++colno, &isnull);
More information about the postgis-tickets
mailing list