From bec8cea3e39642e146b85c94512d43eeef0d5e2d Mon Sep 17 00:00:00 2001 From: Josip Date: Fri, 16 Jun 2017 16:53:36 +0200 Subject: [PATCH] DBAPI: PostgreSQL crash (#421) Fixes #0010071. --- gramps/plugins/db/dbapi/postgresql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/db/dbapi/postgresql.py b/gramps/plugins/db/dbapi/postgresql.py index eca488584..95246e9eb 100644 --- a/gramps/plugins/db/dbapi/postgresql.py +++ b/gramps/plugins/db/dbapi/postgresql.py @@ -65,6 +65,7 @@ class Postgresql: query = query.replace("?", "%s") query = query.replace("REGEXP", "~") query = query.replace("desc", "desc_") + query = query.replace("BLOB", "bytea") ## LIMIT offset, count ## count can be -1, for all ## LIMIT -1 @@ -114,7 +115,7 @@ class Postgresql: def table_exists(self, table): self.__cursor.execute("SELECT COUNT(*) " "FROM information_schema.tables " - "WHERE table_name=?;", [table]) + "WHERE table_name=%s;", [table]) return self.fetchone()[0] != 0 def close(self):