关于 Postgres 中多维数组的精确类型信息

Exact type information about multidimensional arrays in Postgres

可以在 Postgres 中找到准确的类型信息

我注意到关于多维数组的类型信息有点不准确:

create table test (xid int[][] primary key);

insert into test values (array [[2, 4, 2, 7], [1, 5, 6, 0]])

select pg_typeof(xid) from test -- returns integer[]

如何取回准确的类型 integer[][]

这是根据 manual 的标准行为:

The current implementation does not enforce the declared number of dimensions either. Arrays of a particular element type are all considered to be of the same type, regardless of size or number of dimensions. So, declaring the array size or number of dimensions in CREATE TABLE is simply documentation; it does not affect run-time behavior.