"plan should not reference subplan's variable" when using row level security

Поиск
Список
Период
Сортировка
От Adam Guthrie
Тема "plan should not reference subplan's variable" when using row level security
Дата
Msg-id CAC3DOVy2H7W5bGeVaJjq5XtKvxGNKiPkG_SjXNOqXYLB5ccFBA@mail.gmail.com
обсуждение исходный текст
Ответы Re: "plan should not reference subplan's variable" when using row level security  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: "plan should not reference subplan's variable" when using row level security  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-general
Hi,

Whilst trying to use row level security with a subquery in the USING
expression, I'm receiving an error "plan should not reference
subplan's variable"

A simple sql file to reproduce:

****

CREATE TABLE a (
    id      INTEGER PRIMARY KEY
);

CREATE TABLE b (
    id      INTEGER PRIMARY KEY,
    a_id    INTEGER,
    text    TEXT
);

CREATE POLICY a_select ON b FOR SELECT
    USING ( EXISTS(SELECT FROM a WHERE a.id = b.a_id) );

ALTER TABLE b ENABLE ROW LEVEL SECURITY;

INSERT INTO a (id) VALUES (1);

INSERT INTO b (id, a_id, text) VALUES (1, 1, 'one');

GRANT ALL ON ALL TABLES IN SCHEMA public TO test;

SET ROLE test;

SELECT * FROM b;

UPDATE b SET text = 'ONE' WHERE id = 1;

****

gives error:

psql:/tmp/test.sql:26: ERROR:  plan should not reference subplan's variable

Is this a bug or am I doing something wrong?

Any help much appreciated,

Adam


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

Предыдущее
От: Paul Jungwirth
Дата:
Сообщение: Re: Ubuntu and Rails postgresql setup
Следующее
От: Paul Jungwirth
Дата:
Сообщение: Re: Ubuntu and Rails postgresql setup