[GRASS-user] Workaround for temporary table with SQL keywords as column names
Luís Moreira de Sousa
luis.de.sousa at protonmail.ch
Thu Nov 4 09:46:42 PDT 2021
I am trying to transform a polygon layer to lines with a command like:
v.to.lines input=country_borders output=country_borders_lines --overwrite
This command fails because GRASS tries to create a temporary table whose column names are SQL keywords:
DBMI-PostgreSQL driver error:
Unable to execute:
CREATE TABLE country_borders_tmp_1513280_2 (cat integer,left integer,right integer)
ERROR: syntax error at or near "left"
LINE 1: ... TABLE country_borders_tmp_1513280_2 (cat integer,left integ...
For Postgres the correct command would have to be:
CREATE TABLE country_borders_tmp_1513280_2 (cat integer,"left" integer,"right" integer);
But could be different for other DBMS. In general it is not a good idea to use SQL keywords to name objects in a relational database.
To the question: is there a workaround for this problem? Can GRASS be instructed to not use SQL keywords as column names? Or somehow create valid SQL queries, for instance using double quotes?
Sent with [ProtonMail](https://protonmail.com/) Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user