28

Whenever I am executing a query in postgresql, this is the error message I receive

Transaction ID not found in the session.

Does anyone have any idea how to resolve this? I recently created a new user, but I was unable to find documentation that even shows this as a valid error.

Additional Details: I've managed to resolve the error by re-connecting with admin credentials.

I was using PG Admin V4 with Postgres V9.6, and that was the only message appearing in any query I executed, even if it was a basic query like 'SELECT NOW()'.

At the same time, this was the error message being received by the client device (an iOS device with a AWS Lambda / NodeJS backend) :

'message' : {
  'name' : 'error',
  'length' : 114,
  'severity' : 'fatal',
  'code' : '28000',
  'file' : 'miscinit.c',
  'line' : '587',
  'routine' : 'InitializeSessionUserId'
}
Colin 't Hart
  • 7,372
  • 3
  • 28
  • 51
Molezz
  • 431
  • 1
  • 6
  • 7

8 Answers8

30

I assume you found a solution, but for anyone else that finds this post, I had the same issue and I just closed PG Admin 4 and restarted it and it cleared up.

gignosko
  • 977
  • 1
  • 8
  • 12
21

For me helped changing 'localhost' in connection settings to '127.0.0.1', as mentioned here: https://stackoverflow.com/a/59747781/2590805

user2590805
  • 410
  • 4
  • 6
20

To anyone who has this problem, all you have to do is:

1) Reconnect to the database

2) Open a new Query Tab. (Run your query here)

You're welcome.

Community
  • 1
  • 1
Joshua Rajandiran
  • 2,788
  • 7
  • 26
  • 53
2

Disconnecting and reconnecting to the database solved this issue for me; it wasn't necessary to exit/open PGAdmin 4 completely.

Tyler MacMillan
  • 592
  • 1
  • 7
  • 26
2

Create a new Query editor tab, that works for me

Álvaro Agüero
  • 4,494
  • 1
  • 42
  • 39
1

This is not a PostgreSQL error message. It must come from something else in the stack you are using - a client driver, ORM, etc.

Please post a more detailed question with full information on the stack you're using.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
0

So I don't know the exact specifics of my solution, but I found this issue in the following circumstance:

  • Database user was created.
  • Role was assigned for the user.
  • A transaction was used

I'm still not entirely sure I discovered the solution of the root problem, but if others have the same scenario, it might help troubleshoot it further. If any of those three are not used, then I never encountered the issue.

Molezz
  • 431
  • 1
  • 6
  • 7
0

Has anyone found an explanation for this problem? I am also getting a "Transaction ID not found in the session.". It's for a long running (several days) query. I ran it on a 10% sample of my data and had no trouble, but now need to repeat the process for the full dataset. I reconnect to the database and the query appears as still active. A new idle query appears as follows:

SELECT rel.oid, rel.relname AS name,
    (SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE) AS triggercount,
    (SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE AND tgenabled = 'O') AS has_enable_triggers,
    (CASE WHEN rel.relkind = 'p' THEN true ELSE false END) AS is_partitioned
FROM pg_class rel
    WHERE rel.relkind IN ('r','s','t','p') AND rel.relnamespace = 2200::oid
    AND NOT rel.relispartition
        ORDER BY rel.relname;
Jason Hawkins
  • 625
  • 1
  • 9
  • 24