从PostgreSQL中的oid类型检索值。

huangapple go评论66阅读模式
英文:

Retrieve value from a oid type in PostgreSql

问题

如何从PostgreSQL中的oid列类型中检索值。此表是由应用程序生成的,而不是由用户生成的,根据产品文档的描述,它以二进制格式存储事务数据。当我浏览数据时,它的最大长度为6或7,但当我将产品配置到另一个数据库,如H2时,我可以看到在相同列中存储了更多的数据。

英文:

How to retrieve values from an oid column type in PostgreSQL This table is generated by an application and not by the user, and as per the documentation of the product, it says that it stores transaction data in binary format. When I browse through the data, it has a maximum length of 6 or 7, but when I configure the product with another database, like H2, I can see more data stored in the same column.

答案1

得分: 0

这是因为您似乎正在使用大对象。您不应该这样做,而应该使用bytea,它将按您的期望行事。大对象是一项传统功能,可能会给您带来各种麻烦。

您必须明确使用该oid打开并读取大对象。

英文:

That's because you seem to be using large objects. You shouldn't be doing that, but use bytea instead, which would behave as you expect. Large objects are a legacy feature that is likely to cause all kinds of trouble for you.

You have to open an read the large object with that oid explicitly.

huangapple
  • 本文由 发表于 2023年6月12日 14:42:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76454135.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定