Re: Referencing uninitialized variables in plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Referencing uninitialized variables in plpgsql
Date: 2005-02-06 18:18:25
Message-ID: 5349.1107713905@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Karl O. Pinc" <kop(at)meme(dot)com> writes:
> AFICT, the docs arn't clear when it comes to referencing unitialized
> array elements. I assume you get NULL values here as well even
> though other array elements may have been given non-NULL values.

There is no such thing as an uninitialized array element.

Looking at array_ref, we do return a NULL if you try to fetch from a
position outside the current array subscript range. But that's not
"uninitialized" in any normal sense of the word, it's more like
"nonexistent". (I think you're right that it's undocumented behavior,
too.)

> Can I count on this?

Until someone makes an argument to change it ;-).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karl O. Pinc 2005-02-06 18:18:54 Re: Referencing uninitialized variables in plpgsql
Previous Message Christopher Browne 2005-02-06 18:13:24 Re: Questions about functionality