psycopg2使用遇到InternalError错误是什么原因,,执行完第 6 行以后,再
psycopg2使用遇到InternalError错误是什么原因,,执行完第 6 行以后,再
执行完第 6 行以后,再怎么执行都抛出 InternalError.
请问有没有办法执行完第 6 行后还能继续查询?
1 import psycopg22 conn = psycopg2.connect("dbname=test user=test")3 cur = conn.cursor()4 cur.execute("select phone from account where phone = %s;", ("13366668888",))5 cur.fetchone()6 cur.execute("select phone from account where phone = %s;", (13366668888,))7 cur.execute("select phone from account where phone = %s;", ("13366668888",))
输出如下(省略了 Traceback):
Out[5]: ('13366668888',)Out[6]: ProgrammingError: operator does not exist: character varying = bigintLINE 1: select phone from account where phone = 13366668888; ^HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.Out[7]: InternalError: current transaction is aborted, commands ignored until end of transaction block
中文就是
所以你想继续的话,开启新事务就可以了,比如 conn.commit() 一下。
猜测应该是psycopg2的实现把execute的语句当作事务来处理了.
所以当某条语句执行失败后
编橙之家文章,
相关内容
- 在python里面怎么样使用socket连接,pythonsocket连接,尝试连
- python中证明x的平方加上y的平方等于3,没有有理数解?
- pycharm运行scrapy除了cmd外还有别的吗,pycharmscrapy,目前启
- 使用Python解析豆瓣网API的源码解析,pythonapi,为何我在浏
- Python语法lft[-1]>=rgt[-1]应该怎么解读,lftrgt,def me
- 求Python遍历有元组的列表思路,python遍列表思路,item=
- pycharm4.0.5 ubuntu 14.10中文输入法问题跪求大神指点,,装
- 简单来说django app是个什么概念?,djangoapp概念,本人早
- Python sql执行escape掉单引号和双引号方法是?,pythonesca
- Python是如何判断大数据唯一性的呢?,python判断数据,我
评论关闭