pglite icon indicating copy to clipboard operation
pglite copied to clipboard

Cannot connect to @electric-sql/pglite-socket with Jetbrain's Datagrip

Open hanayashiki opened this issue 6 months ago • 11 comments

Versions

{
    "@electric-sql/pglite": "^0.3.3",
    "@electric-sql/pglite-socket": "^0.0.8"
}

Step to reproduce

  1. Start the pglite server
pnpm pglite-server -p 5433
  1. Then add a Postgres Source in DataGrip
Image

Here is the error I got:

DBMS: PostgreSQL (ver. 17.4)
Case sensitivity: plain=lower, delimited=exact
Driver: PostgreSQL JDBC Driver (ver. 42.7.3, JDBC4.2)

Ping: 9 ms

parse <unnamed>: SET application_name = 'DataGrip 2024.2.1'.
bind <unnamed> to <unnamed>.

If I try again, it says:

DBMS: PostgreSQL (ver. 17.4)
Case sensitivity: plain=lower, delimited=exact
Driver: PostgreSQL JDBC Driver (ver. 42.7.3, JDBC4.2)
[99999] Something unusual has occurred to cause the driver to fail. Please report this exception.
serverVersion must not be null.

This library is of very good DX. I wish we could resolve this. Thanks in advance!

hanayashiki avatar Jun 20 '25 17:06 hanayashiki

I know the reason is that PGlite does not fully implement the Postgres Wire Protocol, which current DB viewers' Postgres JDBC driver requires. So currently there is no way to use DBeaver or DataGrip to view the database.

Hope this issue will save time for others.

hanayashiki avatar Jun 21 '25 14:06 hanayashiki

wire protocol should be fully supported now, do you have repro case for it failingon JDBC ?

Meanwhile ssl connection are not supported at all, what is in the ssh/ssl tab ? also try the default database template1 instead of postgres for a test with user "postgres".

pmp-p avatar Jun 23 '25 06:06 pmp-p

Still got not luck. Please take a look at my configuration. @pmp-p

Image Image Image Image

My setup:

npm add @electric-sql/pglite-socket      
npx pglite-server -p 5433
cat package.json 
{
  "dependencies": {
    "@electric-sql/pglite-socket": "^0.0.8"
  }
}
cat package-lock.json 
{
  "name": "pglite-socket-connect",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "dependencies": {
        "@electric-sql/pglite-socket": "^0.0.8"
      }
    },
    "node_modules/@electric-sql/pglite": {
      "version": "0.3.3",
      "resolved": "https://registry.npmjs.org/@electric-sql/pglite/-/pglite-0.3.3.tgz",
      "integrity": "sha512-JrvHOx9q0yvKEby0bK8qzGTVw6K+yEg8enxDWb2IwNKr5XZxRrBb+GNIqoAIP7yXyhRg5jcENWmdHmtnAT87vA==",
      "license": "Apache-2.0",
      "peer": true
    },
    "node_modules/@electric-sql/pglite-socket": {
      "version": "0.0.8",
      "resolved": "https://registry.npmjs.org/@electric-sql/pglite-socket/-/pglite-socket-0.0.8.tgz",
      "integrity": "sha512-37kxepdlqUiCZcHoaZFIe6x6aaFkbYE7fxt2MJKUfB+ppVCOdr2jaw69fC4FtThfmMdDj0u2ls/FQO+fp+m5OA==",
      "license": "Apache-2.0",
      "bin": {
        "pglite-server": "dist/scripts/server.js"
      },
      "peerDependencies": {
        "@electric-sql/pglite": "0.3.3"
      }
    }
  }
}

Database is connectable by psql

 PGSSLMODE=disable psql -p 5433 -h 127.0.0.1
Password for user chenyuwang: 
psql (15.8 (Homebrew), server 17.4)
WARNING: psql major version 15, server major version 17.
         Some psql features might not work.
Type "help" for help.

chenyuwang=# 

hanayashiki avatar Jun 26 '25 02:06 hanayashiki

@pmp-p
I'm trying to repro this with a simple Java JDBC client, but it seems not reproducing. So the problem might be the requirements of some Postgres features that the caller of JDBC (the GUI apps) are not satisifed. This is the verbose log when trying connecting from DataGrip

npx pglite-server -p 5433 --debug=5
Initializing PGLite with database: memory://
Debug level: 5
pglite: no db
# 3245:/home/runner/work/pglite/pglite/src/bin/initdb/initdb.c calling pg_initdb_main for initdb
LOG:  could not execute command ""/tmp/pglite/bin/postgres" -V": Function not implemented
# WARNING: program "postgres" is needed by initdb but was not found in the same directory as "/tmp/pglite/bin/initdb"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with this locale configuration:
  locale provider:   libc
  LC_COLLATE:  C
  LC_CTYPE:    C.UTF-8
  LC_MESSAGES: C
  LC_MONETARY: C
  LC_NUMERIC:  C
  LC_TIME:     C
The default text search configuration will be set to "english".

Data page checksums are disabled.

# 3527:/home/runner/work/pglite/pglite/src/bin/initdb/initdb.c
creating directory /tmp/pglite/base ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 25
selecting default "shared_buffers" ... 400kB
# 95:/home/runner/work/pglite/pglite/pglite-REL_17_4_WASM/pgl_stubs.h select_default_timezone(/tmp/pglite/share/postgresql): STUB
selecting default time zone ... UTC
creating configuration files ... ok
# popen["/tmp/pglite/bin/postgres" --boot -F -c log_checkpoints=false  -X 1048576] (BOOT)
# pg_pclose(/tmp/initdb.boot.txt) 133:/home/runner/work/pglite/pglite/pglite-REL_17_4_WASM/pgl_os.h
running bootstrap script ... ok
# popen["/tmp/pglite/bin/postgres" --single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false  template1 >/dev/null] (SINGLE)
# 1733: --------------------------------- added /tmp/pglite/share/postgresql/system_constraints.sql, 220 lines
# 1733: --------------------------------- added /tmp/pglite/share/postgresql/system_functions.sql, 788 lines
# 1733: --------------------------------- added /tmp/pglite/share/postgresql/system_views.sql, 1377 lines
# 1733: --------------------------------- added /tmp/pglite/share/postgresql/snowball_create.sql, 1211 lines
# 1733: --------------------------------- added /tmp/pglite/share/postgresql/information_schema.sql, 3046 lines
# pg_pclose(/tmp/initdb.single.txt) 135:/home/runner/work/pglite/pglite/pglite-REL_17_4_WASM/pgl_os.h
performing post-bootstrap initialization ... ok

Sync to disk skipped.
The data directory might become corrupt if the operating system crashes.

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /tmp/pglite/bin/pg_ctl -D /tmp/pglite/base -l logfile start

2025-06-26 03:06:15.982 GMT [0] DEBUG:  invoking IpcMemoryCreate(size=147456000)
# FIXING: int shmget (key_t __key=747, size_t __size=40, int __shmflg=1920) pagesize default=65536
# FIXING: void *shmat (int __shmid=666, const void *__shmaddr=0, int __shmflg=0)
2025-06-26 03:06:16.004 GMT [0] DEBUG:  dynamic shared memory system will support 679 segments
2025-06-26 03:06:16.004 GMT [0] DEBUG:  created dynamic shared memory control segment 1600840450 (16308 bytes)
2025-06-26 03:06:16.004 GMT [0] DEBUG:  transaction ID wrap limit is 2147483650, limited by database with OID 1
2025-06-26 03:06:16.004 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.005 GMT [0] DEBUG:  creating and filling new WAL file
2025-06-26 03:06:16.006 GMT [0] DEBUG:  done creating and filling new WAL file
2025-06-26 03:06:16.008 GMT [0] DEBUG:  InitPostgres
# 758:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
# 764:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
# 766:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
2025-06-26 03:06:16.008 GMT [0] NOTICE:  database system was shut down at 2025-06-26 03:06:16 GMT
2025-06-26 03:06:16.009 GMT [0] DEBUG:  checkpoint record is at 0/100028
2025-06-26 03:06:16.009 GMT [0] DEBUG:  redo record is at 0/100028; shutdown true
2025-06-26 03:06:16.009 GMT [0] DEBUG:  next transaction ID: 3; next OID: 10000
2025-06-26 03:06:16.009 GMT [0] DEBUG:  next MultiXactId: 1; next MultiXactOffset: 0
2025-06-26 03:06:16.009 GMT [0] DEBUG:  oldest unfrozen transaction ID: 3, in database 1
2025-06-26 03:06:16.009 GMT [0] DEBUG:  oldest MultiXactId: 1, in database 1
2025-06-26 03:06:16.009 GMT [0] DEBUG:  commit timestamp Xid oldest/newest: 0/0
2025-06-26 03:06:16.009 GMT [0] DEBUG:  transaction ID wrap limit is 2147483650, limited by database with OID 1
2025-06-26 03:06:16.009 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.009 GMT [0] DEBUG:  starting up replication slots
2025-06-26 03:06:16.009 GMT [0] DEBUG:  xmin required by slots: data 0, catalog 0
2025-06-26 03:06:16.009 GMT [0] DEBUG:  starting up replication origin progress state
2025-06-26 03:06:16.009 GMT [0] DEBUG:  reading stats file "pg_stat/pgstat.stat"
2025-06-26 03:06:16.009 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.010 GMT [0] DEBUG:  MultiXact member stop limit is now 4294914944 based on MultiXact 1
2025-06-26 03:06:16.067 GMT [0] DEBUG:  rehashing catalog cache id 6 for pg_attribute; 65 tups, 32 buckets
2025-06-26 03:06:16.072 GMT [0] DEBUG:  rehashing catalog cache id 6 for pg_attribute; 129 tups, 64 buckets
2025-06-26 03:06:16.073 GMT [0] DEBUG:  rehashing catalog cache id 32 for pg_index; 129 tups, 64 buckets
# 338 cleanup(boot): /home/runner/work/pglite/pglite/src/backend/bootstrap/bootstrap.c
# 108:fake shutdown
# skipped shmem_exit_index=5/6
# before_shmem_exit_index=4/6
2025-06-26 03:06:16.098 GMT [0] NOTICE:  shutting down
2025-06-26 03:06:16.099 GMT [0] DEBUG:  performing replication slot checkpoint
2025-06-26 03:06:16.102 GMT [0] DEBUG:  attempting to remove WAL segments older than log file 000000000000000000000000
2025-06-26 03:06:16.102 GMT [0] DEBUG:  SlruScanDirectory invoking callback on pg_subtrans/0000
# skipped shmem_exit_index=3/6
# skipped shmem_exit_index=2/6
# skipped shmem_exit_index=1/6
# skipped shmem_exit_index=0/6
# dsm_backend_shutdown ?
# 758:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
# 764:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
# 766:/home/runner/work/pglite/pglite/src/backend/utils/init/postinit.c
2025-06-26 03:06:16.103 GMT [0] NOTICE:  database system was shut down at 2025-06-26 03:06:16 GMT
2025-06-26 03:06:16.103 GMT [0] DEBUG:  checkpoint record is at 0/1B1D38
2025-06-26 03:06:16.103 GMT [0] DEBUG:  redo record is at 0/1B1D38; shutdown true
2025-06-26 03:06:16.103 GMT [0] DEBUG:  next transaction ID: 3; next OID: 10115
2025-06-26 03:06:16.103 GMT [0] DEBUG:  next MultiXactId: 1; next MultiXactOffset: 0
2025-06-26 03:06:16.103 GMT [0] DEBUG:  oldest unfrozen transaction ID: 3, in database 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  oldest MultiXactId: 1, in database 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  commit timestamp Xid oldest/newest: 0/0
2025-06-26 03:06:16.103 GMT [0] DEBUG:  transaction ID wrap limit is 2147483650, limited by database with OID 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  MultiXact member stop limit is now 4294914944 based on MultiXact 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  starting up replication slots
2025-06-26 03:06:16.103 GMT [0] DEBUG:  xmin required by slots: data 0, catalog 0
2025-06-26 03:06:16.103 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.103 GMT [0] DEBUG:  MultiXact member stop limit is now 4294914944 based on MultiXact 1

