From 86e988f6973034a1d426a66557561c9d74427073 Mon Sep 17 00:00:00 2001 From: Tomas Zigo <50632337+tmszi@users.noreply.github.com> Date: Wed, 17 Apr 2024 09:34:19 +0200 Subject: [PATCH] v.in.ogr: fix escape table column name during creating table (#3605) * v.in.ogr: fix escape table column name during creating table Which allow create DB table column name with reserved keyword. * Use SQL standard double quotes instead of single quotes --- vector/v.in.ogr/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vector/v.in.ogr/main.c b/vector/v.in.ogr/main.c index a5de8fa8cff..ab63041ccfd 100644 --- a/vector/v.in.ogr/main.c +++ b/vector/v.in.ogr/main.c @@ -1224,12 +1224,12 @@ int main(int argc, char *argv[]) /* Create table */ i = 0; - sprintf(buf, "create table %s (%s %s", Fi->table, col_info[i].name, - col_info[i].type); + sprintf(buf, "create table %s (\"%s\" %s", Fi->table, + col_info[i].name, col_info[i].type); db_set_string(&sql, buf); for (i = 1; i < ncols_out; i++) { - sprintf(buf, ", %s %s", col_info[i].name, col_info[i].type); + sprintf(buf, ", \"%s\" %s", col_info[i].name, col_info[i].type); db_append_string(&sql, buf); }