From: | Gerhard Heift <ml-postgresql-20081012-3518(at)gheift(dot)de> |
---|---|
To: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | stable function called for every row? |
Date: | 2009-01-07 18:31:13 |
Message-ID: | 20090107183113.GB21538@kawo1.rwth-aachen.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have a query like this:
SELECT * FROM table WHERE has_permission('permission_name');
and the function
CREATE FUNCTION has_permission(IN pname text, OUT is_ok boolean) RETURNING boolean AS
$BODY$
BEGIN
SELECT has_perm INTO is_ok FROM permission WHERE title = pname;
RAISE INFO 'function called';
IF is_ok IS FALSE THEN
-- this function is VOLATILE
PERFORM log.exception('permission denied');
END IF;
RETURN;
END
$BODY$ LANGUAGE 'plpgsql' STABLE SECURITY DEFINER;
The function is called for every row in the table if it is stable or
volatile and only once if it is immutable?
I thought it had to be called only once, if it is stable.
(PostgreSQL 8.3.5)
Regards,
Gerhard
From | Date | Subject | |
---|---|---|---|
Next Message | Kirk Strauser | 2009-01-07 18:57:56 | Re: FreeBSD and large shared_buffers a no-go? |
Previous Message | Tom Lane | 2009-01-07 18:30:43 | Re: FreeBSD and large shared_buffers a no-go? |