PostgreSQL stand-alone backend 17.4
2025-06-26 03:06:16.132 GMT [0] DEBUG:  rehashing catalog cache id 7 for pg_attribute; 257 tups, 128 buckets
2025-06-26 03:06:16.133 GMT [0] DEBUG:  rehashing catalog cache id 6 for pg_attribute; 65 tups, 32 buckets
2025-06-26 03:06:16.153 GMT [0] DEBUG:  rehashing catalog cache id 69 for pg_transform; 33 tups, 16 buckets
	 1: pg_stop_making_pinned_objects	(typeid = 2278, len = 4, typmod = -1, byval = t)
	----
	 1: pg_stop_making_pinned_objects = ""	(typeid = 2278, len = 4, typmod = -1, byval = t)
	----
2025-06-26 03:06:16.199 GMT [0] DEBUG:  rehashing catalog cache id 37 for pg_operator; 33 lists, 16 buckets
2025-06-26 03:06:16.202 GMT [0] DEBUG:  rehashing catalog cache id 44 for pg_proc; 33 lists, 16 buckets at character 882
2025-06-26 03:06:16.216 GMT [0] DEBUG:  rehashing catalog cache id 44 for pg_proc; 65 lists, 32 buckets at character 2338
2025-06-26 03:06:16.218 GMT [0] DEBUG:  rehashing catalog cache id 44 for pg_proc; 257 tups, 128 buckets at character 168
2025-06-26 03:06:16.219 GMT [0] DEBUG:  rehashing catalog cache id 45 for pg_proc; 257 tups, 128 buckets at character 239
	 1: pg_import_system_collations	(typeid = 23, len = 4, typmod = -1, byval = t)
	----
2025-06-26 03:06:16.241 GMT [0] WARNING:  file passed to ClosePipeStream was not obtained from OpenPipeStream
	 1: pg_import_system_collations = "3"	(typeid = 23, len = 4, typmod = -1, byval = t)
	----
2025-06-26 03:06:16.248 GMT [0] DEBUG:  rehashing catalog cache id 73 for pg_ts_dict; 5 tups, 2 buckets
2025-06-26 03:06:16.248 GMT [0] DEBUG:  rehashing catalog cache id 71 for pg_ts_config; 5 tups, 2 buckets
2025-06-26 03:06:16.248 GMT [0] DEBUG:  rehashing catalog cache id 72 for pg_ts_config; 5 tups, 2 buckets
2025-06-26 03:06:16.249 GMT [0] DEBUG:  rehashing catalog cache id 73 for pg_ts_dict; 9 tups, 4 buckets
2025-06-26 03:06:16.249 GMT [0] DEBUG:  rehashing catalog cache id 71 for pg_ts_config; 9 tups, 4 buckets
2025-06-26 03:06:16.249 GMT [0] DEBUG:  rehashing catalog cache id 72 for pg_ts_config; 9 tups, 4 buckets
2025-06-26 03:06:16.251 GMT [0] DEBUG:  rehashing catalog cache id 73 for pg_ts_dict; 17 tups, 8 buckets
2025-06-26 03:06:16.251 GMT [0] DEBUG:  rehashing catalog cache id 71 for pg_ts_config; 17 tups, 8 buckets
2025-06-26 03:06:16.251 GMT [0] DEBUG:  rehashing catalog cache id 72 for pg_ts_config; 17 tups, 8 buckets
2025-06-26 03:06:16.256 GMT [0] DEBUG:  probing availability of JIT provider at /tmp/pglite/lib/postgresql/llvmjit.so
2025-06-26 03:06:16.256 GMT [0] DEBUG:  provider not available, disabling JIT for current session
# 106: SKIPPED: 3623: REVOKE ALL ON pg_largeobject FROM PUBLIC;

2025-06-26 03:06:16.321 GMT [0] DEBUG:  rehashing catalog cache id 37 for pg_operator; 65 lists, 32 buckets
2025-06-26 03:06:16.324 GMT [0] DEBUG:  rehashing catalog cache id 54 for pg_class; 257 tups, 128 buckets
2025-06-26 03:06:16.330 GMT [0] DEBUG:  executing extension script for "plpgsql" version '1.0'
2025-06-26 03:06:16.334 GMT [0] DEBUG:  rehashing catalog cache id 12 for pg_cast; 513 tups, 256 buckets
2025-06-26 03:06:16.338 GMT [0] DEBUG:  rehashing catalog cache id 14 for pg_opclass; 17 tups, 8 buckets
2025-06-26 03:06:16.338 GMT [0] DEBUG:  rehashing catalog cache id 5 for pg_amproc; 33 tups, 16 buckets
2025-06-26 03:06:16.339 GMT [0] DEBUG:  rehashing catalog cache id 7 for pg_attribute; 513 tups, 256 buckets
2025-06-26 03:06:16.377 GMT [0] DEBUG:  rehashing catalog cache id 32 for pg_index; 129 tups, 64 buckets
2025-06-26 03:06:16.385 GMT [0] DEBUG:  transaction ID wrap limit is 2147484377, limited by database with OID 1
2025-06-26 03:06:16.385 GMT [0] DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
2025-06-26 03:06:16.385 GMT [0] DEBUG:  MultiXact member stop limit is now 4294914944 based on MultiXact 1
2025-06-26 03:06:16.385 GMT [0] DEBUG:  performing replication slot checkpoint
2025-06-26 03:06:16.395 GMT [0] DEBUG:  performing replication slot checkpoint
# 106: SKIPPED: 6707: REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;

2025-06-26 03:06:16.396 GMT [0] DEBUG:  performing replication slot checkpoint
2025-06-26 03:06:16.405 GMT [0] DEBUG:  performing replication slot checkpoint
runExec SET search_path TO public; undefined
runQuery 
      SELECT b.oid, b.typarray
      FROM pg_catalog.pg_type a
      LEFT JOIN pg_catalog.pg_type b ON b.oid = a.typelem
      WHERE a.typcategory = 'A'
      GROUP BY b.oid, b.typarray
      ORDER BY b.oid
     [] undefined
