X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E12DDD1B524 for ; Tue, 12 Aug 2003 18:03:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 93130-07 for ; Tue, 12 Aug 2003 15:01:55 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 1A3D1D1C4CA for ; Tue, 12 Aug 2003 15:03:17 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 29725; Tue, 12 Aug 2003 10:22:27 -0700 Message-ID: <3F392ACE.1020201@joeconway.com> Date: Tue, 12 Aug 2003 10:58:38 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marco Kaerger Cc: PostgreSQL Mailing List Subject: Re: array[10] References: <1060709405.1478.19.camel@vitrado-002> In-Reply-To: <1060709405.1478.19.camel@vitrado-002> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/152 X-Sequence-Number: 9874 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