Hi,

I notice that the pretty printing version of pg_get_ruledef inserts extra
newlines whereas all the others pretty functions (except view defs) do
not.  In fact, Andreas argued against a version of pg_get_triggerdef()
that added extra newlines.

eg, non-pretty:

test=# select pg_get_ruledef(oid) from pg_rewrite order by oid desc limit
8;;
                                                 pg_get_ruledef
-----------------------------------------------------------------------------------------------------------------
 CREATE RULE r5 AS ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r4 AS ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r3 AS ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r2 AS ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r1 AS ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE "_RETURN" AS ON SELECT TO v DO INSTEAD SELECT 1;
 CREATE RULE asdfx AS ON INSERT TO test WHERE ((((1 = 1) OR (1 = 2)) OR (1
= 3)) OR (1 = 5)) DO INSTEAD NOTHING;
 CREATE RULE asdf AS ON INSERT TO test WHERE ((((1 = 1) OR (1 = 2)) OR (1
= 3)) OR (1 = 5)) DO INSTEAD NOTHING;
(8 rows)

eg, pretty:

test=# select pg_get_ruledef(oid, true) from pg_rewrite order by oid desc
limit 8;;
                                              pg_get_ruledef
----------------------------------------------------------------------------------------------------------
 CREATE RULE r5 AS
    ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r4 AS
    ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r3 AS
    ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r2 AS
    ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE r1 AS
    ON INSERT TO v DO INSTEAD NOTHING;
 CREATE RULE "_RETURN" AS
    ON SELECT TO v DO INSTEAD  SELECT 1;
 CREATE RULE asdfx AS
    ON INSERT TO test
   WHERE 1 = 1 OR 1 = 2 OR 1 = 3 OR 1 = 5 DO INSTEAD NOTHING;
 CREATE RULE asdf AS
    ON INSERT TO test
   WHERE 1 = 1 OR 1 = 2 OR 1 = 3 OR 1 = 5 DO INSTEAD NOTHING;
(8 rows)


Are those newlines really necessary?  They seem a bit out of place?

Chris



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to