Skip site navigation (1) Skip section navigation (2)

Re: help using arrays in a function

From: Joe Conway <mail(at)joeconway(dot)com>
To: Jennifer Lee <jlee(at)scri(dot)sari(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: help using arrays in a function
Date: 2004-02-26 21:20:00
Message-ID: 403E6300.6090908@joeconway.com (view raw or flat)
Thread:
Lists: pgsql-general
Jennifer Lee wrote:
>            WHILE a[i] LOOP

This problem has nothing to do with arrays, per se. PL/pgSQL no longer 
assumes it can coerce an integer constant to a boolean. Instead make the 
above line look like this:

              WHILE a[i] IS NOT NULL LOOP


BTW, in 7.4 you could more easily get the same result like this:

regression=# select 82 = any ('{100,92,82}');
  ?column?
----------
  t
(1 row)

regression=# select 82 = any ('{100,92}');
  ?column?
----------
  f
(1 row)

See:
http://www.postgresql.org/docs/current/static/functions-comparisons.html

HTH,

Joe

In response to

pgsql-general by date

Next:From: Keith BottnerDate: 2004-02-26 21:22:02
Subject: Re: Postgres clustering?
Previous:From: scott.marloweDate: 2004-02-26 21:10:17
Subject: Re: Postmasters pile up

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group