Re: psql describe.c cleanup - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: psql describe.c cleanup
Date
Msg-id BANLkTi=PyZZELx+RtJhc26v_U8yPoCvh1w@mail.gmail.com
Whole thread Raw
In response to psql describe.c cleanup  (Josh Kupershmidt <schmiddy@gmail.com>)
Responses Re: psql describe.c cleanup
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: [WIP] cache estimates, cache access cost
Next
From: "David E. Wheeler"
Date:
Subject: Re: ITYM DROP TABLE