Re: WIP: pg_pretty_query
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <peter@2ndquadrant.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Bruce Momjian <bruce@momjian.us>, Pavel Stehule <pavel.stehule@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2012-08-07T21:11:17Z
Lists: pgsql-hackers
Peter Geoghegan <peter@2ndquadrant.com> writes: > On 7 August 2012 20:01, Andrew Dunstan <andrew@dunslane.net> wrote: >> One of the challenges is to have a pretty printer that is kept in sync with >> the dialect that's supported. Anything that doesn't use the backend's parser >> seems to me to be guaranteed to get out of sync very quickly. > I'm not convinced of that. Consider the example of cscope, a popular > tool for browsing C code. Its parser was written to be "fuzzy", so > it's actually perfectly usable for C++ and Java, even though that > isn't actually supported, IIRC. Now, I'll grant you that that isn't a > perfectly analogous situation, but it is similar in some ways. Yeah. A related question here is whether you want a pretty printer that is entirely unforgiving of (what it thinks are) syntax errors in the input. It might be a lot more useful if it didn't spit up on that, but just did the best it could. regards, tom lane