未找到 Postgresql 事务 ID

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43220148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:32:39  来源:igfitidea点击:

Postgresql Transaction ID Not Found

postgresqlpgadminpgadmin-4

提问by Molezz

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

每当我在 postgresql 中执行查询时,这是我收到的错误消息

Transaction ID not found in the session.

在会话中找不到事务 ID。

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()'.

我在 Postgres V9.6 中使用了 PG Admin V4,这是我执行的任何查询中出现的唯一消息,即使它是像“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) :

同时,这是客户端设备(具有 AWS Lambda / NodeJS 后端的 iOS 设备)收到的错误消息:

'message' : {
  'name' : 'error',
  'length' : 114,
  'severity' : 'fatal',
  'code' : '28000',
  'file' : 'miscinit.c',
  'line' : '587',
  'routine' : 'InitializeSessionUserId'
}

回答by gignosko

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.

我假设你找到了一个解决方案,但对于找到这篇文章的其他人,我遇到了同样的问题,我刚刚关闭了 PG Admin 4 并重新启动它并清除了它。

回答by Joshua Rajandiran

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

对于遇到此问题的任何人,您所要做的就是:

1) Reconnect to the database

1) Reconnect to the database

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

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

You're welcome.

别客气。

回答by user2590805

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

对我来说,帮助将连接设置中的“本地主机”更改为“127.0.0.1”,如下所述:https: //stackoverflow.com/a/59747781/2590805

回答by Tyler MacMillan

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

断开并重新连接到数据库为我解决了这个问题;没有必要完全退出/打开 PGAdmin 4。

回答by álvaro Agüero

Create a new Query editor tab, that works for me

创建一个新的查询编辑器选项卡,这对我有用

回答by Craig Ringer

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

这不是 PostgreSQL 错误消息。它必须来自您正在使用的堆栈中的其他东西 - 客户端驱动程序、ORM 等。

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

请发布一个更详细的问题,其中包含有关您正在使用的堆栈的完整信息。

回答by Molezz

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.

我仍然不完全确定我找到了根本问题的解决方案,但如果其他人有相同的情况,它可能有助于进一步排除故障。如果没有使用这三个中的任何一个,那么我从未遇到过这个问题。

回答by Jason Hawkins

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:

有没有人找到这个问题的解释?我还收到“在会话中未找到交易 ID。”。这是一个长时间运行(几天)的查询。我在我的数据的 10% 样本上运行它并且没有问题,但现在需要对完整数据集重复该过程。我重新连接到数据库,查询显示为仍处于活动状态。一个新的空闲查询出现如下:

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;