ne {
  length: 295,
  message: 'parse <unnamed>: \n' +
    '      SELECT b.oid, b.typarray\n' +
    '      FROM pg_catalog.pg_type a\n' +
    '      LEFT JOIN pg_catalog.pg_type b ON b.oid = a.typelem\n' +
    "      WHERE a.typcategory = 'A'\n" +
    '      GROUP BY b.oid, b.typarray\n' +
    '      ORDER BY b.oid\n' +
    '    ',
  name: 'notice',
  severity: 'DEBUG',
  code: '00000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postgres.c',
  line: '1438',
  routine: 'exec_parse_message'
}
ne {
  length: 92,
  message: 'bind <unnamed> to <unnamed>',
  name: 'notice',
  severity: 'DEBUG',
  code: '00000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postgres.c',
  line: '1673',
  routine: 'exec_bind_message'
}
PGlite database initialized
PGLiteSocketServer listening on {"port":5433,"host":"127.0.0.1"}
Client connected from 127.0.0.1:52015
Client connected from 127.0.0.1:52015
---------------------------------------------------------------------------
-> incoming 110 bytes
00000000  00 00 00 6e 00 03 00 00 75 73 65 72 00 70 6f 73  ...n....user.pos
00000010  74 67 72 65 73 00 64 61 74 61 62 61 73 65 00 70  tgres.database.p
00000020  6f 73 74 67 72 65 73 00 63 6c 69 65 6e 74 5f 65  ostgres.client_e
00000030  6e 63 6f 64 69 6e 67 00 55 54 46 38 00 44 61 74  ncoding.UTF8.Dat
00000040  65 53 74 79 6c 65 00 49 53 4f 00 54 69 6d 65 5a  eStyle.ISO.TimeZ
00000050  6f 6e 65 00 55 54 43 00 65 78 74 72 61 5f 66 6c  one.UTC.extra_fl
00000060  6f 61 74 5f 64 69 67 69 74 73 00 32 00 00        oat_digits.2..
---------------------------------------------------------------------------
<- outgoing 13 bytes
00000000  52 00 00 00 0c 00 00 00 05 01 23 45 56           R.........#EV
---------------------------------------------------------------------------
-> incoming 41 bytes
00000000  70 00 00 00 28 6d 64 35 34 39 34 39 33 35 64 32  p...(md5494935d2
00000010  39 65 35 35 32 30 65 32 64 34 31 66 38 30 32 35  9e5520e2d41f8025
00000020  61 36 38 37 39 62 35 35 00                       a6879b55.
---------------------------------------------------------------------------
<- outgoing 399 bytes
00000000  52 00 00 00 08 00 00 00 00 53 00 00 00 17 69 6e  R........S....in
00000010  5f 68 6f 74 5f 73 74 61 6e 64 62 79 00 6f 66 66  _hot_standby.off
00000020  00 53 00 00 00 19 69 6e 74 65 67 65 72 5f 64 61  .S....integer_da
00000030  74 65 74 69 6d 65 73 00 6f 6e 00 53 00 00 00 11  tetimes.on.S....
00000040  54 69 6d 65 5a 6f 6e 65 00 47 4d 54 00 53 00 00  TimeZone.GMT.S..
00000050  00 1b 49 6e 74 65 72 76 61 6c 53 74 79 6c 65 00  ..IntervalStyle.
00000060  70 6f 73 74 67 72 65 73 00 53 00 00 00 14 69 73  postgres.S....is
00000070  5f 73 75 70 65 72 75 73 65 72 00 6f 6e 00 53 00  _superuser.on.S.
00000080  00 00 16 61 70 70 6c 69 63 61 74 69 6f 6e 5f 6e  ...application_n
00000090  61 6d 65 00 00 53 00 00 00 26 64 65 66 61 75 6c  ame..S...&defaul
000000a0  74 5f 74 72 61 6e 73 61 63 74 69 6f 6e 5f 72 65  t_transaction_re
000000b0  61 64 5f 6f 6e 6c 79 00 6f 66 66 00 53 00 00 00  ad_only.off.S...
000000c0  1a 73 63 72 61 6d 5f 69 74 65 72 61 74 69 6f 6e  .scram_iteration
000000d0  73 00 34 30 39 36 00 53 00 00 00 17 44 61 74 65  s.4096.S....Date
000000e0  53 74 79 6c 65 00 49 53 4f 2c 20 4d 44 59 00 53  Style.ISO, MDY.S
000000f0  00 00 00 23 73 74 61 6e 64 61 72 64 5f 63 6f 6e  ...#standard_con
00000100  66 6f 72 6d 69 6e 67 5f 73 74 72 69 6e 67 73 00  forming_strings.
00000110  6f 6e 00 53 00 00 00 1b 73 65 73 73 69 6f 6e 5f  on.S....session_
00000120  61 75 74 68 6f 72 69 7a 61 74 69 6f 6e 00 00 53  authorization..S
00000130  00 00 00 19 63 6c 69 65 6e 74 5f 65 6e 63 6f 64  ....client_encod
00000140  69 6e 67 00 55 54 46 38 00 53 00 00 00 18 73 65  ing.UTF8.S....se
00000150  72 76 65 72 5f 76 65 72 73 69 6f 6e 00 31 37 2e  rver_version.17.
00000160  34 00 53 00 00 00 19 73 65 72 76 65 72 5f 65 6e  4.S....server_en
00000170  63 6f 64 69 6e 67 00 55 54 46 38 00 4b 00 00 00  coding.UTF8.K...
00000180  0c 00 00 00 00 00 00 00 00 5a 00 00 00 05 49     .........Z....I
---------------------------------------------------------------------------
-> incoming 63 bytes
00000000  50 00 00 00 22 00 53 45 54 20 65 78 74 72 61 5f  P...".SET extra_
00000010  66 6c 6f 61 74 5f 64 69 67 69 74 73 20 3d 20 33  float_digits = 3
00000020  00 00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00  ...B............
00000030  45 00 00 00 09 00 00 00 00 01 53 00 00 00 04     E.........S....
---------------------------------------------------------------------------
<- outgoing 228 bytes
00000000  4e 00 00 00 6d 53 44 45 42 55 47 00 56 44 45 42  N...mSDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 53 45 54 20   <unnamed>: SET 
00000030  65 78 74 72 61 5f 66 6c 6f 61 74 5f 64 69 67 69  extra_float_digi
00000040  74 73 20 3d 20 33 00 46 70 6f 73 74 67 72 65 73  ts = 3.Fpostgres
00000050  2e 63 00 4c 31 34 33 38 00 52 65 78 65 63 5f 70  .c.L1438.Rexec_p
00000060  61 72 73 65 5f 6d 65 73 73 61 67 65 00 00 31 00  arse_message..1.
00000070  00 00 04 4e 00 00 00 5c 53 44 45 42 55 47 00 56  ...N...\SDEBUG.V
00000080  44 45 42 55 47 00 43 30 30 30 30 30 00 4d 62 69  DEBUG.C00000.Mbi
00000090  6e 64 20 3c 75 6e 6e 61 6d 65 64 3e 20 74 6f 20  nd <unnamed> to 
000000a0  3c 75 6e 6e 61 6d 65 64 3e 00 46 70 6f 73 74 67  <unnamed>.Fpostg
000000b0  72 65 73 2e 63 00 4c 31 36 37 33 00 52 65 78 65  res.c.L1673.Rexe
000000c0  63 5f 62 69 6e 64 5f 6d 65 73 73 61 67 65 00 00  c_bind_message..
000000d0  32 00 00 00 04 43 00 00 00 08 53 45 54 00 5a 00  2....C....SET.Z.
000000e0  00 00 05 49                                      ...I
---------------------------------------------------------------------------
-> incoming 62 bytes
00000000  50 00 00 00 21 00 53 45 54 20 61 70 70 6c 69 63  P...!.SET applic
00000010  61 74 69 6f 6e 5f 6e 61 6d 65 20 3d 20 27 27 00  ation_name = ''.
00000020  00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00 45  ..B............E
00000030  00 00 00 09 00 00 00 00 01 53 00 00 00 04        .........S....
---------------------------------------------------------------------------
<- outgoing 227 bytes
00000000  4e 00 00 00 6c 53 44 45 42 55 47 00 56 44 45 42  N...lSDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 53 45 54 20   <unnamed>: SET 
00000030  61 70 70 6c 69 63 61 74 69 6f 6e 5f 6e 61 6d 65  application_name
00000040  20 3d 20 27 27 00 46 70 6f 73 74 67 72 65 73 2e   = ''.Fpostgres.
00000050  63 00 4c 31 34 33 38 00 52 65 78 65 63 5f 70 61  c.L1438.Rexec_pa
00000060  72 73 65 5f 6d 65 73 73 61 67 65 00 00 31 00 00  rse_message..1..
00000070  00 04 4e 00 00 00 5c 53 44 45 42 55 47 00 56 44  ..N...\SDEBUG.VD
00000080  45 42 55 47 00 43 30 30 30 30 30 00 4d 62 69 6e  EBUG.C00000.Mbin
00000090  64 20 3c 75 6e 6e 61 6d 65 64 3e 20 74 6f 20 3c  d <unnamed> to <
000000a0  75 6e 6e 61 6d 65 64 3e 00 46 70 6f 73 74 67 72  unnamed>.Fpostgr
000000b0  65 73 2e 63 00 4c 31 36 37 33 00 52 65 78 65 63  es.c.L1673.Rexec
000000c0  5f 62 69 6e 64 5f 6d 65 73 73 61 67 65 00 00 32  _bind_message..2
000000d0  00 00 00 04 43 00 00 00 08 53 45 54 00 5a 00 00  ....C....SET.Z..
000000e0  00 05 49                                         ..I
---------------------------------------------------------------------------
-> incoming 60 bytes
00000000  50 00 00 00 18 00 73 65 6c 65 63 74 20 76 65 72  P.....select ver
00000010  73 69 6f 6e 28 29 00 00 00 42 00 00 00 0c 00 00  sion()...B......
00000020  00 00 00 00 00 00 44 00 00 00 06 50 00 45 00 00  ......D....P.E..
00000030  00 09 00 00 00 00 00 53 00 00 00 04              .......S....
---------------------------------------------------------------------------
<- outgoing 447 bytes
00000000  4e 00 00 00 63 53 44 45 42 55 47 00 56 44 45 42  N...cSDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 73 65 6c 65   <unnamed>: sele
00000030  63 74 20 76 65 72 73 69 6f 6e 28 29 00 46 70 6f  ct version().Fpo
00000040  73 74 67 72 65 73 2e 63 00 4c 31 34 33 38 00 52  stgres.c.L1438.R
00000050  65 78 65 63 5f 70 61 72 73 65 5f 6d 65 73 73 61  exec_parse_messa
00000060  67 65 00 00 31 00 00 00 04 4e 00 00 00 5c 53 44  ge..1....N...\SD
00000070  45 42 55 47 00 56 44 45 42 55 47 00 43 30 30 30  EBUG.VDEBUG.C000
00000080  30 30 00 4d 62 69 6e 64 20 3c 75 6e 6e 61 6d 65  00.Mbind <unname
00000090  64 3e 20 74 6f 20 3c 75 6e 6e 61 6d 65 64 3e 00  d> to <unnamed>.
000000a0  46 70 6f 73 74 67 72 65 73 2e 63 00 4c 31 36 37  Fpostgres.c.L167
000000b0  33 00 52 65 78 65 63 5f 62 69 6e 64 5f 6d 65 73  3.Rexec_bind_mes
000000c0  73 61 67 65 00 00 32 00 00 00 04 54 00 00 00 20  sage..2....T... 
000000d0  00 01 76 65 72 73 69 6f 6e 00 00 00 00 00 00 00  ..version.......
000000e0  00 00 00 19 ff ff ff ff ff ff 00 00 44 00 00 00  ............D...
000000f0  be 00 01 00 00 00 b4 50 6f 73 74 67 72 65 53 51  .......PostgreSQ
00000100  4c 20 31 37 2e 34 20 6f 6e 20 78 38 36 5f 36 34  L 17.4 on x86_64
00000110  2d 70 63 2d 6c 69 6e 75 78 2d 67 6e 75 2c 20 63  -pc-linux-gnu, c
00000120  6f 6d 70 69 6c 65 64 20 62 79 20 65 6d 63 63 20  ompiled by emcc 
00000130  28 45 6d 73 63 72 69 70 74 65 6e 20 67 63 63 2f  (Emscripten gcc/
00000140  63 6c 61 6e 67 2d 6c 69 6b 65 20 72 65 70 6c 61  clang-like repla
00000150  63 65 6d 65 6e 74 20 2b 20 6c 69 6e 6b 65 72 20  cement + linker 
00000160  65 6d 75 6c 61 74 69 6e 67 20 47 4e 55 20 6c 64  emulating GNU ld
00000170  29 20 33 2e 31 2e 37 34 20 28 31 30 39 32 65 63  ) 3.1.74 (1092ec
00000180  33 30 61 33 66 62 31 64 34 36 62 31 37 38 32 66  30a3fb1d46b1782f
00000190  66 31 62 34 64 62 35 30 39 34 64 33 64 30 36 61  f1b4db5094d3d06a
000001a0  65 35 29 2c 20 33 32 2d 62 69 74 43 00 00 00 0d  e5), 32-bitC....
000001b0  53 45 4c 45 43 54 20 31 00 5a 00 00 00 05 49     SELECT 1.Z....I
---------------------------------------------------------------------------
-> incoming 79 bytes
00000000  50 00 00 00 32 00 53 45 54 20 61 70 70 6c 69 63  P...2.SET applic
00000010  61 74 69 6f 6e 5f 6e 61 6d 65 20 3d 20 27 44 61  ation_name = 'Da
00000020  74 61 47 72 69 70 20 32 30 32 34 2e 31 2e 34 27  taGrip 2024.1.4'
00000030  00 00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00  ...B............
00000040  45 00 00 00 09 00 00 00 00 01 53 00 00 00 04     E.........S....
---------------------------------------------------------------------------
<- outgoing 244 bytes
00000000  4e 00 00 00 7d 53 44 45 42 55 47 00 56 44 45 42  N...}SDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 53 45 54 20   <unnamed>: SET 
00000030  61 70 70 6c 69 63 61 74 69 6f 6e 5f 6e 61 6d 65  application_name
00000040  20 3d 20 27 44 61 74 61 47 72 69 70 20 32 30 32   = 'DataGrip 202
00000050  34 2e 31 2e 34 27 00 46 70 6f 73 74 67 72 65 73  4.1.4'.Fpostgres
00000060  2e 63 00 4c 31 34 33 38 00 52 65 78 65 63 5f 70  .c.L1438.Rexec_p
00000070  61 72 73 65 5f 6d 65 73 73 61 67 65 00 00 31 00  arse_message..1.
00000080  00 00 04 4e 00 00 00 5c 53 44 45 42 55 47 00 56  ...N...\SDEBUG.V
00000090  44 45 42 55 47 00 43 30 30 30 30 30 00 4d 62 69  DEBUG.C00000.Mbi
000000a0  6e 64 20 3c 75 6e 6e 61 6d 65 64 3e 20 74 6f 20  nd <unnamed> to 
000000b0  3c 75 6e 6e 61 6d 65 64 3e 00 46 70 6f 73 74 67  <unnamed>.Fpostg
000000c0  72 65 73 2e 63 00 4c 31 36 37 33 00 52 65 78 65  res.c.L1673.Rexe
000000d0  63 5f 62 69 6e 64 5f 6d 65 73 73 61 67 65 00 00  c_bind_message..
000000e0  32 00 00 00 04 43 00 00 00 08 53 45 54 00 5a 00  2....C....SET.Z.
000000f0  00 00 05 49                                      ...I
---------------------------------------------------------------------------
-> incoming 63 bytes
00000000  50 00 00 00 1b 00 53 45 4c 45 43 54 20 27 6b 65  P.....SELECT 'ke
00000010  65 70 20 61 6c 69 76 65 27 00 00 00 42 00 00 00  ep alive'...B...
00000020  0c 00 00 00 00 00 00 00 00 44 00 00 00 06 50 00  .........D....P.
00000030  45 00 00 00 09 00 00 00 00 00 53 00 00 00 04     E.........S....
---------------------------------------------------------------------------
<- outgoing 281 bytes
00000000  4e 00 00 00 66 53 44 45 42 55 47 00 56 44 45 42  N...fSDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 53 45 4c 45   <unnamed>: SELE
00000030  43 54 20 27 6b 65 65 70 20 61 6c 69 76 65 27 00  CT 'keep alive'.
00000040  46 70 6f 73 74 67 72 65 73 2e 63 00 4c 31 34 33  Fpostgres.c.L143
00000050  38 00 52 65 78 65 63 5f 70 61 72 73 65 5f 6d 65  8.Rexec_parse_me
00000060  73 73 61 67 65 00 00 31 00 00 00 04 4e 00 00 00  ssage..1....N...
00000070  5c 53 44 45 42 55 47 00 56 44 45 42 55 47 00 43  \SDEBUG.VDEBUG.C
00000080  30 30 30 30 30 00 4d 62 69 6e 64 20 3c 75 6e 6e  00000.Mbind <unn
00000090  61 6d 65 64 3e 20 74 6f 20 3c 75 6e 6e 61 6d 65  amed> to <unname
000000a0  64 3e 00 46 70 6f 73 74 67 72 65 73 2e 63 00 4c  d>.Fpostgres.c.L
000000b0  31 36 37 33 00 52 65 78 65 63 5f 62 69 6e 64 5f  1673.Rexec_bind_
000000c0  6d 65 73 73 61 67 65 00 00 32 00 00 00 04 54 00  message..2....T.
000000d0  00 00 21 00 01 3f 63 6f 6c 75 6d 6e 3f 00 00 00  ..!..?column?...
000000e0  00 00 00 00 00 00 00 19 ff ff ff ff ff ff 00 00  ................
000000f0  44 00 00 00 14 00 01 00 00 00 0a 6b 65 65 70 20  D..........keep 
00000100  61 6c 69 76 65 43 00 00 00 0d 53 45 4c 45 43 54  aliveC....SELECT
00000110  20 31 00 5a 00 00 00 05 49                        1.Z....I
---------------------------------------------------------------------------
-> incoming 100 bytes
00000000  50 00 00 00 40 00 73 65 6c 65 63 74 20 73 73 6c  [email protected] ssl
00000010  20 66 72 6f 6d 20 70 67 5f 73 74 61 74 5f 73 73   from pg_stat_ss
00000020  6c 20 77 68 65 72 65 20 70 69 64 20 3d 20 70 67  l where pid = pg
00000030  5f 62 61 63 6b 65 6e 64 5f 70 69 64 28 29 00 00  _backend_pid()..
00000040  00 42 00 00 00 0c 00 00 00 00 00 00 00 00 44 00  .B............D.
00000050  00 00 06 50 00 45 00 00 00 09 00 00 00 00 00 53  ...P.E.........S
00000060  00 00 00 04                                      ....
---------------------------------------------------------------------------
<- outgoing 292 bytes
00000000  4e 00 00 00 8b 53 44 45 42 55 47 00 56 44 45 42  N....SDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 73 65 6c 65   <unnamed>: sele
00000030  63 74 20 73 73 6c 20 66 72 6f 6d 20 70 67 5f 73  ct ssl from pg_s
00000040  74 61 74 5f 73 73 6c 20 77 68 65 72 65 20 70 69  tat_ssl where pi
00000050  64 20 3d 20 70 67 5f 62 61 63 6b 65 6e 64 5f 70  d = pg_backend_p
00000060  69 64 28 29 00 46 70 6f 73 74 67 72 65 73 2e 63  id().Fpostgres.c
00000070  00 4c 31 34 33 38 00 52 65 78 65 63 5f 70 61 72  .L1438.Rexec_par
00000080  73 65 5f 6d 65 73 73 61 67 65 00 00 31 00 00 00  se_message..1...
00000090  04 4e 00 00 00 5c 53 44 45 42 55 47 00 56 44 45  .N...\SDEBUG.VDE
000000a0  42 55 47 00 43 30 30 30 30 30 00 4d 62 69 6e 64  BUG.C00000.Mbind
000000b0  20 3c 75 6e 6e 61 6d 65 64 3e 20 74 6f 20 3c 75   <unnamed> to <u
000000c0  6e 6e 61 6d 65 64 3e 00 46 70 6f 73 74 67 72 65  nnamed>.Fpostgre
000000d0  73 2e 63 00 4c 31 36 37 33 00 52 65 78 65 63 5f  s.c.L1673.Rexec_
000000e0  62 69 6e 64 5f 6d 65 73 73 61 67 65 00 00 32 00  bind_message..2.
000000f0  00 00 04 54 00 00 00 1c 00 01 73 73 6c 00 00 00  ...T......ssl...
00000100  2f d9 00 02 00 00 00 10 00 01 ff ff ff ff 00 00  /...............
00000110  43 00 00 00 0d 53 45 4c 45 43 54 20 30 00 5a 00  C....SELECT 0.Z.
00000120  00 00 05 49                                      ...I
---------------------------------------------------------------------------
-> incoming 5 bytes
00000000  58 00 00 00 04                                   X....
---------------------------------------------------------------------------
<- outgoing 0 bytes

