Re: "CREATE RULE ... ON SELECT": redundant?

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: "CREATE RULE ... ON SELECT": redundant?
Дата
Msg-id 87o7n0bpvh.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: "CREATE RULE ... ON SELECT": redundant?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: "CREATE RULE ... ON SELECT": redundant?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

 Tom> Now, this is certainly syntax that's deprecated in favor of using
 Tom> CREATE OR REPLACE VIEW, but I'm very hesitant to remove it. ISTR
 Tom> that ancient pg_dump files used it in cases involving circular
 Tom> dependencies.

I thought they used CREATE RULE on a table?

In fact here is an example from a pg 9.5 pg_dump output (with cruft
removed):

CREATE TABLE public.cdep (
    a integer,
    b text
);
CREATE FUNCTION public.cdep_impl() RETURNS SETOF public.cdep
    LANGUAGE plpgsql
    AS $$ begin return query select a,b from (values (1,'foo'),(2,'bar')) v(a,b); end; $$;
CREATE RULE "_RETURN" AS
    ON SELECT TO public.cdep DO INSTEAD  SELECT cdep_impl.a,
    cdep_impl.b
   FROM public.cdep_impl() cdep_impl(a, b);

and this now fails to restore:

psql:t1.sql:68: ERROR:  relation "cdep" cannot have ON SELECT rules
DETAIL:  This operation is not supported for tables.

-- 
Andrew (irc:RhodiumToad)



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

Предыдущее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Re: Add two missing tests in 035_standby_logical_decoding.pl
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: "CREATE RULE ... ON SELECT": redundant?