From: | Gaetano Mendola <mendola(at)bigfoot(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Calculated view fields (8.1 != 8.2) |
Date: | 2007-03-06 15:48:19 |
Message-ID: | 45ED8D43.5050006@bigfoot.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF7Y1D7UpzwH2SGd4RAv//AJ0dcDPyYIndVMs7pEhzXjVNwKqdLQCeJQnL
oaZVL2JgS/J9lPf+B80+FuY=
=qaCE
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2007-03-06 16:07:35 | Re: GIST and TOAST |
Previous Message | Jim Nasby | 2007-03-06 15:39:06 | Re: Log levels for checkpoint/bgwriter monitoring |