From a8b3188ea48625fb9c3918ab5be18ab542cc2599 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Wed, 1 Feb 2023 14:07:33 -0500 Subject: [PATCH] Update pgproto and add tests for client_encoding Depends on MagicStack/py-pgproto#20 --- asyncpg/pgproto | 2 +- tests/test_connect.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/asyncpg/pgproto b/asyncpg/pgproto index a4178145..591c9061 160000 --- a/asyncpg/pgproto +++ b/asyncpg/pgproto @@ -1 +1 @@ -Subproject commit a4178145cd7cc3a44eee20cfc9e8b94a7fed2053 +Subproject commit 591c906121dbfc4f479ac521bf2cd90cbccea360 diff --git a/tests/test_connect.py b/tests/test_connect.py index 7707a1c9..97dea2eb 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -77,6 +77,15 @@ async def test_get_settings_01(self): self.assertEqual( self.con.get_settings().client_encoding, 'UTF8') + await self.con.execute("set client_encoding to 'sql-ascii'") + self.assertEqual(self.con.get_settings().client_encoding, "SQL_ASCII") + + async def test_client_encoding(self): + await self.con.execute("set client_encoding to 'sql-ascii'") + encoding = await self.con.fetchval("show client_encoding") + self.assertEqual(encoding, "SQL_ASCII") + encoding = await self.con.fetchval("select $1::text", encoding) + self.assertEqual(encoding, "SQL_ASCII") async def test_server_version_01(self): version = self.con.get_server_version()