关于rg.postgresql.util.PSQLException: ERROR: zero-length delimited identifier at or near “”””的解决办法

当程序中向postgresql或postgis中插入或者更新数据时,出现如下的错误:

org.postgresql.util.PSQLException: ERROR: zero-length delimited identifier at or near “”””


报错原因是:在一些数据库中,双引号“”可以用来标示字符串String,但是在Postgres数据库中,双引号只能用来引用标示符(Double quotes are used only to quote an “identifier”, i.e., the name of a table, column, view, etc. ),例如用来引用表名、列名等。所以,当你的语句里用双引号来标引String时,Postgre解析器以为你在引用一个标示符“identifier”(表名或者列名),但是却发现双引号里面没有对应的“标示符”,因此会报这个错误。


解决办法:在Postgres查询时,对于String你只能用单引号或者&来标识。In a Postgres query, you should always use single quotes or “dollar quotes” (see http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING)
for string literals.

转载自:https://blog.csdn.net/gis1226/article/details/8894312

You may also like...