pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Marco Kaerger <m.kaerger@vitrado.de>
Cc: PostgreSQL Mailing List <pgsql-admin@postgresql.org>
Subject: Re: array[10]
Date: Tue, 12 Aug 2003 10:58:38 -0700
Message-ID: <3F392ACE.1020201@joeconway.com> (raw)
In-Reply-To: <1060709405.1478.19.camel@vitrado-002>
References: <1060709405.1478.19.camel@vitrado-002>

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




view thread (2+ messages)

Message-ID: <3F392ACE.1020201@joeconway.com>
Permalink:  ../3F392ACE.1020201@joeconway.com/
Also on:    postgresql.org/message-id/3F392ACE.1020201@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, m.kaerger@vitrado.de
  Subject: Re: array[10]
  In-Reply-To: <3F392ACE.1020201@joeconway.com>
  References: <1060709405.1478.19.camel@vitrado-002> <3F392ACE.1020201@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox