Обсуждение: array[10]

Поиск
Список
Период
Сортировка

array[10]

От
Marco Kaerger
Дата:
hi there,

i have got a problem concerning arrays in postgres
i created a function in which i want to know if the index 8 of var_array
ist not NULL:

IF var_array[8] IS NOT NULL

    THEN

    (query)

    END IF;


then i call the function and the query is submitted, allthough
var_array[8] is 'NULL'



any solutions for that problem?

thanx!

Вложения

Re: array[10]

От
Joe Conway
Дата:
Marco Kaerger wrote:
> hi there,
>
> i have got a problem concerning arrays in postgres
> i created a function in which i want to know if the index 8 of var_array
> ist not NULL:
>
> IF var_array[8] IS NOT NULL
>
>     THEN
>
>     (query)
>
>     END IF;
>
>
> then i call the function and the query is submitted, allthough
> var_array[8] is 'NULL'
>

 From your question it appears that you think 'NULL' (with single
quotes) and NULL (without single quotes) are the same thing -- they are
not. The string literal 'NULL' is nothing more than a four letter
string. NULL, on the other hand, is a special value meaning that the
data is unknown.

Currently Postgres does not even support NULL elements in arrays,
although if you test for a non-existing subscript the result is NULL.

Why don't you give us a complete (i.e. the entire function) example of
what you are trying to do, along with the specific query you believe
gives the wrong result, and then maybe we can be of more help.

Joe