↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 数据类型 / 数值

bigint

有符号八字节整数

当前查看 PostgreSQL 18。

中文定义与说明

有符号八字节整数

同版本中文手册节选

数字类型包括 2、4、8 字节的整数,4、8 字节的浮点数,以及可选精度的小数。表 8.2 列出了所有可用类型。

数字类型常量的语法在第 4.1.2 节里描述。数字类型有一整套对应的算术操作符和函数。相关信息请参考第 9 章。下面的几节详细描述这些类型。

查看完整中文手册与上下文。

PG10–20 核心源码清单。类型转换与操作符类列出源码显式声明的关系;缺少记录不能排除通过其他机制进行转换或使用索引。

定义

SQL 名称与别名: int8

有符号八字节整数

bigint
目录名称
pg_catalog.int8
类型 OID
20
类型种类
基础类型
声明长度
8 字节
存储策略
plain
输入函数
int8in
输出函数
int8out
手册中的声明
bigint
存储大小
8 字节
手册说明
大范围整数
范围
-9223372036854775808 到 +9223372036854775807

系统目录属性

此构建的源码初始化值。字段含义参见 pg_type 。包含头文件默认值;依赖构建的常量保留符号形式,不作为服务器运行时实测。

oid
20
descr
~18 digit integer, 8-byte storage
typacl
_null_
typlen
8
typelem
0
typname
int8
typsend
int8send
typtype
b
typalign
d
typarray
0
typbyval
FLOAT8PASSBYVAL
typdelim
','
typinput
int8in
typmodin
-
typndims
0
typowner
POSTGRES
typrelid
0
typmodout
-
typoutput
int8out
typtypmod
-1
typanalyze
-
typdefault
_null_
typnotnull
f
typreceive
int8recv
typstorage
p
typbasetype
0
typcategory
N
typcollation
0
typisdefined
t
typnamespace
pg_catalog
typsubscript
-
typdefaultbin
_null_
array_type_oid
1016
typispreferred
f
array_type_name
_int8

类型转换 40

与此类型相关的显式 pg_cast 记录。PostgreSQL 还支持 pg_cast 之外的类型转换,缺少记录不能证明转换不可能。

源类型目标类型转换上下文转换方式函数
int8int2赋值函数int2(int8)
int8int4赋值函数int4(int8)
int8float4隐式函数float4(int8)
int8float8隐式函数float8(int8)
int8numeric隐式函数numeric(int8)
int2int8隐式函数int8(int2)
int4int8隐式函数int8(int4)
float4int8赋值函数int8(float4)
float8int8赋值函数int8(float8)
numericint8赋值函数int8(numeric)
int8money赋值函数money(int8)
int8oid隐式函数oid
oidint8赋值函数int8(oid)
int8regproc隐式函数oid
regprocint8赋值函数int8(oid)
int8regprocedure隐式函数oid
regprocedureint8赋值函数int8(oid)
int8regoper隐式函数oid
regoperint8赋值函数int8(oid)
int8regoperator隐式函数oid
regoperatorint8赋值函数int8(oid)
int8regclass隐式函数oid
regclassint8赋值函数int8(oid)
int8regcollation隐式函数oid
regcollationint8赋值函数int8(oid)
int8regtype隐式函数oid
regtypeint8赋值函数int8(oid)
int8regconfig隐式函数oid
regconfigint8赋值函数int8(oid)
int8regdictionary隐式函数oid
regdictionaryint8赋值函数int8(oid)
int8regrole隐式函数oid
regroleint8赋值函数int8(oid)
int8regnamespace隐式函数oid
regnamespaceint8赋值函数int8(oid)
int8bytea显式函数bytea(int8)
byteaint8显式函数int8(bytea)
int8bit显式函数bit(int8,int4)
bitint8显式函数int8(bit)
jsonbint8显式函数int8(jsonb)

运算符重载 66

每种操作数签名均为独立重载。实现函数和返回类型来自同一源码构建。

运算符左操作数右操作数返回类型含义实现函数
=int4int8bool等于。int48eq
<>int4int8bool不等于。int48ne
<int4int8bool小于。int48lt
>int4int8bool大于。int48gt
<=int4int8bool小于或等于。int48le
>=int4int8bool大于或等于。int48ge
=int8int8bool等于。int8eq
<>int8int8bool不等于。int8ne
<int8int8bool小于。int8lt
>int8int8bool大于。int8gt
<=int8int8bool小于或等于。int8le
>=int8int8bool大于或等于。int8ge
=int8int4bool等于。int84eq
<>int8int4bool不等于。int84ne
<int8int4bool小于。int84lt
>int8int4bool大于。int84gt
<=int8int4bool小于或等于。int84le
>=int8int4bool大于或等于。int84ge
%int8int8int8取余。int8mod
@无(一元)int8int8绝对值。int8abs
-无(一元)int8int8取负。int8um
+int8int8int8相加。int8pl
-int8int8int8相减。int8mi
*int8int8int8相乘。int8mul
/int8int8int8相除。int8div
+int8int4int8相加。int84pl
-int8int4int8相减。int84mi
*int8int4int8相乘。int84mul
/int8int4int8相除。int84div
+int4int8int8相加。int48pl
-int4int8int8相减。int48mi
*int4int8int8相乘。int48mul
/int4int8int8相除。int48div
+int8int2int8相加。int82pl
-int8int2int8相减。int82mi
*int8int2int8相乘。int82mul
/int8int2int8相除。int82div
+int2int8int8相加。int28pl
-int2int8int8相减。int28mi
*int2int8int8相乘。int28mul
/int2int8int8相除。int28div
*moneyint8money相乘。cash_mul_int8
/moneyint8money相除。cash_div_int8
*int8moneymoney相乘。int8_mul_cash
+inetint8inet相加。inetpl
+int8inetinet相加。int8pl_inet
-inetint8inet相减。inetmi_int8
=int2int8bool等于。int28eq
<>int2int8bool不等于。int28ne
<int2int8bool小于。int28lt
>int2int8bool大于。int28gt
<=int2int8bool小于或等于。int28le
>=int2int8bool大于或等于。int28ge
=int8int2bool等于。int82eq
<>int8int2bool不等于。int82ne
<int8int2bool小于。int82lt
>int8int2bool大于。int82gt
<=int8int2bool小于或等于。int82le
>=int8int2bool大于或等于。int82ge
&int8int8int8按位与。int8and
|int8int8int8按位或。int8or
#int8int8int8按位异或。int8xor
~无(一元)int8int8按位取反。int8not
<<int8int4int8按位左移。int8shl
>>int8int4int8按位右移。int8shr
+无(一元)int8int8一元正号。int8up