hanayashiki avatar Jun 26 '25 03:06 hanayashiki

to get the same trace against a real server to compare you can use that tracing proxy pgtrace.tar.gz ( you need to let the real server allow for non-ssl connexions though )

pmp-p avatar Jun 26 '25 06:06 pmp-p

to get the same trace against a real server to compare you can use that tracing proxy pgtrace.tar.gz ( you need to let the real server allow for non-ssl connexions though )

I assume you want me to get a trace of DataGrip <-> Original Postgres Server. (Maybe because DataGrip is paid) I'm glad to help. But personally I'm not a Postgres or C expert so I cannot help with PR

uv run proxy.py -c -l 0.0.0.0 -lp 5434 -rp 5432
Proxy server started listening: 0.0.0.0:5434 => localhost:5432 ...
console:True, file:False, disguise:n/a, whitelist:*, shadow:False
Connection opened: [id:0x10580b000, fd:13, L:/127.0.0.1:5434 - R:/127.0.0.1:60360]

c>s
00000000  00 00 00 08 04 d2 16 2f                          ......./

s>c
00000000  4e                                               N

c>s
00000000  00 00 00 70 00 03 00 00 75 73 65 72 00 63 68 65  ...p....user.che
00000010  6e 79 75 77 61 6e 67 00 64 61 74 61 62 61 73 65  nyuwang.database
00000020  00 70 6f 73 74 67 72 65 73 00 63 6c 69 65 6e 74  .postgres.client
00000030  5f 65 6e 63 6f 64 69 6e 67 00 55 54 46 38 00 44  _encoding.UTF8.D
00000040  61 74 65 53 74 79 6c 65 00 49 53 4f 00 54 69 6d  ateStyle.ISO.Tim
00000050  65 5a 6f 6e 65 00 55 54 43 00 65 78 74 72 61 5f  eZone.UTC.extra_
00000060  66 6c 6f 61 74 5f 64 69 67 69 74 73 00 32 00 00  float_digits.2..

