Repository: edgedb/edgedb

Issue:
Connecting EdgeDB to PGAdmin
<!-- Please search existing issues to avoid creating duplicates. -->

<!--
For the EdgeDB Version: run `edgedb query 'select sys::get_version_as_str()'` from your project directory (or run `select sys::get_version_as_str();` in the EdgeDB interactive shell).
For the EdgeDB CLI Version: Run `edgedb --version` from anywhere
-->

- EdgeDB Version: {'3.0+304325b'}

- EdgeDB CLI Version: EdgeDB CLI 3.3.0+071876c

- OS Version:   Linux Mint 21.1 x86_64 

### Steps to Reproduce:
#### Pre requisits: Edgedb running on docker.

- Setting up PGAdmin on Docker 

  ``` docker pull dpage/pgadmin4
  docker run -p 80:80 \
      -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' \
      -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \
      -d dpage/pgadmin4 ```

- Get edgedb credientials using the command ```edgedb instance credentials --insecure-dsn```
   ```edgedb://edgedb:<**pwd***>@172.18.32.2:5656/edgedb?tls_security=insecure```
 - Login to pgadmin portal and try to connect to edgedb database instance
 - Following are screenshots for connecting to database
 - 
![image](https://github.com/edgedb/edgedb/assets/20738627/9335d0b0-2c52-415e-81fa-9b8889a00aa8)
![image](https://github.com/edgedb/edgedb/assets/20738627/956b00d0-3a70-47f3-a8d1-9d5d39081cc8)
![image](https://github.com/edgedb/edgedb/assets/20738627/c09599bc-e3ae-482f-bb66-1e940ef5b86b)
![image](https://github.com/edgedb/edgedb/assets/20738627/53dc8b13-6977-4b27-ba38-27f89af42abe)
![image](https://github.com/edgedb/edgedb/assets/20738627/8db4b804-77ba-4c04-941a-80e8352ca20c)

When connected I get  ```Connection Time Out``` error




Discussion:
@raddevon , Kindly check

Resolving patch:
diff --git a/edb/pgsql/resolver/static.py b/edb/pgsql/resolver/static.py
--- a/edb/pgsql/resolver/static.py
+++ b/edb/pgsql/resolver/static.py
@@ -171,6 +171,7 @@ def eval_FuncCall(
 
     if fn_name == "set_config":
         # HACK: allow set_config('search_path', '', false) to support pg_dump
+        # HACK: allow set_config('bytea_output','hex',false) to support pgadmin
         if args := eval_list(expr.args, ctx=ctx):
             name, value, is_local = args
             if (
@@ -184,6 +185,14 @@ def eval_FuncCall(
                     and not is_local.val
                 ):
                     return value
+
+                if (
+                    name.val == "bytea_output"
+                    and value.val == "hex"
+                    and not is_local.val
+                ):
+                    return value
+
         raise errors.QueryError(
             "function set_config is not supported", context=expr.context
         )


Test patch:
diff --git a/tests/test_sql_query.py b/tests/test_sql_query.py
--- a/tests/test_sql_query.py
+++ b/tests/test_sql_query.py
@@ -1068,3 +1068,12 @@ async def test_sql_query_prepare_error_01(self):
 
     async def test_sql_query_empty(self):
         await self.scon.executemany('', args=[])
+
+    async def test_sql_query_pgadmin_hack(self):
+        await self.scon.execute("SET DateStyle=ISO;")
+        await self.scon.execute("SET client_min_messages=notice;")
+        await self.scon.execute(
+            "SELECT set_config('bytea_output','hex',false) FROM pg_settings"
+            " WHERE name = 'bytea_output'; "
+        )
+        await self.scon.execute("SET client_encoding='WIN874';")