Closed HunDunDM closed 5 years ago
Hi,
If still relevant, can you please post the full reproduction?
still relevant, I now use
psycopg2.extras.register_default_json(globally=True)
psycopg2.extras.register_default_jsonb(globally=True)
instead of await pool.register_json()
import momoko
import psycopg2.extras
from tornado.ioloop import IOLoop
async def main():
dsn = 'dbname=xxxxxx user=xxxxxx password=xxxxx host=xxxx port=xxxx'
pool = momoko.Pool(
dsn=dsn,
setsession=["SET TIME ZONE PRC"],
cursor_factory=psycopg2.extras.RealDictCursor, # delete this line, the problem does not exist
)
await pool.connect()
await pool.register_json()
# psycopg2.extras.register_default_json(globally=True)
# psycopg2.extras.register_default_jsonb(globally=True)
pool.close()
if __name__ == '__main__':
ioloop = IOLoop.current()
ioloop.run_sync(main)
I guess the reason is: in
momoko.connection.Connection._register
will getoid, array_oid = 'json_oid', 'json_arr_oid'
but we should getoid, array_oid = 114, 199