s>c
00000000  52 00 00 00 08 00 00 00 00 53 00 00 00 16 61 70  R........S....ap
00000010  70 6c 69 63 61 74 69 6f 6e 5f 6e 61 6d 65 00 00  plication_name..
00000020  53 00 00 00 19 63 6c 69 65 6e 74 5f 65 6e 63 6f  S....client_enco
00000030  64 69 6e 67 00 55 54 46 38 00 53 00 00 00 17 44  ding.UTF8.S....D
00000040  61 74 65 53 74 79 6c 65 00 49 53 4f 2c 20 4d 44  ateStyle.ISO, MD
00000050  59 00 53 00 00 00 26 64 65 66 61 75 6c 74 5f 74  Y.S...&default_t
00000060  72 61 6e 73 61 63 74 69 6f 6e 5f 72 65 61 64 5f  ransaction_read_
00000070  6f 6e 6c 79 00 6f 66 66 00 53 00 00 00 17 69 6e  only.off.S....in
00000080  5f 68 6f 74 5f 73 74 61 6e 64 62 79 00 6f 66 66  _hot_standby.off
00000090  00 53 00 00 00 19 69 6e 74 65 67 65 72 5f 64 61  .S....integer_da
000000a0  74 65 74 69 6d 65 73 00 6f 6e 00 53 00 00 00 1b  tetimes.on.S....
000000b0  49 6e 74 65 72 76 61 6c 53 74 79 6c 65 00 70 6f  IntervalStyle.po
000000c0  73 74 67 72 65 73 00 53 00 00 00 14 69 73 5f 73  stgres.S....is_s
000000d0  75 70 65 72 75 73 65 72 00 6f 6e 00 53 00 00 00  uperuser.on.S...
000000e0  19 73 65 72 76 65 72 5f 65 6e 63 6f 64 69 6e 67  .server_encoding
000000f0  00 55 54 46 38 00 53 00 00 00 23 73 65 72 76 65  .UTF8.S...#serve
00000100  72 5f 76 65 72 73 69 6f 6e 00 31 35 2e 38 20 28  r_version.15.8 (
00000110  48 6f 6d 65 62 72 65 77 29 00 53 00 00 00 25 73  Homebrew).S...%s
00000120  65 73 73 69 6f 6e 5f 61 75 74 68 6f 72 69 7a 61  ession_authoriza
00000130  74 69 6f 6e 00 63 68 65 6e 79 75 77 61 6e 67 00  tion.chenyuwang.
00000140  53 00 00 00 23 73 74 61 6e 64 61 72 64 5f 63 6f  S...#standard_co
00000150  6e 66 6f 72 6d 69 6e 67 5f 73 74 72 69 6e 67 73  nforming_strings
00000160  00 6f 6e 00 53 00 00 00 11 54 69 6d 65 5a 6f 6e  .on.S....TimeZon
00000170  65 00 55 54 43 00 4b 00 00 00 0c 00 01 4f e5 f8  e.UTC.K......O..
00000180  bd 78 05 5a 00 00 00 05 49                       .x.Z....I

c>s
00000000  50 00 00 00 22 00 53 45 54 20 65 78 74 72 61 5f  P...".SET extra_
00000010  66 6c 6f 61 74 5f 64 69 67 69 74 73 20 3d 20 33  float_digits = 3
00000020  00 00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00  ...B............
00000030  45 00 00 00 09 00 00 00 00 01 53 00 00 00 04     E.........S....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 43 00 00 00 08 53  1....2....C....S
00000010  45 54 00 5a 00 00 00 05 49                       ET.Z....I

c>s
00000000  50 00 00 00 21 00 53 45 54 20 61 70 70 6c 69 63  P...!.SET applic
00000010  61 74 69 6f 6e 5f 6e 61 6d 65 20 3d 20 27 27 00  ation_name = ''.
00000020  00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00 45  ..B............E
00000030  00 00 00 09 00 00 00 00 01 53 00 00 00 04        .........S....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 43 00 00 00 08 53  1....2....C....S
00000010  45 54 00 5a 00 00 00 05 49                       ET.Z....I

c>s
00000000  50 00 00 00 18 00 73 65 6c 65 63 74 20 76 65 72  P.....select ver
00000010  73 69 6f 6e 28 29 00 00 00 42 00 00 00 0c 00 00  sion()...B......
00000020  00 00 00 00 00 00 44 00 00 00 06 50 00 45 00 00  ......D....P.E..
00000030  00 09 00 00 00 00 00 53 00 00 00 04              .......S....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 54 00 00 00 20 00  1....2....T... .
00000010  01 76 65 72 73 69 6f 6e 00 00 00 00 00 00 00 00  .version........
00000020  00 00 19 ff ff ff ff ff ff 00 00 44 00 00 00 86  ...........D....
00000030  00 01 00 00 00 7c 50 6f 73 74 67 72 65 53 51 4c  .....|PostgreSQL
00000040  20 31 35 2e 38 20 28 48 6f 6d 65 62 72 65 77 29   15.8 (Homebrew)
00000050  20 6f 6e 20 61 61 72 63 68 36 34 2d 61 70 70 6c   on aarch64-appl
00000060  65 2d 64 61 72 77 69 6e 32 34 2e 30 2e 30 2c 20  e-darwin24.0.0, 
00000070  63 6f 6d 70 69 6c 65 64 20 62 79 20 41 70 70 6c  compiled by Appl
00000080  65 20 63 6c 61 6e 67 20 76 65 72 73 69 6f 6e 20  e clang version 
00000090  31 36 2e 30 2e 30 20 28 63 6c 61 6e 67 2d 31 36  16.0.0 (clang-16
000000a0  30 30 2e 30 2e 32 36 2e 33 29 2c 20 36 34 2d 62  00.0.26.3), 64-b
000000b0  69 74 43 00 00 00 0d 53 45 4c 45 43 54 20 31 00  itC....SELECT 1.
000000c0  5a 00 00 00 05 49                                Z....I

