From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Adding \ev view editor? |
Date: | 2009-09-21 18:26:05 |
Message-ID: | 4AB7C53D.7080002@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> It might be worth pointing out that what I don't want pg_dump doing
> is suppressing "useless" parentheses. Adding whitespace ought to be
> safe enough. So if anyone wanted to do the work of decoupling those
> two effects of the prettyprint option, we could have "semi pretty
> printed" output in pg_dump. Dunno if it's worth it.
>
>
>
The attached patch goes part of the way towards doing this, by adding
white space unconditionally to the target list of a viewdef.
The nice thing about that is that it's the part of a viewdef which
basically isn't pretty-printed now, even if you ask for pretty printing.
That would certainly
make editing the view with a \ev command a lot nicer.
Along the way it suppresses putting a newline before a CASE expression
in pretty printing mode, which seems to be an odd thing to do and is
inconsistent with the way other expressions are treated.
Sample output:
andrew=# select pg_get_viewdef('foo',true);
pg_get_viewdef
------------------------------
SELECT 'a'::text AS b,
( SELECT 1
FROM dual) AS x,
random() AS y,
CASE
WHEN true THEN 1
ELSE 0
END AS c,
1 AS d
FROM dual;
(1 row)
cheers
andrew
Attachment | Content-Type | Size |
---|---|---|
prettyprint2.patch | text/x-patch | 2.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-09-21 19:03:24 | Re: Adding \ev view editor? |
Previous Message | Tom Lane | 2009-09-21 18:24:07 | Re: Standalone backends run StartupXLOG in an incorrect environment |