操作符类 5

声明输入类型与此类型相符的操作符类。多态操作符类、类型转换和表达式索引还可能提供其他索引路径;不能仅凭此表判断是否支持索引。

操作符类索引方法输入类型操作符族默认存储类型
int8_opsbtreeint8btree/integer_ops是与输入类型相同
int8_opshashint8hash/integer_ops是与输入类型相同
int8_minmax_opsbrinint8brin/integer_minmax_ops是int8
int8_minmax_multi_opsbrinint8brin/integer_minmax_multi_ops否int8
int8_bloom_opsbrinint8brin/integer_bloom_ops否int8

版本比较

PostgreSQL 17 → 18。属性比较不包含构建标识和说明正文;原始目录字段与源描述保留原文。

类型转换

PostgreSQL 17

[{"castcontext": "a", "castfunc": "int2(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "int2"}, {"castcontext": "a", "castfunc": "int4(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "int4"}, {"castcontext": "a", "castfunc": "int8(float4)", "castmethod": "f", "castsource": "float4", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(float8)", "castmethod": "f", "castsource": "float8", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(numeric)", "castmethod": "f", "castsource": "numeric", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "oid", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regclass", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regcollation", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regconfig", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regdictionary", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regnamespace", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regoper", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regoperator", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regproc", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regprocedure", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regrole", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regtype", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "money(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "money"}, {"castcontext": "e", "castfunc": "bit(int8,int4)", "castmethod": "f", "castsource": "int8", "casttarget": "bit"}, {"castcontext": "e", "castfunc": "int8(bit)", "castmethod": "f", "castsource": "bit", "casttarget": "int8"}, {"castcontext": "e", "castfunc": "int8(jsonb)", "castmethod": "f", "castsource": "jsonb", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "float4(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "float4"}, {"castcontext": "i", "castfunc": "float8(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "float8"}, {"castcontext": "i", "castfunc": "int8(int2)", "castmethod": "f", "castsource": "int2", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "int8(int4)", "castmethod": "f", "castsource": "int4", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "numeric(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "numeric"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "oid"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regclass"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regcollation"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regconfig"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regdictionary"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regnamespace"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regoper"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regoperator"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regproc"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regprocedure"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regrole"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regtype"}]

PostgreSQL 18

[{"castcontext": "a", "castfunc": "int2(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "int2"}, {"castcontext": "a", "castfunc": "int4(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "int4"}, {"castcontext": "a", "castfunc": "int8(float4)", "castmethod": "f", "castsource": "float4", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(float8)", "castmethod": "f", "castsource": "float8", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(numeric)", "castmethod": "f", "castsource": "numeric", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "oid", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regclass", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regcollation", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regconfig", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regdictionary", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regnamespace", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regoper", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regoperator", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regproc", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regprocedure", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regrole", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "int8(oid)", "castmethod": "f", "castsource": "regtype", "casttarget": "int8"}, {"castcontext": "a", "castfunc": "money(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "money"}, {"castcontext": "e", "castfunc": "bit(int8,int4)", "castmethod": "f", "castsource": "int8", "casttarget": "bit"}, {"castcontext": "e", "castfunc": "bytea(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "bytea"}, {"castcontext": "e", "castfunc": "int8(bit)", "castmethod": "f", "castsource": "bit", "casttarget": "int8"}, {"castcontext": "e", "castfunc": "int8(bytea)", "castmethod": "f", "castsource": "bytea", "casttarget": "int8"}, {"castcontext": "e", "castfunc": "int8(jsonb)", "castmethod": "f", "castsource": "jsonb", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "float4(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "float4"}, {"castcontext": "i", "castfunc": "float8(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "float8"}, {"castcontext": "i", "castfunc": "int8(int2)", "castmethod": "f", "castsource": "int2", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "int8(int4)", "castmethod": "f", "castsource": "int4", "casttarget": "int8"}, {"castcontext": "i", "castfunc": "numeric(int8)", "castmethod": "f", "castsource": "int8", "casttarget": "numeric"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "oid"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regclass"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regcollation"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regconfig"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regdictionary"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regnamespace"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regoper"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regoperator"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regproc"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regprocedure"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regrole"}, {"castcontext": "i", "castfunc": "oid", "castmethod": "f", "castsource": "int8", "casttarget": "regtype"}]

文档与源码

构建
18.6 · https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

相关条目

全部数据类型 · 下载此版本 JSON · 最早收录的样本不代表该类型的实际引入版本。