Hi all,

I'm observing this behavior in 8.2:

kalman=# create table test ( a integer, b integer );

CREATE TABLE

kalman=#

kalman=# CREATE OR REPLACE FUNCTION sp_test ( INTEGER )

kalman-# RETURNS INTEGER AS'

kalman'# DECLARE

kalman'# a_id_contract ALIAS FOR $1;

kalman'# BEGIN

kalman'# RAISE NOTICE ''here'';

kalman'#

kalman'# return 3;

kalman'# END;

kalman'# ' LANGUAGE 'plpgsql';

CREATE FUNCTION

kalman=#

kalman=#

kalman=# CREATE OR REPLACE VIEW v_test AS

kalman-# SELECT

kalman-# a AS a,

kalman-# sp_test(b) AS b

kalman-# FROM

kalman-# test c

kalman-# ;

CREATE VIEW

kalman=#

kalman=# insert into test values (2,3);

INSERT 0 1

kalman=#

kalman=# select * from v_test;

NOTICE: here

a | b

- ---+---

2 | 3

(1 row)

kalman=# select a from v_test;

NOTICE: here

a

- ---

2

(1 row)

In version 8.1 the function sp_test is not evaluated in case of "select a from v_test".

If I mark the function as STABLE or IMMUTABLE then even with version 8.2 the function

is not evaluated. Is this the intended behavior? I didn't see something about it in

the release note.

Regards

Gaetano Mendola