使用 psycopg2 出现 InternalError 后要怎么处理?
执行完第 6 行以后,再怎么执行都抛出
InternalError
.
请问有没有办法执行完第 6 行后还能继续查询?
1 import psycopg2
2 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 = bigint
LINE 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
我真的很纯洁
10 years, 10 months ago