zero-length delimited identifier at or near """"的解决办法(zero-length delimited...)

当程序中向postgresql或postgis中插入或者更新数据时,出现如下的错误:
org.postgresql.util.PSQLException: ERROR: zero-length delimited identifier at or near """"

...zero-length delimited

 

报错原因是:在一些数据库中,双引号“”可以用来标示字符串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

posted @   哩个啷个波  阅读(3750)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示