Re: array[10]

From: Joe Conway <mail(at)joeconway(dot)com>
To: Marco Kaerger <m(dot)kaerger(at)vitrado(dot)de>
Cc: PostgreSQL Mailing List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: array[10]
Date: 2003-08-12 17:58:38
Message-ID: 3F392ACE.1020201@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

  • array[10] at 2003-08-12 17:30:04 from Marco Kaerger

Browse pgsql-admin by date

  From Date Subject
Next Message Andriuskevicius 2003-08-13 10:47:09 Problems after upgrade postgresql 7.2.1 -> 7.34
Previous Message Murthy Kambhampaty 2003-08-12 17:37:37 Re: Backup routine