Search Postgresql Archives

Referencing uninitialized variables in plpgsql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've a plpgsql procedure I'm pretty sure is referencing
variables, array elements really, that have not been
initialized.  Is this a well defined operation?
If so, what is the result? (NULL?) If not, shouldn't I be
getting some sort of error or warning?

I've
SET client_min_messages='debug';
and don't seem to get any messages.  AFICT there is no
run time configuration that would affect this, right?

The documentation seems silent on uninitialized plpgsql
variables.  Be nice if something was written.

I don't care for code that references unititialized variables.
It'd be nice to be able to get a warning even if the result
was well defined, just for those cases where you don't intend
to reference uninitialized variables.

Is this example telling me I get NULL for unitialized references?
I don't believe I should count on this behavior unless it's
documented, should I?

=> create or replace function foo() returns int language plpgsql
as 'declare a int; b int; begin a := b; return a; end; ';
CREATE FUNCTION
=> select foo();
foo
-----

(1 row)


PostgreSQL 7.4.6 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-42)


Thanks for all the postgresql work. I don't mean to sound grumpy, I'm tired.

Karl <kop@xxxxxxxx>
Free Software:  "You don't pay back, you pay forward."
                -- Robert A. Heinlein



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux