Molezz
Molezz

Reputation: 431

Postgresql Transaction ID Not Found

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'
}

Upvotes: 28

Views: 32837

Answers (9)

jui
jui

Reputation: 29

I had the same problem: few seconds before every SQL worked without trouble and then run into the same result "Transaction ID not found in the session." As described serveral times before, a restart of pgadmin solved the problem.

I use pgadmin 6.2, belonging to the thread it seems to be an ongoing problem. Maybe someone has an idea about the reason?

Upvotes: 1

Álvaro Agüero
Álvaro Agüero

Reputation: 4800

Create a new Query editor tab, that works for me

Upvotes: 2

user2590805
user2590805

Reputation: 420

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

Upvotes: 21

Jason Hawkins
Jason Hawkins

Reputation: 635

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;

Upvotes: 0

Joshua Rajandiran
Joshua Rajandiran

Reputation: 2928

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.

Upvotes: 20

Tyler MacMillan
Tyler MacMillan

Reputation: 592

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

Upvotes: 2

Molezz
Molezz

Reputation: 431

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.

Upvotes: 0

gignosko
gignosko

Reputation: 987

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.

Upvotes: 30

Craig Ringer
Craig Ringer

Reputation: 324501

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.

Upvotes: 1

Related Questions