SELECT UNNEST(ARRAY[1,2,3,4])
While executing the above query I got the error like this:
ERROR: function unnest(integer[]) does not exist in postgresql.
I am using PostgreSQL 8.3 and I have installed the _int.sql package in my db for integer array operation.
How to resolve this error?
unnest()is not part of the moduleintarray, but of standard PostgreSQL. However, you need Postgres 8.4 or later for that.So you can resolve this by upgrading to a more recent version. See the versioning policy of the PostgreSQL project.
Here's a poor man's
unnest()for Postgres 8.4:Only works for one-dimensional arrays - as opposed to modern
unnest()which also takes accepts multiple dimensions:You could implement more functions for n-dimensional arrays:
Call:
You could also write a PL/pgSQL function that deals with multiple dimensions ...