pg_get_ruledef and extra line breaks - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject pg_get_ruledef and extra line breaks
Date
Msg-id 20030929123128.D37484-100000@houston.familyhealth.com.au
Whole thread Raw
Responses Re: pg_get_ruledef and extra line breaks
List pgsql-hackers
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
RULEr5 AS ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r4 AS ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r3 AS ON
INSERTTO v DO INSTEAD NOTHING;CREATE RULE r2 AS ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r1 AS ON INSERT TO v DO
INSTEADNOTHING;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
r5AS   ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r4 AS   ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r3 AS   ON
INSERTTO v DO INSTEAD NOTHING;CREATE RULE r2 AS   ON INSERT TO v DO INSTEAD NOTHING;CREATE RULE r1 AS   ON INSERT TO v
DOINSTEAD 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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)
Next
From: Hiroshi Inoue
Date:
Subject: Re: 2-phase commit