-
-
Save eMerzh/e93792540cb3a68054c9 to your computer and use it in GitHub Desktop.
Potsgresql Immutable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION test_immutable( a int ) | |
RETURNS varchar | |
LANGUAGE plpgsql | |
IMMUTABLE | |
AS $function$ | |
BEGIN | |
raise notice 'plouf'; | |
return 'toto'; | |
END | |
$function$ | |
; | |
CREATE TABLE test (a varchar); | |
INSERT INTO test values ('a') ; | |
INSERT INTO test values ('a') ; | |
INSERT INTO test values ('a') ; | |
INSERT INTO test values ('a') ; | |
PREPARE test (int) as select * from test | |
where a = test_immutable($1); | |
EXECUTE test(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment