View options (as in "security_barrier") break pg_dump

Поиск
Список
Период
Сортировка
От Tom Lane
Тема View options (as in "security_barrier") break pg_dump
Дата
Msg-id 13980.1344720184@sss.pgh.pa.us
обсуждение исходный текст
Список pgsql-hackers
CREATE OR REPLACE VIEW makes it possible to create views that have
circular dependencies, for instance:

regression=# create table tt(f1 int, f2 int);
CREATE TABLE
regression=# create view v1 as select * from tt;
CREATE VIEW
regression=# create view v2 as select * from v1;
CREATE VIEW
regression=# create or replace view v1 with (security_barrier = true) as select * from v2;

Now try to pg_dump this.  What you will get is

CREATE TABLE v1 (   f1 integer,   f2 integer
)
WITH (security_barrier=true);

CREATE VIEW v2 AS   SELECT v1.f1, v1.f2 FROM v1;

CREATE RULE "_RETURN" AS ON SELECT TO v1 DO INSTEAD SELECT v2.f1, v2.f2 FROM v2;

and of course that will fail to reload:
ERROR:  unrecognized parameter "security_barrier"

pg_dump is doing its best to deal with the circularity by breaking the
definition of v1 into two parts, but we have not given it syntax that
will work for that when the view has options.

You might argue that the above example is useless, which it is, but
less-useless examples of circular dependencies can be contrived.
This is just an easy example to show the problem.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: error handling in logging hooks
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: New statistics for WAL buffer dirty writes