Search Postgresql Archives

Checking empty array

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

 



Dear all,

What is the correct way to check whether an array is empty?
I have an array which I initialize with '{}' and then do som array_append
under some circonstances. I would like to know whether the array is empty at
the end of the function. I have not found the answer in the help page nor on
the web. I use the keyword isnull but that does not seem to work in all the
cases.
I would appreciate if someone could put this piece of information into the
Postgres documentation.

Here is what I do, in pseudo-code:

myarray varchar[];
myarray :=   '{}';

FOR ___ LOOP
 IF (___) THEN 
    myarray := array_append(myarray, somestuff);
 END IF;
END LOOP;

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

Regards,
Alexis Beuraud


---------------------------(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