Python psycopg2.ProgrammingError:语法错误位于或接近;关于;
这件事让我抓狂。我在网上看了看。 我的数据库是Postgres 9.5.4。 我正在使用python 3和psycopg2 2.7.1 我得到以下错误Python psycopg2.ProgrammingError:语法错误位于或接近;关于;,python,postgresql,psycopg2,Python,Postgresql,Psycopg2,这件事让我抓狂。我在网上看了看。 我的数据库是Postgres 9.5.4。 我正在使用python 3和psycopg2 2.7.1 我得到以下错误 psycopg2.ProgrammingError: syntax error at or near "ON" LINE 2: ON CONFLICT do nothing 我的代码是: try: c = db.cursor() c.execute("""INS
psycopg2.ProgrammingError: syntax error at or near "ON"
LINE 2: ON CONFLICT do nothing
我的代码是:
try:
c = db.cursor()
c.execute("""INSERT INTO my_table (id, name, tstmp)
VALUES (%s,%s,%s)
ON CONFLICT do nothing""",
(id, name, tstmp))
finally:
c.close()
psycopg2是否不支持
ON
,或者我做错了什么?您对使用9.5有多大把握<代码>从光标中选择版本()。