0

Exact type information can be found in Postgres

I noticed that the type information is a bit inaccurate regarding miltidimensional arrays:

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[]

How do I get back the exact type integer[][]?

1 Answer 1

2

This is the standard bevahior according to the 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.