Re: infinite recursion detected in rules for relation

Поиск
Список
Период
Сортировка
От John McKown
Тема Re: infinite recursion detected in rules for relation
Дата
Msg-id CAAJSdjjP0o5Er8Jf2Bj6NhdkwM4r3Y7_+n8NvcyrzSoHDGwUdg@mail.gmail.com
обсуждение исходный текст
Ответ на infinite recursion detected in rules for relation  (pinker <pinker@onet.eu>)
Ответы Re: infinite recursion detected in rules for relation  (pinker <pinker@onet.eu>)
Список pgsql-general
On Thu, Feb 12, 2015 at 10:48 AM, pinker <pinker@onet.eu> wrote:
I wanted to set a rule:
CREATE RULE "_RETURN" AS   ON SELECT * from backend.test   DO INSTEAD       SELECT * FROM backend.test WHERE who='Me';
When I'm trying to do anything on the table I get following error:
ERROR:  infinite recursion detected in rules for relation "backend.test"

********** Błąd **********

ERROR: infinite recursion detected in rules for relation "backend.test"
Stan SQL: 42P17
Is there any way to avoid that? Maybe there exist some other approaches that could be useful ?

​I'm not totally sure why you want to do the above. If I needed such a thing and "backend.test" already exists, I would rename "backend.test" to something like "backend.test__x" and then create a view like:

CREATE VIEW backend.test AS
SELECT * FROM bachend.test__x WHERE who='Me'
WITH CHECK OPTION.

The WITH CHECK OPTION will stop people from doing a INSERT or UPDATE which did not have "who" equal to 'Me'. I don't know if you would need this.

I would then GRANT appropriate authority to the VIEW and remove it from "backend.test__x"​.

 

--
He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

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

Предыдущее
От: pinker
Дата:
Сообщение: infinite recursion detected in rules for relation
Следующее
От: David G Johnston
Дата:
Сообщение: Re: infinite recursion detected in rules for relation