public inbox for [email protected]help / color / mirror / Atom feed
SQL formatting in docs 4+ messages / 2 participants [nested] [flat]
* SQL formatting in docs @ 2009-04-05 18:34 David Niergarth <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: David Niergarth @ 2009-04-05 18:34 UTC (permalink / raw) To: pgsql-docs Hopefully not a naive question... How are all the queries in the postgres docs formatted? They're all very consistent and nice pretty printed, especially complex queries. How can I do the same? --David ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: SQL formatting in docs @ 2009-04-05 20:20 David Niergarth <[email protected]> parent: David Niergarth <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: David Niergarth @ 2009-04-05 20:20 UTC (permalink / raw) To: pgsql-docs David Niergarth wrote: > Hopefully not a naive question... How are all the queries in the > postgres docs formatted? They're all very consistent and nice pretty > printed, especially complex queries. How can I do the same? As an non-trivial example of what I mean, here's a query from Chapter 36: The Rule System. Is there an automated way to format/prettyprint queries like this? SELECT shoe_ready.shoename, shoe_ready.sh_avail, shoe_ready.sl_name, shoe_ready.sl_avail, shoe_ready.total_avail FROM (SELECT rsh.shoename, rsh.sh_avail, rsl.sl_name, rsl.sl_avail, min(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM (SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen, sh.slminlen * un.un_fact AS slminlen_cm, sh.slmaxlen, sh.slmaxlen * un.un_fact AS slmaxlen_cm, sh.slunit FROM shoe_data sh, unit un WHERE sh.slunit = un.un_name) rsh, (SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, s.sl_len * u.un_fact AS sl_len_cm FROM shoelace_data s, unit u WHERE s.sl_unit = u.un_name) rsl WHERE rsl.sl_color = rsh.slcolor AND rsl.sl_len_cm >= rsh.slminlen_cm AND rsl.sl_len_cm <= rsh.slmaxlen_cm) shoe_ready WHERE shoe_ready.total_avail > 2; Thanks, --David ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: SQL formatting in docs @ 2009-04-05 20:37 Tom Lane <[email protected]> parent: David Niergarth <[email protected]> 1 sibling, 1 reply; 4+ messages in thread From: Tom Lane @ 2009-04-05 20:37 UTC (permalink / raw) To: David Niergarth <[email protected]>; +Cc: pgsql-docs David Niergarth <[email protected]> writes: > Hopefully not a naive question... How are all the queries in the > postgres docs formatted? They're all very consistent and nice pretty > printed, especially complex queries. How can I do the same? I'm afraid they're all laid out by hand :-( regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: SQL formatting in docs @ 2009-04-05 20:41 David Niergarth <[email protected]> parent: Tom Lane <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: David Niergarth @ 2009-04-05 20:41 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-docs Thanks for settling that for me; I've always wondered about it! --David Tom Lane wrote: > David Niergarth <[email protected]> writes: >> Hopefully not a naive question... How are all the queries in the >> postgres docs formatted? They're all very consistent and nice pretty >> printed, especially complex queries. How can I do the same? > > I'm afraid they're all laid out by hand :-( > > regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2009-04-05 20:41 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2009-04-05 18:34 SQL formatting in docs David Niergarth <[email protected]> 2009-04-05 20:20 ` David Niergarth <[email protected]> 2009-04-05 20:37 ` Tom Lane <[email protected]> 2009-04-05 20:41 ` David Niergarth <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox