[GRASS-SVN] r74386 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 16 09:14:06 PDT 2019
Author: neteler
Date: 2019-04-16 09:14:06 -0700 (Tue, 16 Apr 2019)
New Revision: 74386
Modified:
grass/trunk/lib/vector/Vlib/write_pg.c
Log:
libvector: support reserved PostgreSQL keywords as column name by quoting when exporting vector map to PostGIS database (contributed by tmsz; fixes #3805)
Modified: grass/trunk/lib/vector/Vlib/write_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_pg.c 2019-04-16 13:38:09 UTC (rev 74385)
+++ grass/trunk/lib/vector/Vlib/write_pg.c 2019-04-16 16:14:06 UTC (rev 74386)
@@ -693,7 +693,7 @@
}
/* append column */
- sprintf(stmt_col, ",%s %s", colname, db_sqltype_name(sqltype));
+ sprintf(stmt_col, ",\"%s\" %s", colname, db_sqltype_name(sqltype));
strcat(stmt, stmt_col);
if (sqltype == DB_SQL_TYPE_CHARACTER) {
/* length only for string columns */
@@ -2046,7 +2046,7 @@
}
/* -> columns */
- sprintf(buf_tmp, "%s", colname);
+ sprintf(buf_tmp, "\"%s\"", colname);
strcat(buf, buf_tmp);
if (col < ncol - 1)
strcat(buf, ",");
More information about the grass-commit
mailing list