From: | Gaetano Mendola <mendola(at)bigfoot(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Stable functions problem |
Date: | 2004-12-19 15:35:01 |
Message-ID: | cq4758$88$1@floppy.pyrenet.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
after several weeks away I downloaded today the 8.0rc1 and I
tested it with our application.
I'm having a bounce of errors because IMMUTABLE and STABLE
attributes for some of my functions. Let me explain with an example,
what I do is ( plpgsql )
my_id_user = sp_id_user( a_login );
IF my_id_user > 0 THEN
RETURN -5; -- error code for existing user
END IF;
INSERT INTO users ( login ) VALUES ( a_login );
my_id_user = sp_id_user( a_login );
now here I can continue my function using the my_id_user, unfortunatelly
that sp_id_user is declared as IMMUTABLE this mean that at the second call
of sp_id_user my_id_user will not contain the user id.
This was working untill 7.4, is there a way to force sp_id_user to
be reevaluated ? That function is declared immutable because is ofthen
used in expresssion like this:
select * from user_data where id_user = sp_id_user('login');
I believe is a good idea write in the release notes, with a bigger font, this
optimization about stable and immutable functions.
Regards
Gaetano Mendola
From | Date | Subject | |
---|---|---|---|
Next Message | Martha Chronopoulou | 2004-12-19 15:39:43 | Bitmapset data type??? |
Previous Message | Alvaro Herrera | 2004-12-19 14:35:21 | Re: Help extending pg_class |