gpt4 book ai didi

postgresql - 将整数作为二进制字符串连接到 bytea

转载 作者:行者123 更新时间:2023-11-29 12:47:57 24 4
gpt4 key购买 nike

在 PostgreSQL 8.4 中是否可以将多个整数 (int4) 值连接到一个 bytea 值?

例如:

5::int4 || 1::int4

应该产生一个带有 (0x05 0x00 0x00 0x00 0x01 0x00 0x00 0x00) 的 bytea 值,假设是一个小端机器。

最佳答案

好吧,int4send 会将 int4 转换为 bytea,但我从名称怀疑它会始终使用网络排序。

即:

steve@steve@[local] =# select int4send(3);
int4send
------------
\x00000003

amd64 机器上的事件。

关于postgresql - 将整数作为二进制字符串连接到 bytea,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8840156/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com