>>>>> "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)