Message-ID: From: "goranschwarz (@goranschwarz)" To: "pgjdbc/pgjdbc" Date: Mon, 18 Mar 2024 21:35:50 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3166: query_id in pg_stat_activity is NULL when connecting from JDBC, but not from psql In-Reply-To: References: List-Id: X-GitHub-Author-Login: goranschwarz X-GitHub-Comment-Id: 2005061872 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3166 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3166#issuecomment-2005061872 Content-Type: text/plain; charset=utf-8 I see that you get the "correct" row at row 3 (is that a JDBC Connection or "something else") What does the previous rows say? Below is my full output (only 2 rows) ``` Starting PgSleep... >>>> ERROR: row[1], column 'query_id', shouldn't be NULL, it has a value if the statement was initiated from 'psql'... PG-STAT-ACTIVITY: row[1], col[1] = |null| PG-STAT-ACTIVITY: row[1], col[2] = |5| PG-STAT-ACTIVITY: row[1], col[3] = |postgres| PG-STAT-ACTIVITY: row[1], col[4] = |1442795| PG-STAT-ACTIVITY: row[1], col[5] = |null| PG-STAT-ACTIVITY: row[1], col[6] = |16384| PG-STAT-ACTIVITY: row[1], col[7] = |dbxtune| PG-STAT-ACTIVITY: row[1], col[8] = |PostgreSQL JDBC Driver| PG-STAT-ACTIVITY: row[1], col[9] = |192.168.0.161| PG-STAT-ACTIVITY: row[1], col[10] = |null| PG-STAT-ACTIVITY: row[1], col[11] = |54781| PG-STAT-ACTIVITY: row[1], col[12] = |2024-03-18 22:27:06.602158+01| PG-STAT-ACTIVITY: row[1], col[13] = |2024-03-18 22:27:07.742059+01| PG-STAT-ACTIVITY: row[1], col[14] = |2024-03-18 22:27:07.742851+01| PG-STAT-ACTIVITY: row[1], col[15] = |2024-03-18 22:27:07.742852+01| PG-STAT-ACTIVITY: row[1], col[16] = |Timeout| PG-STAT-ACTIVITY: row[1], col[17] = |PgSleep| PG-STAT-ACTIVITY: row[1], col[18] = |active| PG-STAT-ACTIVITY: row[1], col[19] = |null| PG-STAT-ACTIVITY: row[1], col[20] = |2235| PG-STAT-ACTIVITY: row[1], col[21] = |null| PG-STAT-ACTIVITY: row[1], col[22] = |select pg_sleep(3)| PG-STAT-ACTIVITY: row[1], col[23] = |client backend| >>>> ERROR: row[2], column 'query_id', shouldn't be NULL, it has a value if the statement was initiated from 'psql'... PG-STAT-ACTIVITY: row[2], col[1] = |null| PG-STAT-ACTIVITY: row[2], col[2] = |5| PG-STAT-ACTIVITY: row[2], col[3] = |postgres| PG-STAT-ACTIVITY: row[2], col[4] = |1442794| PG-STAT-ACTIVITY: row[2], col[5] = |null| PG-STAT-ACTIVITY: row[2], col[6] = |16384| PG-STAT-ACTIVITY: row[2], col[7] = |dbxtune| PG-STAT-ACTIVITY: row[2], col[8] = |PostgreSQL JDBC Driver| PG-STAT-ACTIVITY: row[2], col[9] = |192.168.0.161| PG-STAT-ACTIVITY: row[2], col[10] = |null| PG-STAT-ACTIVITY: row[2], col[11] = |54782| PG-STAT-ACTIVITY: row[2], col[12] = |2024-03-18 22:27:06.604805+01| PG-STAT-ACTIVITY: row[2], col[13] = |2024-03-18 22:27:07.739081+01| PG-STAT-ACTIVITY: row[2], col[14] = |2024-03-18 22:27:07.745152+01| PG-STAT-ACTIVITY: row[2], col[15] = |2024-03-18 22:27:07.745153+01| PG-STAT-ACTIVITY: row[2], col[16] = |null| PG-STAT-ACTIVITY: row[2], col[17] = |null| PG-STAT-ACTIVITY: row[2], col[18] = |active| PG-STAT-ACTIVITY: row[2], col[19] = |null| PG-STAT-ACTIVITY: row[2], col[20] = |2235| PG-STAT-ACTIVITY: row[2], col[21] = |null| PG-STAT-ACTIVITY: row[2], col[22] = |select query_id, * from pg_stat_activity where query like '%pg_sleep%'| PG-STAT-ACTIVITY: row[2], col[23] = |client backend| PG-SLEEP-RS: row[1], col[1] = || ```