pg_get_ruledef and extra line breaks

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_get_ruledef and extra line breaks
Date: 2003-09-29 04:35:02
Message-ID: 20030929123128.D37484-100000@houston.familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2003-09-29 04:39:56 Re: 2-phase commit
Previous Message Tom Lane 2003-09-29 04:28:47 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)