Search Postgresql Archives

Re: Checking empty array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexis Beuraud wrote:
Dear all,

What is the correct way to check whether an array is empty?

-- Is my array empty now?
IF (myarray isnull) THEN

An empty array isn't null (unknown), it's empty.

Try enquiring about it's size:
SELECT array_dims('{}'::integer[]) is null;
 ?column?
----------
 t

You could use array_lower/upper instead too.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux