Re: Checking empty array

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Checking empty array
Дата
Msg-id 4727082B.6080405@archonet.com
обсуждение исходный текст
Ответ на Checking empty array  (Alexis Beuraud <alexis@siatel.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Alexis Beuraud
Дата:
Сообщение: Checking empty array
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Selecting K random rows - efficiently!