c>s
00000000  50 00 00 00 32 00 53 45 54 20 61 70 70 6c 69 63  P...2.SET applic
00000010  61 74 69 6f 6e 5f 6e 61 6d 65 20 3d 20 27 44 61  ation_name = 'Da
00000020  74 61 47 72 69 70 20 32 30 32 34 2e 31 2e 34 27  taGrip 2024.1.4'
00000030  00 00 00 42 00 00 00 0c 00 00 00 00 00 00 00 00  ...B............
00000040  45 00 00 00 09 00 00 00 00 01 53 00 00 00 04     E.........S....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 43 00 00 00 08 53  1....2....C....S
00000010  45 54 00 53 00 00 00 27 61 70 70 6c 69 63 61 74  ET.S...'applicat
00000020  69 6f 6e 5f 6e 61 6d 65 00 44 61 74 61 47 72 69  ion_name.DataGri
00000030  70 20 32 30 32 34 2e 31 2e 34 00 5a 00 00 00 05  p 2024.1.4.Z....
00000040  49                                               I

c>s
00000000  50 00 00 00 1b 00 53 45 4c 45 43 54 20 27 6b 65  P.....SELECT 'ke
00000010  65 70 20 61 6c 69 76 65 27 00 00 00 42 00 00 00  ep alive'...B...
00000020  0c 00 00 00 00 00 00 00 00 44 00 00 00 06 50 00  .........D....P.
00000030  45 00 00 00 09 00 00 00 00 00 53 00 00 00 04     E.........S....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 54 00 00 00 21 00  1....2....T...!.
00000010  01 3f 63 6f 6c 75 6d 6e 3f 00 00 00 00 00 00 00  .?column?.......
00000020  00 00 00 19 ff ff ff ff ff ff 00 00 44 00 00 00  ............D...
00000030  14 00 01 00 00 00 0a 6b 65 65 70 20 61 6c 69 76  .......keep aliv
00000040  65 43 00 00 00 0d 53 45 4c 45 43 54 20 31 00 5a  eC....SELECT 1.Z
00000050  00 00 00 05 49                                   ....I

c>s
00000000  50 00 00 00 40 00 73 65 6c 65 63 74 20 73 73 6c  [email protected] ssl
00000010  20 66 72 6f 6d 20 70 67 5f 73 74 61 74 5f 73 73   from pg_stat_ss
00000020  6c 20 77 68 65 72 65 20 70 69 64 20 3d 20 70 67  l where pid = pg
00000030  5f 62 61 63 6b 65 6e 64 5f 70 69 64 28 29 00 00  _backend_pid()..
00000040  00 42 00 00 00 0c 00 00 00 00 00 00 00 00 44 00  .B............D.
00000050  00 00 06 50 00 45 00 00 00 09 00 00 00 00 00 53  ...P.E.........S
00000060  00 00 00 04                                      ....

s>c
00000000  31 00 00 00 04 32 00 00 00 04 54 00 00 00 1c 00  1....2....T.....
00000010  01 73 73 6c 00 00 00 2f d9 00 02 00 00 00 10 00  .ssl.../........
00000020  01 ff ff ff ff 00 00 44 00 00 00 0b 00 01 00 00  .......D........
00000030  00 01 66 43 00 00 00 0d 53 45 4c 45 43 54 20 31  ..fC....SELECT 1
00000040  00 5a 00 00 00 05 49                             .Z....I

c>s
00000000  58 00 00 00 04                                   X....
Connection closed: [id:0x10580b000, fd:13, L:/127.0.0.1:5434 ! R:/127.0.0.1:60360], rx: 552B, tx: 863B, duration: 121ms

hanayashiki avatar Jun 27 '25 03:06 hanayashiki

It seems the difference is real server does not emit

00000000  4e 00 00 00 8b 53 44 45 42 55 47 00 56 44 45 42  N....SDEBUG.VDEB
00000010  55 47 00 43 30 30 30 30 30 00 4d 70 61 72 73 65  UG.C00000.Mparse
00000020  20 3c 75 6e 6e 61 6d 65 64 3e 3a 20 73 65 6c 65   <unnamed>: sele
00000030  63 74 20 73 73 6c 20 66 72 6f 6d 20 70 67 5f 73  ct ssl from pg_s
00000040  74 61 74 5f 73 73 6c 20 77 68 65 72 65 20 70 69  tat_ssl where pi
00000050  64 20 3d 20 70 67 5f 62 61 63 6b 65 6e 64 5f 70  d = pg_backend_p
00000060  69 64 28 29 00 46 70 6f 73 74 67 72 65 73 2e 63  id().Fpostgres.c
00000070  00 4c 31 34 33 38 00 52 65 78 65 63 5f 70 61 72  .L1438.Rexec_par
00000080  73 65 5f 6d 65 73 73 61 67 65 00 00 31 00 00 00  se_message..1...
00000090  04 4e 00 00 00 5c 53 44 45 42 55 47 00 56 44 45  .N...\SDEBUG.VDE
000000a0  42 55 47 00 43 30 30 30 30 30 00 4d 62 69 6e 64  BUG.C00000.Mbind
000000b0  20 3c 75 6e 6e 61 6d 65 64 3e 20 74 6f 20 3c 75   <unnamed> to <u
000000c0  6e 6e 61 6d 65 64 3e 00 46 70 6f 73 74 67 72 65  nnamed>.Fpostgre
000000d0  73 2e 63 00 4c 31 36 37 33 00 52 65 78 65 63 5f  s.c.L1673.Rexec_
000000e0  62 69 6e 64 5f 6d 65 73 73 61 67 65 00 00 32 00  bind_message..2.
000000f0  00 00 04 54 00 00 00 1c 00 01 73 73 6c 00 00 00  ...T......ssl...
00000100  2f d9 00 02 00 00 00 10 00 01 ff ff ff ff 00 00  /...............
00000110  43 00 00 00 0d 53 45 4c 45 43 54 20 30 00 5a 00  C....SELECT 0.Z.
00000120  00 00 05 49                                      ...I
---------------------------------------------------------------------------

which might be mistaken by DataGrip as error?

hanayashiki avatar Jun 27 '25 03:06 hanayashiki

select ssl from pg_stat_ssl where pid = pg_backend_pid()

Interesting, the engine is querying the DB for SSL connection status, even if you disabled SSL.

@hanayashiki

Can you please try over the UNIX socket connection instead?

$ pglite-server -u /tmp/.s.PGSQL.5432 -v 1

tdrz avatar Jul 23 '25 06:07 tdrz

@pmp-p For reference:

With pglite-server:

# select ssl from pg_stat_ssl where pid = pg_backend_pid();
 ssl 
-----
(0 rows)

With a real postgres server:

# select ssl from pg_stat_ssl where pid = pg_backend_pid()'
 ssl 
-----
 f
(1 row)

So I guess the expectation is to return either true or false. Not returning anything might be unexpected...

tdrz avatar Jul 23 '25 06:07 tdrz

pgadmin also seems to have issues with pglite-server. It can actually connect over the UNIX socket, but then it runs some queries and I guess the answer is not what it expects:

