stable function called for every row?

Поиск
Список
Период
Сортировка
От Gerhard Heift
Тема stable function called for every row?
Дата
Msg-id 20090107183113.GB21538@kawo1.rwth-aachen.de
обсуждение исходный текст
Ответы Re: stable function called for every row?
Re: stable function called for every row?
Список 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

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: FreeBSD and large shared_buffers a no-go?
Следующее
От: Kirk Strauser
Дата:
Сообщение: Re: FreeBSD and large shared_buffers a no-go?