Skip to content

Commit 8b5e449

Browse files
committed
Add quotes to column name in SQL code
1 parent 7660648 commit 8b5e449

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/flex-table.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,24 +340,27 @@ void table_connection_t::stop(bool updateable, bool append)
340340

341341
auto const postgis_version = get_postgis_version();
342342

343+
auto const geom_column_name =
344+
"\"" + table().geom_column().name() + "\"";
345+
343346
sql += " ORDER BY ";
344347
if (postgis_version.major == 2 && postgis_version.minor < 4) {
345348
log_debug("Using GeoHash for clustering table '{}'",
346349
table().name());
347350
if (table().geom_column().srid() == 4326) {
348-
sql += "ST_GeoHash({},10)"_format(table().geom_column().name());
351+
sql += "ST_GeoHash({},10)"_format(geom_column_name);
349352
} else {
350353
sql +=
351354
"ST_GeoHash(ST_Transform(ST_Envelope({}),4326),10)"_format(
352-
table().geom_column().name());
355+
geom_column_name);
353356
}
354357
sql += " COLLATE \"C\"";
355358
} else {
356359
log_debug("Using native order for clustering table '{}'",
357360
table().name());
358361
// Since Postgis 2.4 the order function for geometries gives
359362
// useful results.
360-
sql += table().geom_column().name();
363+
sql += geom_column_name;
361364
}
362365

363366
m_db_connection->exec(sql);

0 commit comments

Comments
 (0)