- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的应用程序(使用 Delphi 和 ZEOS 组件开发)使用 PostgreSQL 8.4 并将一些缩略图图像存储到 bytea
列中。
我想迁移到 PostgreSQL 9.2 并恢复了转储,一切正常,除了当我尝试检索这些图像时:Postgres 9.2 使用 hex
作为输出表示而不是 escape
在 Postgres 8.4 中使用。
有两种可能的解决方案:更改 escape
表示的 Postgres 9.2 设置或通过应用程序更改二进制数据中的 hex
字符串。但最好的解决办法是什么?为什么 PostgreSQL 9.X 将 bytea
表示改为 hex
?
这是一个简单的设置还是有技术原因?
最佳答案
在 release notes of Postgres 9.0 中给出了基本原理:
- Allow
bytea
values to be written in hex notation (Peter Eisentraut)The server parameter
bytea_output
controls whether hex or traditional format is used forbytea
output. Libpq'sPQescapeByteaConn()
function automatically uses the hex format when connected to PostgreSQL 9.0 or newer servers. However, pre-9.0 libpq versions will not correctly process hex format from newer servers.The new hex format will be directly compatible with more applications that use binary data, allowing them to store and retrieve it without extra conversion. It is also significantly faster to read and write than the traditional format.
您似乎已经意识到 bytea_output
.
关于delphi - 'hex' 或 'escape' 中的 PostgreSQL 9.X bytea 表示形式用于缩略图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17157816/
我是 PostgreSQL 的新手。我想在 Postgres 中将我的列数据类型之一从 bytea[] 更改为 bytea。我尝试了以下查询,但它给出了错误 cannot cast type byte
我正在编写一个函数,它将从大对象中读取数据并将其与作为 arg 提供的数据进行比较。 (我想确保我写的是正确的,这是写后完整性检查) 我已经想出了如何分块读取大对象 fd := lo_open(
我得到了 answer检查 PostgreSQL 文本列中的某个 BOM。我真正喜欢做的是拥有更通用的东西,即像 select decode(replace(textColumn, '\\', '\\
在 PostgreSQL 中,如何将 NUMERIC 值转换为 BYTEA 值?和 BYTEA 到 NUMERIC?使用 TEXT 值我可以使用 CONVERT_TO() 和 CONVERT_FROM
紧随this example ,我正在上传一个小文件并尝试存储到 postgresql bytea 列中。 这是错误(前两个输出是在尝试 INSERT 之前输出 bean 属性的日志记录语句: SAG
嗨,在我的 spring boot postgresql 应用程序中,我想执行以下 sql 查询。 SELECT o.id as projectId,
在 PostgreSQL 8.4 中是否可以将多个整数 (int4) 值连接到一个 bytea 值? 例如: 5::int4 || 1::int4 应该产生一个带有 (0x05 0x00 0x00 0
我正在尝试从存储为 bytea 的 Postgres 数据库中获取一个值。 这些值是 VLAN ID(因此是 1-4096 之间的整数)。 但是,它存储在数据库中(例如): \000\000\001\
我知道您可以将图像文件存储到 bytea 列,但是如果您需要在该列中存储与该行关联的多个图像怎么办?您是否被迫创建另一个引用该行的表?我试图避免这种情况,因为每一行都是表格数据的一部分,我需要一个图像
我的数据库中有一个存储日志的表。日志文件带有秒级精度的时间戳,并存储各种传感器的值及其来源: log_id, log_date, primary_system_source, sub_system_s
我将图像存储在 bytea 字段中的 postgresql 9.1 数据库表中。我想做一个查询来按尺寸排序并显示它们的尺寸。我需要这个,因为有一些大图像会导致延迟问题。 最佳答案 select len
我需要解码 base64 字符串并获取一大块二进制文件。 Postgres 中是否有一个SQL 函数可以简单地将bytea 转换为二进制字符串表示形式? (例如“00010001010101010”。
在 PostgreSQL 中,有一个名为 bytea 的 BLOB 数据类型。它只是一个字节数组。 bytea 字面量以下列方式输出: '\\037\\213\\010\\010\\005`Us\\0
我在 PostgreSQL 中使用 bytea 类型,据我所知,它只包含一系列字节。但是,我无法让它与 null 一起玩。例如: =# select length(E'aa\x00aa'::bytea
这是我的代码: List ids= new ArrayList(); ids.add(10L);ids.add(11L); String queryString ="sel
在 Postgres 中有一个数据类型叫做 bytea 为此提供了 Postgres 文档:http://www.postgresql.org/docs/9.0/static/datatype-bin
我在postgresql中有一张表用来存储文件信息。 select id,filestream,name from Table_file_info 这里的filestream是bytea数据类型。如何
为了在 PostgreSQL 中处理 bytea 值,我通常会序列化到十六进制并从十六进制反序列化。这似乎是首选方式。但是,PostgreSQL 服务器上实际存储的是什么?它是十六进制还是未十六进制的
我想了解如何在 postgresql (v 8.3) 中处理二进制数据。假设我有一个下表 Table "public.message" Column | Type | Modifiers --
我正在尝试分析 Postgresql 数据库中的数据,该数据库是 Json 文本但存储在 bytea 列中。一些行可以转换,但其他行不能。文本中没有代码点的 Json 在转换编码的 bytea 时工作
我是一名优秀的程序员,十分优秀!