Spredzy
Spredzy

Reputation: 5164

How to get an array size (and the biggest) with an SQL statement?

I am using postgres and some of my table's field are arrays. I am looking for the biggest array is there any way to find this info with a SQL statement ?

CREATE TABLE chapter
(....
chapter_path integer[],
.....)

My chapter path are like that {x,y,z} {x,y} {x}

How with a SQL statement can I get 3 corresponding to {x,y,z} integer array size ?

Upvotes: 1

Views: 4174

Answers (1)

Frank Heikens
Frank Heikens

Reputation: 127136

Use array_upper().

Upvotes: 4

Related Questions