Mega Code Archive

 
Categories / PostgreSQL / Array
 

Using array_dims()

postgres=# CREATE TABLE book (id integer,titles text[]); CREATE TABLE postgres=# postgres=# INSERT INTO book VALUES (102, '{"AAA\'s VVVV"}'); INSERT 0 1 postgres=# INSERT INTO book VALUES (103, '{"AAA", "VVVV"}'); INSERT 0 1 postgres=# postgres=# -- Using array_dims(?) postgres=# SELECT array_dims(titles) FROM book;  array_dims ------------  [1:1]  [1:2] (2 rows) postgres=# drop table book; DROP TABLE postgres=#