Re: psql describe.c cleanup
Merlin Moncure <mmoncure@gmail.com>
From: Merlin Moncure <mmoncure@gmail.com>
To: Josh Kupershmidt <schmiddy@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-06-14T16:15:54Z
Lists: pgsql-hackers
Attachments
- psql_describe.v3.patch (application/octet-stream)
On Sat, May 7, 2011 at 2:40 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote: > Hi all, > > I use psql's -E mode every now and then, copy-and-pasting and further > tweaking the SQL displayed. Most queries are displayed terminated by a > semicolon, but quite a few aren't, making copy-and-paste just a bit > more tedious. > > Attached is a patch to fix every SQL query I saw in describe.c. There > were also a few queries with trailing newlines, and I fixed those too. I did a quick review and test of your patch. It didn't quite apply cleanly due to recent non-related describe.c changes -- updated patch attached. First, I'll give you a thumbs up on the original inspiration for the patch. The output should be standardized, and I see no reason not to append a semicolon on usability basis. Beyond that, the changes are mostly cosmetic and I can't see how it will break things outside of terminating a query early by accident (I didn't see any). What I do wonder though is if the ; appending should really be happening in printQuery() instead of in each query -- the idea being that formatting for external consumption should be happening in one place. Maybe that's over-thinking it though. merlin