-> incoming 2509 bytes
00000000  51 00 00 09 cc 2f 2a 70 67 61 34 64 61 73 68 2a  Q..../*pga4dash*
00000010  2f 0a 53 45 4c 45 43 54 20 27 73 65 73 73 69 6f  /.SELECT 'sessio
00000020  6e 5f 73 74 61 74 73 27 20 41 53 20 63 68 61 72  n_stats' AS char
00000030  74 5f 6e 61 6d 65 2c 20 70 67 5f 63 61 74 61 6c  t_name, pg_catal
00000040  6f 67 2e 72 6f 77 5f 74 6f 5f 6a 73 6f 6e 28 74  og.row_to_json(t
00000050  29 20 41 53 20 63 68 61 72 74 5f 64 61 74 61 0a  ) AS chart_data.
00000060  46 52 4f 4d 20 28 53 45 4c 45 43 54 0a 20 20 20  FROM (SELECT.   
00000070  28 53 45 4c 45 43 54 20 63 6f 75 6e 74 28 2a 29  (SELECT count(*)
00000080  20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67   FROM pg_catalog
00000090  2e 70 67 5f 73 74 61 74 5f 61 63 74 69 76 69 74  .pg_stat_activit
000000a0  79 20 57 48 45 52 45 20 64 61 74 6e 61 6d 65 20  y WHERE datname 
000000b0  3d 20 28 53 45 4c 45 43 54 20 64 61 74 6e 61 6d  = (SELECT datnam
000000c0  65 20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f  e FROM pg_catalo
000000d0  67 2e 70 67 5f 64 61 74 61 62 61 73 65 20 57 48  g.pg_database WH
000000e0  45 52 45 20 6f 69 64 20 3d 20 35 29 29 20 41 53  ERE oid = 5)) AS
000000f0  20 22 54 6f 74 61 6c 22 2c 0a 20 20 20 28 53 45   "Total",.   (SE
00000100  4c 45 43 54 20 63 6f 75 6e 74 28 2a 29 20 46 52  LECT count(*) FR
00000110  4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70 67  OM pg_catalog.pg
00000120  5f 73 74 61 74 5f 61 63 74 69 76 69 74 79 20 57  _stat_activity W
00000130  48 45 52 45 20 73 74 61 74 65 20 3d 20 27 61 63  HERE state = 'ac
00000140  74 69 76 65 27 20 41 4e 44 20 64 61 74 6e 61 6d  tive' AND datnam
00000150  65 20 3d 20 28 53 45 4c 45 43 54 20 64 61 74 6e  e = (SELECT datn
00000160  61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61 74 61  ame FROM pg_cata
00000170  6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73 65 20  log.pg_database 
00000180  57 48 45 52 45 20 6f 69 64 20 3d 20 35 29 29 20  WHERE oid = 5)) 
00000190  20 41 53 20 22 41 63 74 69 76 65 22 2c 0a 20 20   AS "Active",.  
000001a0  20 28 53 45 4c 45 43 54 20 63 6f 75 6e 74 28 2a   (SELECT count(*
000001b0  29 20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f  ) FROM pg_catalo
000001c0  67 2e 70 67 5f 73 74 61 74 5f 61 63 74 69 76 69  g.pg_stat_activi
000001d0  74 79 20 57 48 45 52 45 20 73 74 61 74 65 20 3d  ty WHERE state =
000001e0  20 27 69 64 6c 65 27 20 41 4e 44 20 64 61 74 6e   'idle' AND datn
000001f0  61 6d 65 20 3d 20 28 53 45 4c 45 43 54 20 64 61  ame = (SELECT da
00000200  74 6e 61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61  tname FROM pg_ca
00000210  74 61 6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73  talog.pg_databas
00000220  65 20 57 48 45 52 45 20 6f 69 64 20 3d 20 35 29  e WHERE oid = 5)
00000230  29 20 20 41 53 20 22 49 64 6c 65 22 0a 29 20 74  )  AS "Idle".) t
00000240  0a 55 4e 49 4f 4e 20 41 4c 4c 0a 53 45 4c 45 43  .UNION ALL.SELEC
00000250  54 20 27 74 70 73 5f 73 74 61 74 73 27 20 41 53  T 'tps_stats' AS
00000260  20 63 68 61 72 74 5f 6e 61 6d 65 2c 20 70 67 5f   chart_name, pg_
00000270  63 61 74 61 6c 6f 67 2e 72 6f 77 5f 74 6f 5f 6a  catalog.row_to_j
00000280  73 6f 6e 28 74 29 20 41 53 20 63 68 61 72 74 5f  son(t) AS chart_
00000290  64 61 74 61 0a 46 52 4f 4d 20 28 53 45 4c 45 43  data.FROM (SELEC
000002a0  54 0a 20 20 20 28 53 45 4c 45 43 54 20 73 75 6d  T.   (SELECT sum
000002b0  28 78 61 63 74 5f 63 6f 6d 6d 69 74 29 20 2b 20  (xact_commit) + 
000002c0  73 75 6d 28 78 61 63 74 5f 72 6f 6c 6c 62 61 63  sum(xact_rollbac
000002d0  6b 29 20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c  k) FROM pg_catal
000002e0  6f 67 2e 70 67 5f 73 74 61 74 5f 64 61 74 61 62  og.pg_stat_datab
000002f0  61 73 65 20 57 48 45 52 45 20 64 61 74 6e 61 6d  ase WHERE datnam
00000300  65 20 3d 20 28 53 45 4c 45 43 54 20 64 61 74 6e  e = (SELECT datn
00000310  61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61 74 61  ame FROM pg_cata
00000320  6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73 65 20  log.pg_database 
00000330  57 48 45 52 45 20 6f 69 64 20 3d 20 35 29 29 20  WHERE oid = 5)) 
00000340  41 53 20 22 54 72 61 6e 73 61 63 74 69 6f 6e 73  AS "Transactions
00000350  22 2c 0a 20 20 20 28 53 45 4c 45 43 54 20 73 75  ",.   (SELECT su
00000360  6d 28 78 61 63 74 5f 63 6f 6d 6d 69 74 29 20 46  m(xact_commit) F
00000370  52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70  ROM pg_catalog.p
00000380  67 5f 73 74 61 74 5f 64 61 74 61 62 61 73 65 20  g_stat_database 
00000390  57 48 45 52 45 20 64 61 74 6e 61 6d 65 20 3d 20  WHERE datname = 
000003a0  28 53 45 4c 45 43 54 20 64 61 74 6e 61 6d 65 20  (SELECT datname 
000003b0  46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e  FROM pg_catalog.
000003c0  70 67 5f 64 61 74 61 62 61 73 65 20 57 48 45 52  pg_database WHER
000003d0  45 20 6f 69 64 20 3d 20 35 29 29 20 41 53 20 22  E oid = 5)) AS "
000003e0  43 6f 6d 6d 69 74 73 22 2c 0a 20 20 20 28 53 45  Commits",.   (SE
000003f0  4c 45 43 54 20 73 75 6d 28 78 61 63 74 5f 72 6f  LECT sum(xact_ro
00000400  6c 6c 62 61 63 6b 29 20 46 52 4f 4d 20 70 67 5f  llback) FROM pg_
00000410  63 61 74 61 6c 6f 67 2e 70 67 5f 73 74 61 74 5f  catalog.pg_stat_
00000420  64 61 74 61 62 61 73 65 20 57 48 45 52 45 20 64  database WHERE d
00000430  61 74 6e 61 6d 65 20 3d 20 28 53 45 4c 45 43 54  atname = (SELECT
00000440  20 64 61 74 6e 61 6d 65 20 46 52 4f 4d 20 70 67   datname FROM pg
00000450  5f 63 61 74 61 6c 6f 67 2e 70 67 5f 64 61 74 61  _catalog.pg_data
00000460  62 61 73 65 20 57 48 45 52 45 20 6f 69 64 20 3d  base WHERE oid =
00000470  20 35 29 29 20 41 53 20 22 52 6f 6c 6c 62 61 63   5)) AS "Rollbac
00000480  6b 73 22 0a 29 20 74 0a 55 4e 49 4f 4e 20 41 4c  ks".) t.UNION AL
00000490  4c 0a 53 45 4c 45 43 54 20 27 74 69 5f 73 74 61  L.SELECT 'ti_sta
000004a0  74 73 27 20 41 53 20 63 68 61 72 74 5f 6e 61 6d  ts' AS chart_nam
000004b0  65 2c 20 70 67 5f 63 61 74 61 6c 6f 67 2e 72 6f  e, pg_catalog.ro
000004c0  77 5f 74 6f 5f 6a 73 6f 6e 28 74 29 20 41 53 20  w_to_json(t) AS 
000004d0  63 68 61 72 74 5f 64 61 74 61 0a 46 52 4f 4d 20  chart_data.FROM 
000004e0  28 53 45 4c 45 43 54 0a 20 20 20 28 53 45 4c 45  (SELECT.   (SELE
000004f0  43 54 20 73 75 6d 28 74 75 70 5f 69 6e 73 65 72  CT sum(tup_inser
00000500  74 65 64 29 20 46 52 4f 4d 20 70 67 5f 63 61 74  ted) FROM pg_cat
00000510  61 6c 6f 67 2e 70 67 5f 73 74 61 74 5f 64 61 74  alog.pg_stat_dat
00000520  61 62 61 73 65 20 57 48 45 52 45 20 64 61 74 6e  abase WHERE datn
00000530  61 6d 65 20 3d 20 28 53 45 4c 45 43 54 20 64 61  ame = (SELECT da
00000540  74 6e 61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61  tname FROM pg_ca
00000550  74 61 6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73  talog.pg_databas
00000560  65 20 57 48 45 52 45 20 6f 69 64 20 3d 20 35 29  e WHERE oid = 5)
00000570  29 20 41 53 20 22 49 6e 73 65 72 74 73 22 2c 0a  ) AS "Inserts",.
00000580  20 20 20 28 53 45 4c 45 43 54 20 73 75 6d 28 74     (SELECT sum(t
00000590  75 70 5f 75 70 64 61 74 65 64 29 20 46 52 4f 4d  up_updated) FROM
000005a0  20 70 67 5f 63 61 74 61 6c 6f 67 2e 70 67 5f 73   pg_catalog.pg_s
000005b0  74 61 74 5f 64 61 74 61 62 61 73 65 20 57 48 45  tat_database WHE
000005c0  52 45 20 64 61 74 6e 61 6d 65 20 3d 20 28 53 45  RE datname = (SE
000005d0  4c 45 43 54 20 64 61 74 6e 61 6d 65 20 46 52 4f  LECT datname FRO
000005e0  4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70 67 5f  M pg_catalog.pg_
000005f0  64 61 74 61 62 61 73 65 20 57 48 45 52 45 20 6f  database WHERE o
00000600  69 64 20 3d 20 35 29 29 20 41 53 20 22 55 70 64  id = 5)) AS "Upd
00000610  61 74 65 73 22 2c 0a 20 20 20 28 53 45 4c 45 43  ates",.   (SELEC
00000620  54 20 73 75 6d 28 74 75 70 5f 64 65 6c 65 74 65  T sum(tup_delete
00000630  64 29 20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c  d) FROM pg_catal
00000640  6f 67 2e 70 67 5f 73 74 61 74 5f 64 61 74 61 62  og.pg_stat_datab
00000650  61 73 65 20 57 48 45 52 45 20 64 61 74 6e 61 6d  ase WHERE datnam
00000660  65 20 3d 20 28 53 45 4c 45 43 54 20 64 61 74 6e  e = (SELECT datn
00000670  61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61 74 61  ame FROM pg_cata
00000680  6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73 65 20  log.pg_database 
00000690  57 48 45 52 45 20 6f 69 64 20 3d 20 35 29 29 20  WHERE oid = 5)) 
000006a0  41 53 20 22 44 65 6c 65 74 65 73 22 0a 29 20 74  AS "Deletes".) t
000006b0  0a 55 4e 49 4f 4e 20 41 4c 4c 0a 53 45 4c 45 43  .UNION ALL.SELEC
000006c0  54 20 27 74 6f 5f 73 74 61 74 73 27 20 41 53 20  T 'to_stats' AS 
000006d0  63 68 61 72 74 5f 6e 61 6d 65 2c 20 70 67 5f 63  chart_name, pg_c
000006e0  61 74 61 6c 6f 67 2e 72 6f 77 5f 74 6f 5f 6a 73  atalog.row_to_js
000006f0  6f 6e 28 74 29 20 41 53 20 63 68 61 72 74 5f 64  on(t) AS chart_d
00000700  61 74 61 0a 46 52 4f 4d 20 28 53 45 4c 45 43 54  ata.FROM (SELECT
00000710  0a 20 20 20 28 53 45 4c 45 43 54 20 73 75 6d 28  .   (SELECT sum(
00000720  74 75 70 5f 66 65 74 63 68 65 64 29 20 46 52 4f  tup_fetched) FRO
00000730  4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70 67 5f  M pg_catalog.pg_
00000740  73 74 61 74 5f 64 61 74 61 62 61 73 65 20 57 48  stat_database WH
00000750  45 52 45 20 64 61 74 6e 61 6d 65 20 3d 20 28 53  ERE datname = (S
00000760  45 4c 45 43 54 20 64 61 74 6e 61 6d 65 20 46 52  ELECT datname FR
00000770  4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70 67  OM pg_catalog.pg
00000780  5f 64 61 74 61 62 61 73 65 20 57 48 45 52 45 20  _database WHERE 
00000790  6f 69 64 20 3d 20 35 29 29 20 41 53 20 22 46 65  oid = 5)) AS "Fe
000007a0  74 63 68 65 64 22 2c 0a 20 20 20 28 53 45 4c 45  tched",.   (SELE
000007b0  43 54 20 73 75 6d 28 74 75 70 5f 72 65 74 75 72  CT sum(tup_retur
000007c0  6e 65 64 29 20 46 52 4f 4d 20 70 67 5f 63 61 74  ned) FROM pg_cat
000007d0  61 6c 6f 67 2e 70 67 5f 73 74 61 74 5f 64 61 74  alog.pg_stat_dat
000007e0  61 62 61 73 65 20 57 48 45 52 45 20 64 61 74 6e  abase WHERE datn
000007f0  61 6d 65 20 3d 20 28 53 45 4c 45 43 54 20 64 61  ame = (SELECT da
00000800  74 6e 61 6d 65 20 46 52 4f 4d 20 70 67 5f 63 61  tname FROM pg_ca
00000810  74 61 6c 6f 67 2e 70 67 5f 64 61 74 61 62 61 73  talog.pg_databas
00000820  65 20 57 48 45 52 45 20 6f 69 64 20 3d 20 35 29  e WHERE oid = 5)
00000830  29 20 41 53 20 22 52 65 74 75 72 6e 65 64 22 0a  ) AS "Returned".
00000840  29 20 74 0a 55 4e 49 4f 4e 20 41 4c 4c 0a 53 45  ) t.UNION ALL.SE
00000850  4c 45 43 54 20 27 62 69 6f 5f 73 74 61 74 73 27  LECT 'bio_stats'
00000860  20 41 53 20 63 68 61 72 74 5f 6e 61 6d 65 2c 20   AS chart_name, 
00000870  70 67 5f 63 61 74 61 6c 6f 67 2e 72 6f 77 5f 74  pg_catalog.row_t
00000880  6f 5f 6a 73 6f 6e 28 74 29 20 41 53 20 63 68 61  o_json(t) AS cha
00000890  72 74 5f 64 61 74 61 0a 46 52 4f 4d 20 28 53 45  rt_data.FROM (SE
000008a0  4c 45 43 54 0a 20 20 20 28 53 45 4c 45 43 54 20  LECT.   (SELECT 
000008b0  73 75 6d 28 62 6c 6b 73 5f 72 65 61 64 29 20 46  sum(blks_read) F
000008c0  52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e 70  ROM pg_catalog.p
000008d0  67 5f 73 74 61 74 5f 64 61 74 61 62 61 73 65 20  g_stat_database 
000008e0  57 48 45 52 45 20 64 61 74 6e 61 6d 65 20 3d 20  WHERE datname = 
000008f0  28 53 45 4c 45 43 54 20 64 61 74 6e 61 6d 65 20  (SELECT datname 
00000900  46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67 2e  FROM pg_catalog.
00000910  70 67 5f 64 61 74 61 62 61 73 65 20 57 48 45 52  pg_database WHER
00000920  45 20 6f 69 64 20 3d 20 35 29 29 20 41 53 20 22  E oid = 5)) AS "
00000930  52 65 61 64 73 22 2c 0a 20 20 20 28 53 45 4c 45  Reads",.   (SELE
00000940  43 54 20 73 75 6d 28 62 6c 6b 73 5f 68 69 74 29  CT sum(blks_hit)
00000950  20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f 67   FROM pg_catalog
00000960  2e 70 67 5f 73 74 61 74 5f 64 61 74 61 62 61 73  .pg_stat_databas
00000970  65 20 57 48 45 52 45 20 64 61 74 6e 61 6d 65 20  e WHERE datname 
00000980  3d 20 28 53 45 4c 45 43 54 20 64 61 74 6e 61 6d  = (SELECT datnam
00000990  65 20 46 52 4f 4d 20 70 67 5f 63 61 74 61 6c 6f  e FROM pg_catalo
000009a0  67 2e 70 67 5f 64 61 74 61 62 61 73 65 20 57 48  g.pg_database WH
000009b0  45 52 45 20 6f 69 64 20 3d 20 35 29 29 20 41 53  ERE oid = 5)) AS
000009c0  20 22 48 69 74 73 22 0a 29 20 74 0a 00            "Hits".) t..
---------------------------------------------------------------------------
<- outgoing 365 bytes
00000000  54 00 00 00 40 00 02 63 68 61 72 74 5f 6e 61 6d  [email protected]_nam
00000010  65 00 00 00 00 00 00 00 00 00 00 19 ff ff ff ff  e...............
00000020  ff ff 00 00 63 68 61 72 74 5f 64 61 74 61 00 00  ....chart_data..
00000030  00 00 00 00 00 00 00 00 72 ff ff ff ff ff ff 00  ........r.......
00000040  00 44 00 00 00 3a 00 02 00 00 00 0d 73 65 73 73  .D...:......sess
00000050  69 6f 6e 5f 73 74 61 74 73 00 00 00 1f 7b 22 54  ion_stats....{"T
00000060  6f 74 61 6c 22 3a 30 2c 22 41 63 74 69 76 65 22  otal":0,"Active"
00000070  3a 30 2c 22 49 64 6c 65 22 3a 30 7d 44 00 00 00  :0,"Idle":0}D...
00000080  43 00 02 00 00 00 09 74 70 73 5f 73 74 61 74 73  C......tps_stats
00000090  00 00 00 2c 7b 22 54 72 61 6e 73 61 63 74 69 6f  ...,{"Transactio
000000a0  6e 73 22 3a 30 2c 22 43 6f 6d 6d 69 74 73 22 3a  ns":0,"Commits":
000000b0  30 2c 22 52 6f 6c 6c 62 61 63 6b 73 22 3a 30 7d  0,"Rollbacks":0}
000000c0  44 00 00 00 3b 00 02 00 00 00 08 74 69 5f 73 74  D...;......ti_st
000000d0  61 74 73 00 00 00 25 7b 22 49 6e 73 65 72 74 73  ats...%{"Inserts
000000e0  22 3a 30 2c 22 55 70 64 61 74 65 73 22 3a 30 2c  ":0,"Updates":0,
000000f0  22 44 65 6c 65 74 65 73 22 3a 30 7d 44 00 00 00  "Deletes":0}D...
00000100  30 00 02 00 00 00 08 74 6f 5f 73 74 61 74 73 00  0......to_stats.
00000110  00 00 1a 7b 22 46 65 74 63 68 65 64 22 3a 30 2c  ...{"Fetched":0,
00000120  22 52 65 74 75 72 6e 65 64 22 3a 30 7d 44 00 00  "Returned":0}D..
00000130  00 2b 00 02 00 00 00 09 62 69 6f 5f 73 74 61 74  .+......bio_stat
00000140  73 00 00 00 14 7b 22 52 65 61 64 73 22 3a 30 2c  s....{"Reads":0,
00000150  22 48 69 74 73 22 3a 30 7d 43 00 00 00 0d 53 45  "Hits":0}C....SE
00000160  4c 45 43 54 20 35 00 5a 00 00 00 05 49           LECT 5.Z....I
---------------------------------------------------------------------------

tdrz avatar Jul 23 '25 07:07 tdrz

i see ssl status and tcp keepalive as source of configuration report troubles since these are simply fully ignored in the core. imho the jdbc datagrip driver should fallback properly.

it seems there's a 30 days trial period possible with Datagrip.

pmp-p avatar Jul 29 '25 04:07 pmp-p