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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

  From Date Subject
Next Message Keith Bottner 2004-02-26 21:22:02 Re: Postgres clustering?
Previous Message scott.marlowe 2004-02-26 21:10:17 Re: Postmasters pile up