pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
array[10]
2+ messages / 2 participants
[nested] [flat]

* array[10]
@ 2003-08-12 17:30  Marco Kaerger <m.kaerger@vitrado.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Marco Kaerger @ 2003-08-12 17:30 UTC (permalink / raw)
  To: pgsql-admin

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!

Attachments:

  signature.asc (application/pgp-signature, 188B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: array[10]
@ 2003-08-12 17:58  Joe Conway <mail@joeconway.com>
  parent: Marco Kaerger <m.kaerger@vitrado.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Joe Conway @ 2003-08-12 17:58 UTC (permalink / raw)
  To: Marco Kaerger <m.kaerger@vitrado.de>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-08-12 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-12 17:30 array[10] Marco Kaerger <m.kaerger@vitrado.de>
2003-08-12 17:58 ` Joe Conway <mail@joeconway.com>

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