Re: proposal: alternative psql commands quit and exit

2018-02-13 Thread Ivan E. Panchenko
14.02.2018 09:17, Bruce Momjian пишет: On Wed, Feb 14, 2018 at 03:07:46PM +0900, Michael Paquier wrote: On Wed, Feb 14, 2018 at 12:56:48AM -0500, Bruce Momjian wrote: On Mon, Feb 12, 2018 at 01:28:53AM -0500, Bruce Momjian wrote: Should we give the same "Use control-D to quit." hint here for

Re: proposal: alternative psql commands quit and exit

2018-02-13 Thread Bruce Momjian
On Wed, Feb 14, 2018 at 03:07:46PM +0900, Michael Paquier wrote: > On Wed, Feb 14, 2018 at 12:56:48AM -0500, Bruce Momjian wrote: > > On Mon, Feb 12, 2018 at 01:28:53AM -0500, Bruce Momjian wrote: > > > > Should we give the same "Use control-D to quit." hint here for '\q'? > > > > I think it is log

Re: proposal: alternative psql commands quit and exit

2018-02-13 Thread Michael Paquier
On Wed, Feb 14, 2018 at 12:56:48AM -0500, Bruce Momjian wrote: > On Mon, Feb 12, 2018 at 01:28:53AM -0500, Bruce Momjian wrote: > > > Should we give the same "Use control-D to quit." hint here for '\q'? > > > I think it is logical that we should. > > > > I have applied the attached patch giving a

Re: proposal: alternative psql commands quit and exit

2018-02-13 Thread Bruce Momjian
On Mon, Feb 12, 2018 at 01:28:53AM -0500, Bruce Momjian wrote: > > Should we give the same "Use control-D to quit." hint here for '\q'? > > I think it is logical that we should. > > I have applied the attached patch giving a ^D/^C hint where \q is > ignored, and add C comment documenting why exit/

Re: proposal: alternative psql commands quit and exit

2018-02-11 Thread Bruce Momjian
On Fri, Feb 2, 2018 at 12:39:28AM -0500, Bruce Momjian wrote: > I just thought of an inconsistency. First, we now consistently exit with > 'exit', 'quit', and '\q' if used in an empty psql query buffer. Also, we now > hint when 'exit' and 'quit' are used in non-empty query buffers: > > te

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
I just thought of an inconsistency. First, we now consistently exit with 'exit', 'quit', and '\q' if used in an empty psql query buffer. Also, we now hint when 'exit' and 'quit' are used in non-empty query buffers: test=> SELECT test-> exit --> Use \q to quit. We obviously d

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
On Thu, Feb 1, 2018 at 07:47:14AM -0500, Bruce Momjian wrote: > > There's also the issue that, in general, communicating different hints > > and advice depending on the host operating system is not ideal. > > Because people ask "how do I do such and such in psql?", > > they do not ask "how do I do

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Daniel Verite
Bruce Momjian wrote: > > Also, the fact that Control-D can quit in the middle of a > > multiline query without any confirmation is a usability problem, because > > you can always fat-finger a Ctrl+key. By comparison, bash doesn't > > accept it and emits the same error as if a script was i

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
On Thu, Feb 1, 2018 at 12:01:37PM +0100, Daniel Verite wrote: > Also, the fact that Control-D can quit in the middle of a > multiline query without any confirmation is a usability problem, because > you can always fat-finger a Ctrl+key. By comparison, bash doesn't > accept it and emits the same er

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
On Wed, Jan 31, 2018 at 05:51:51PM -0500, Bruce Momjian wrote: > On Sun, Jan 28, 2018 at 06:35:06PM -0500, Bruce Momjian wrote: > > I used Robert's patch and modified it to match the ideas I had above. > > Specifically no white space can be before 'help', 'exit' or 'quit' and > > prompt_status is u

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
On Thu, Feb 1, 2018 at 12:01:37PM +0100, Daniel Verite wrote: > Bruce Momjian wrote: > > > One open issue is the existing help display is inaccurate on Windows: > > > > Use \\? for help or press control-C to clear the input buffer. > > ! #ifndef WIN32 > ! puts(_("Use control-D t

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Bruce Momjian
On Thu, Feb 1, 2018 at 12:01:37PM +0100, Daniel Verite wrote: > Bruce Momjian wrote: > > > One open issue is the existing help display is inaccurate on Windows: > > > > Use \\? for help or press control-C to clear the input buffer. > > ! #ifndef WIN32 > ! puts(_("Use control-D t

Re: proposal: alternative psql commands quit and exit

2018-02-01 Thread Daniel Verite
Bruce Momjian wrote: > One open issue is the existing help display is inaccurate on Windows: > > Use \\? for help or press control-C to clear the input buffer. ! #ifndef WIN32 ! puts(_("Use control-D to quit.")); ! #else ! puts(_("Use control-C to quit.")); ! #endif But Cont

Re: proposal: alternative psql commands quit and exit

2018-01-31 Thread Bruce Momjian
On Sun, Jan 28, 2018 at 06:35:06PM -0500, Bruce Momjian wrote: > I used Robert's patch and modified it to match the ideas I had above. > Specifically no white space can be before 'help', 'exit' or 'quit' and > prompt_status is used to adjust the suggestion. Here is the visible > behavior: So what

Re: proposal: alternative psql commands quit and exit

2018-01-28 Thread Bruce Momjian
On Thu, Jan 25, 2018 at 03:46:30PM -0500, Bruce Momjian wrote: > On Mon, Jan 15, 2018 at 11:10:44AM -0500, Robert Haas wrote: > > prompt_status does seem to be available in psql's MainLoop(), so I > > think that could be done, but the problem is that I don't know exactly > > what message would be u

Re: proposal: alternative psql commands quit and exit

2018-01-25 Thread Bruce Momjian
On Mon, Jan 15, 2018 at 11:10:44AM -0500, Robert Haas wrote: > On Mon, Jan 15, 2018 at 10:57 AM, Tom Lane wrote: > > Robert Haas writes: > >> I've discovered one thing about this design that is not so good, which > >> is that if you open a single, double, or dollar quote, then the > >> instructio

Re: proposal: alternative psql commands quit and exit

2018-01-24 Thread Geoff Winkless
On 24 January 2018 at 13:58, Alvaro Herrera wrote: > But there's a simple solution to that: make it two messages, one when > inside quotes ("Use Control-C to clear the input buffer, then \q to > quit") and one outside (current wording). Wasn't this already proposed > elsewhere in the thread? I d

Re: proposal: alternative psql commands quit and exit

2018-01-24 Thread Alvaro Herrera
Vik Fearing wrote: > I haven't applied the patch, but what happens if you combine these? > From your examples, I would imagine something like this: > > test=# select ' > test'# quit > Use \q to quit or press control-C to clear the input buffer. > test'# \q > test'# > > Surely that's not helpful.

Re: proposal: alternative psql commands quit and exit

2018-01-24 Thread Vik Fearing
On 01/24/2018 10:17 AM, KAWAMICHI Ryoji wrote: > test=# select ' > test'# quit > Use \q to quit or press control-C to clear the input buffer. > test'# ' from t; > ?column? > -- > + > quit+ > > (1 row) > test=# select ' > test'# \q > test'# ' from t; > ?column? > ---

Re: proposal: alternative psql commands quit and exit

2018-01-24 Thread KAWAMICHI Ryoji
Hi, > It's not really that complicated. Here's a patch. This follows what > Tom suggested in http://postgr.es/m/30157.1513058...@sss.pgh.pa.us and > what I suggested in > https://www.postgresql.org/message-id/CA%2BTgmoZswp00PtcgPfQ9zbbh7HUTgsLLJ9Z1x9E2s8Y7ep048g%40mail.gmail.com > > I've discov

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Geoff Winkless
On 17 January 2018 at 15:00, I wrote: > Ctrl-C quits immediately for me no matter what input stage I'm at in > Windows' psql. Ctrl-Z (DOS EOF) only quits after enter is pressed and > only at beginning-of-line, so I'd say suggesting the user uses Ctrl-C > in windows makes sense. ^D doesn't appear to

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Geoff Winkless
On 17 Jan 2018 20:12, "Robert Haas" wrote: On Wed, Jan 17, 2018 at 10:00 AM, Geoff Winkless wrote: > On 17 January 2018 at 14:50, Tom Lane wrote: >> (I'm still not very sure which of ^C and ^D have Windows equivalents.) > > Ctrl-C quits immediately for me no matter what input stage I'm at in >

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Robert Haas
On Wed, Jan 17, 2018 at 10:00 AM, Geoff Winkless wrote: > On 17 January 2018 at 14:50, Tom Lane wrote: >> (I'm still not very sure which of ^C and ^D have Windows equivalents.) > > Ctrl-C quits immediately for me no matter what input stage I'm at in > Windows' psql. Does it kill the whole progra

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Geoff Winkless
On 17 January 2018 at 14:50, Tom Lane wrote: > (I'm still not very sure which of ^C and ^D have Windows equivalents.) Ctrl-C quits immediately for me no matter what input stage I'm at in Windows' psql. Ctrl-Z (DOS EOF) only quits after enter is pressed and only at beginning-of-line, so I'd say su

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Tom Lane
Chapman Flack writes: > On 01/17/18 06:50, Geoff Winkless wrote: >> Having said all that, has anyone suggested grabbing and writing out >> using the "stty quit" value? That appears to work whatever level >> you're at, readline-or-not, mid-line or not. It wasn't even something >> I was aware of. >

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Geoff Winkless
On 17 January 2018 at 14:17, Chapman Flack wrote: > Well, the usual use of SIGQUIT is to abort a process while generating > a core dump so it can be post-mortem debugged, and the abort is immediate > without any exit hooks in the process having a chance to execute, so > maybe it isn't a habit we w

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Chapman Flack
On 01/17/18 06:50, Geoff Winkless wrote: > Having said all that, has anyone suggested grabbing and writing out > using the "stty quit" value? That appears to work whatever level > you're at, readline-or-not, mid-line or not. It wasn't even something > I was aware of. Well, the usual use of SIGQUI

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Geoff Winkless
On 16 January 2018 at 17:20, Robert Haas wrote: > (1) I doubt that we want to > override the user's terminal settings and (2) it won't work on > non-readline builds. I'm inclined to agree with (1). (2) is something that could be worked around with (relatively) small effort, and in theory we could

Re: proposal: alternative psql commands quit and exit

2018-01-16 Thread Alvaro Herrera
Tom Lane wrote: > Also, I remain of the opinion that we needn't necessarily teach them the > minimum-keystrokes solution; it's better to teach something that will work > every time. Maybe ^C is close enough on that score, but I'm not sure. IMO in the spirit of keeping things simple, it's enough

Re: proposal: alternative psql commands quit and exit

2018-01-16 Thread Tom Lane
Robert Haas writes: > This gets a little complex; you need to note only the parser state but > also, in the case of dollar-quoting, what appeared between the two > dollar signs when the dollar quotes were opened. True; perhaps we could cheat and just print $$ in that case. > Plus, it's quite > p

Re: proposal: alternative psql commands quit and exit

2018-01-16 Thread Robert Haas
On Tue, Jan 16, 2018 at 6:44 AM, Geoff Winkless wrote: > A quick PoC. > > I should say upfront that I've no axe to grind over this, if no-one > likes the idea I don't mind: I'm not sure I like it myself (it's quite > an aggressive stance to take, I think) - I just wanted to see if it > would work,

Re: proposal: alternative psql commands quit and exit

2018-01-16 Thread Robert Haas
On Mon, Jan 15, 2018 at 11:55 AM, Tom Lane wrote: > Right, but if we're willing to look at the parse state, we don't need > to cram all possible knowledge into one 80-character string. I'm > thinking about just responding to the current situation, say > > You have begun a quoted string. To end i

Re: proposal: alternative psql commands quit and exit

2018-01-16 Thread Geoff Winkless
On 15 January 2018 at 17:53, Tom Lane wrote: > Geoff Winkless writes: >> At this point it depends quite how far down the rabbit-hole you want >> to go to stop people googling "how do I exit psql", I suppose :p > > Well, I concur with Robert's comment upthread that we don't want to > print any adv

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Chapman Flack
On 01/15/18 16:32, David Fetter wrote: > On Mon, Jan 15, 2018 at 01:24:45PM -0500, Chapman Flack wrote: >> On 01/15/18 11:56, David Fetter wrote: And while trying to find the EOF setting in libreadline might get messy, you're already assuming that ctrl-C hasn't been knobbled using st

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread David Fetter
On Mon, Jan 15, 2018 at 01:24:45PM -0500, Chapman Flack wrote: > On 01/15/18 11:56, David Fetter wrote: > >> And while trying to find the EOF setting in libreadline might get > >> messy, you're already assuming that ctrl-C hasn't been knobbled > >> using stty intr. Unless you want to go searching f

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tels
Moin, On Mon, January 15, 2018 2:34 pm, Tels wrote: > Maybe that's a Linux-specific thing, but I always use Ctrl-D to exit a > console, and this works with psql, too, even when in the middle of a query > typed. > > So maybe this could be suggested? Sorry, should have really read the thread until

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tels
On Mon, January 15, 2018 11:10 am, Robert Haas wrote: > On Mon, Jan 15, 2018 at 10:57 AM, Tom Lane wrote: >> Robert Haas writes: >>> I've discovered one thing about this design that is not so good, which >>> is that if you open a single, double, or dollar quote, then the >>> instructions that ar

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Chapman Flack
On 01/15/18 11:56, David Fetter wrote: >> And while trying to find the EOF setting in libreadline might get >> messy, you're already assuming that ctrl-C hasn't been knobbled >> using stty intr. Unless you want to go searching for that too? > > I'm pretty sure changing either or both of those sett

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tom Lane
Geoff Winkless writes: > At this point it depends quite how far down the rabbit-hole you want > to go to stop people googling "how do I exit psql", I suppose :p Well, I concur with Robert's comment upthread that we don't want to print any advice that's possibly wrong. So I'd rather provide hints

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Geoff Winkless
On 15 January 2018 at 17:03, Tom Lane wrote: > Geoff Winkless writes: >> And while trying to find the EOF setting in libreadline might get >> messy, you're already assuming that ctrl-C hasn't been knobbled using >> stty intr. Unless you want to go searching for that too? > > Yeah, that's why I pe

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Geoff Winkless
On 15 January 2018 at 16:56, David Fetter wrote: > On Mon, Jan 15, 2018 at 04:53:27PM +, Geoff Winkless wrote: >> And while trying to find the EOF setting in libreadline might get >> messy, you're already assuming that ctrl-C hasn't been knobbled >> using stty intr. Unless you want to go searc

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tom Lane
Geoff Winkless writes: > And while trying to find the EOF setting in libreadline might get > messy, you're already assuming that ctrl-C hasn't been knobbled using > stty intr. Unless you want to go searching for that too? Yeah, that's why I personally don't want to mention ctrl-C in this message.

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread David Fetter
On Mon, Jan 15, 2018 at 04:53:27PM +, Geoff Winkless wrote: > On 15 January 2018 at 16:48, Tom Lane wrote: > > Geoff Winkless writes: > >> Perhaps different messages on different OSes? :) > > > > It's worse than that: the EOF key is configurable. In principle > > we could look into the tty s

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tom Lane
Robert Haas writes: > On Mon, Jan 15, 2018 at 10:57 AM, Tom Lane wrote: >> I was kind of imagining that we could make the hint text vary depending >> on the parsing state. Maybe that's too hard to get to --- but if the >> prompt-creating code knows what it is, perhaps this can too. > More broad

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Geoff Winkless
On 15 January 2018 at 16:48, Tom Lane wrote: > Geoff Winkless writes: >> Perhaps different messages on different OSes? :) > > It's worse than that: the EOF key is configurable. In principle we > could look into the tty settings and print the right thing, but > I doubt we want to go there, especi

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tom Lane
Geoff Winkless writes: > Perhaps different messages on different OSes? :) It's worse than that: the EOF key is configurable. In principle we could look into the tty settings and print the right thing, but I doubt we want to go there, especially if there's no corresponding thing on Windows.

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Geoff Winkless
On 15 January 2018 at 16:16, Laurenz Albe wrote: > Geoff Winkless wrote: >> Can we not just say "ctrl-D to quit" instead of \q? Doesn't that work >> everywhere? > > Not on Windows, as far as I know. Well on Windows, Ctrl-C doesn't clear the input buffer either - it quits the whole thing. Perhaps

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Stephen Frost
Geoff, all, * Geoff Winkless (pgsqlad...@geoff.dj) wrote: > On 15 January 2018 at 16:10, Robert Haas wrote: > > > > More broadly, I think what is needed here is less C-fu than > > English-fu. If we come up with something good, we can make it print > > that thing. > > Can we not just say "ctrl-D

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Laurenz Albe
Geoff Winkless wrote: > Can we not just say "ctrl-D to quit" instead of \q? Doesn't that work > everywhere? Not on Windows, as far as I know. Yours, Laurenz Albe

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Geoff Winkless
On 15 January 2018 at 16:10, Robert Haas wrote: > > More broadly, I think what is needed here is less C-fu than > English-fu. If we come up with something good, we can make it print > that thing. > Can we not just say "ctrl-D to quit" instead of \q? Doesn't that work everywhere? Geoff

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Robert Haas
On Mon, Jan 15, 2018 at 10:57 AM, Tom Lane wrote: > Robert Haas writes: >> I've discovered one thing about this design that is not so good, which >> is that if you open a single, double, or dollar quote, then the >> instructions that are provided under that design do not work: > > I was kind of i

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Robert Haas
On Mon, Jan 15, 2018 at 10:48 AM, Stephen Frost wrote: > Well, control-C would still work in that case, so I'm not sure that it's > so bad. It's certainly better than what we have now. I would have > thought to include a hint to use \? for help too but it might make the > hint too long. How abo

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Tom Lane
Robert Haas writes: > I've discovered one thing about this design that is not so good, which > is that if you open a single, double, or dollar quote, then the > instructions that are provided under that design do not work: I was kind of imagining that we could make the hint text vary depending on

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Stephen Frost
Robert, * Robert Haas (robertmh...@gmail.com) wrote: > On Mon, Jan 15, 2018 at 7:28 AM, Laurenz Albe > wrote: > > Everaldo Canuto wrote: > >> Also I don't see a consensus on this thread and I don't understand how > >> decisions are taken. > > > > It's just difficult to find consensus with many

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Robert Haas
On Mon, Jan 15, 2018 at 7:28 AM, Laurenz Albe wrote: > Everaldo Canuto wrote: >> Also I don't see a consensus on this thread and I don't understand how >> decisions are taken. > > It's just difficult to find consensus with many people. > > There were several valid concerns with this, the most str

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Laurenz Albe
Everaldo Canuto wrote: > Also I don't see a consensus on this thread and I don't understand how > decisions are taken. It's just difficult to find consensus with many people. There were several valid concerns with this, the most striking (to me) was Tome's concern that there are perfectly valid

Re: proposal: alternative psql commands quit and exit

2018-01-14 Thread Everaldo Canuto
On Sun, Jan 14, 2018 at 2:38 AM, Chapman Flack wrote: > On 01/13/18 21:36, Everaldo Canuto wrote: > > > I don't wanna be irritating but here every postgres user I found really > > can't understand how the original patch was not accepted, people against > it > > did not show good reasons. > > As I

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Chapman Flack
On 01/13/18 21:36, Everaldo Canuto wrote: > I don't wanna be irritating but here every postgres user I found really > can't understand how the original patch was not accepted, people against it > did not show good reasons. As I was watching this thread go by, the reasons being shown seemed good t

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Everaldo Canuto
On Sat, Jan 13, 2018 at 11:31 PM, Tom Lane wrote: > Vik Fearing writes: > > After re-reading the thread, I think the original patch is optimal. > > Hm, few other people thought that. > > I don't wanna be irritating but here every postgres user I found really can't understand how the original pat

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Stephen Frost
Tom, Vik, all, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Vik Fearing writes: > > In particular, I currently hate how pasting a query with tabs screws > > everything up with unhelpful completions. I don't want to add to that > > with the column example Tom exposed in [1] and especially with the >

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Tom Lane
Vik Fearing writes: > After re-reading the thread, I think the original patch is optimal. Hm, few other people thought that. > In particular, I currently hate how pasting a query with tabs screws > everything up with unhelpful completions. I don't want to add to that > with the column example T

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Stephen Frost
Vik, * Vik Fearing (vik.fear...@2ndquadrant.com) wrote: > On 01/13/2018 10:52 PM, Stephen Frost wrote: > > * Vik Fearing (vik.fear...@2ndquadrant.com) wrote: > >> On 01/09/2018 02:29 AM, Alvaro Herrera wrote: > >>> Everaldo Canuto wrote: > Change my patch will make psql different from other s

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Vik Fearing
On 01/13/2018 10:52 PM, Stephen Frost wrote: > Vik, all, > > * Vik Fearing (vik.fear...@2ndquadrant.com) wrote: >> On 01/09/2018 02:29 AM, Alvaro Herrera wrote: >>> Everaldo Canuto wrote: Change my patch will make psql different from other sql clients I use (sqlplus and mysql). >>> >>> W

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Stephen Frost
Vik, all, * Vik Fearing (vik.fear...@2ndquadrant.com) wrote: > On 01/09/2018 02:29 AM, Alvaro Herrera wrote: > > Everaldo Canuto wrote: > >> Change my patch will make psql different from other sql clients I use > >> (sqlplus and mysql). > > > > Well, I don't think we're too hot about copying thei

Re: proposal: alternative psql commands quit and exit

2018-01-09 Thread Vik Fearing
On 01/09/2018 02:29 AM, Alvaro Herrera wrote: > Everaldo Canuto wrote: >> Change my patch will make psql different from other sql clients I use >> (sqlplus and mysql). > > Well, I don't think we're too hot about copying their behavior exactly. > This thread discussed the behavior at length and a c

Re: proposal: alternative psql commands quit and exit

2018-01-08 Thread Alvaro Herrera
Everaldo Canuto wrote: > Change my patch will make psql different from other sql clients I use > (sqlplus and mysql). Well, I don't think we're too hot about copying their behavior exactly. This thread discussed the behavior at length and a consensus was found after much thinking. No one is impos

Re: proposal: alternative psql commands quit and exit

2018-01-07 Thread Everaldo Canuto
Change my patch will make psql different from other sql clients I use (sqlplus and mysql). I am happy with my custom version of psql so you can cancel/delete/ignore my patch. On Sun, Jan 7, 2018 at 12:36 AM, Tom Lane wrote: > Everaldo Canuto writes: > > Can we proceed with current behavior an

Re: proposal: alternative psql commands quit and exit

2018-01-06 Thread Tom Lane
Chapman Flack writes: > I'm not sure what the usual shape of 'consensus' or 'resolution' is in these > things, > but it seems to me that the branch of this email thread that leads here > (through the > message from Robert that I'm replying to) is the one that felt like it was > converging. > I

Re: proposal: alternative psql commands quit and exit

2018-01-06 Thread Chapman Flack
I'm not sure what the usual shape of 'consensus' or 'resolution' is in these things, but it seems to me that the branch of this email thread that leads here (through the message from Robert that I'm replying to) is the one that felt like it was converging. I thought it was converging on the ide

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread David G. Johnston
On Tue, Dec 12, 2017 at 6:26 PM, Craig Ringer wrote: > >> There is also stackexchange question with 51000 views that asks how to >> start the postgresql client. Should we rename psql to mysql to help >> new users too? >> > > Frankly, that's a legit question and I don't think it's one we should be

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Craig Ringer
On 12 December 2017 at 23:28, Avinash Kumar wrote: > It takes a few hours to learn PostgreSQL and 1 second to remember, how to > quit from psql. > Surprised to see the depth of discussion on this. > > It takes sometime for a person to explore or know about PostgreSQL and > install it. > Likewise,

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Craig Ringer
On 12 December 2017 at 23:02, Geoff Winkless wrote: > I wouldn't exactly say -1 but it's a "meh" from me. > > On 8 December 2017 at 13:57, Daniel Vérité" > wrote: > > "How to exit from PostgreSQL command line utility: psql" > > > > now at 430k views and 1368 upvotes. > > There is also stackexcha

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Michael Paquier
On Wed, Dec 13, 2017 at 5:42 AM, Robert Haas wrote: > On Tue, Dec 12, 2017 at 11:58 AM, Everaldo Canuto > wrote: >> Sorry to be so sarcastic on last comment but, I am a little frustrated, it >> is not like this patch is big and need a lots of review, it is already done >> and it takes 15 minutes

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Chapman Flack
On 12/12/2017 03:39 PM, Robert Haas wrote: > On Tue, Dec 12, 2017 at 10:02 AM, Geoff Winkless >> Ctrl-D works almost everywhere. It takes 2 seconds... > > If it really took everyone 2 seconds, this question would not be as > common as it is. ... Some years ago, I took a job at a mostly-Unix sho

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Robert Haas
On Tue, Dec 12, 2017 at 3:38 PM, Geoff Winkless wrote: > Well "close" yes, but I like "simpler", and I'm not sure I like the > idea of waiting for someone to flail at the quit command before giving > them a hint. I think a patch that adds a line to every prompt for everyone all the time and has t

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Robert Haas
On Tue, Dec 12, 2017 at 10:02 AM, Geoff Winkless wrote: > There is also stackexchange question with 51000 views that asks how to > start the postgresql client. Should we rename psql to mysql to help > new users too? That's not a serious question, and I don't know what your point is in suggesting

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Robert Haas
On Tue, Dec 12, 2017 at 11:58 AM, Everaldo Canuto wrote: > Sorry to be so sarcastic on last comment but, I am a little frustrated, it > is not like this patch is big and need a lots of review, it is already done > and it takes 15 minutes from me and it was the first time I look at Postgres > sourc

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Geoff Winkless
On 12 December 2017 at 18:32, Chapman Flack wrote: > It seems to me that this is very close to the Robert Haas suggestion > already discussed upthread, except that suggestion only prints the > hint message when you might need it, which I'd find less intrusive. Well "close" yes, but I like "simple

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Chapman Flack
On 12/12/2017 12:00 PM, Geoff Winkless wrote: > I quite like this idea, although I would rather a line printed after > each command is run: something like > > mydbname=# select ; > -- > (1 row) > > \h for help, \q for quit, \expert to turn off this message > osprey=# It seems to me that this is

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Geoff Winkless
On 12 December 2017 at 16:36, Arthur Nascimento wrote: > Nano keeps a cheatsheet of commands on the bottom; and it's regarded > as a fairly good editor for newcomers. Some shells have a right-hand > side status bar. I quite like this idea, although I would rather a line printed after each command

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Everaldo Canuto
On Tue, Dec 12, 2017 at 2:39 PM, Everaldo Canuto wrote: > > As others have pointed out, there are _far_ more frustrating things >> (like the lack of SHOW CREATE [TABLE|etc]... support in the backend) >> for anyone coming from mysql that I would suggest should be addressed >> if you were serious a

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Geoff Winkless
On 12 December 2017 at 16:39, Everaldo Canuto wrote: > On Tue, Dec 12, 2017 at 1:02 PM, Geoff Winkless wrote: >> There is also stackexchange question with 51000 views that asks how to >> start the postgresql client. Should we rename psql to mysql to help >> new users too? > No, we shouldn't but

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Everaldo Canuto
On Tue, Dec 12, 2017 at 1:02 PM, Geoff Winkless wrote: > > There is also stackexchange question with 51000 views that asks how to > start the postgresql client. Should we rename psql to mysql to help > new users too? > No, we shouldn't but it will help a lot is postgres client have names like "po

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Arthur Nascimento
On 12 December 2017 at 13:04, Jeremy Finzel wrote: > FWIW I am +1 in favor of not overcomplicating the special psql commands and > keep to the "\" standard. I find the general rule of \ starts a client command and anything else starts a server command to be very good to begin with. The 'help' is

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Avinash Kumar
It takes a few hours to learn PostgreSQL and 1 second to remember, how to quit from psql. Surprised to see the depth of discussion on this. It takes sometime for a person to explore or know about PostgreSQL and install it. Likewise, it takes him some more time to understand that there exists a "ps

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread David G. Johnston
On Tue, Dec 12, 2017 at 8:04 AM, Jeremy Finzel wrote: > I don't think this is a significant stumbling block for users adopting > postgres. > ​The OP complained, and I tend to agree, that 90% of the world uses the command "exit" to end a program and that it would be nice if we did as well. This

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Jeremy Finzel
Someone mentioned about needing to read the documentation of vim to learn how to exit the program. I personally think exactly the same applies here, and am a bit surprised at the depth of discussion over this. When I first was new to cli programs, the only "standard" way to exit a program I found

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Geoff Winkless
I wouldn't exactly say -1 but it's a "meh" from me. On 8 December 2017 at 13:57, Daniel Vérité" wrote: > "How to exit from PostgreSQL command line utility: psql" > > now at 430k views and 1368 upvotes. There is also stackexchange question with 51000 views that asks how to start the postgresql cl

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Gasper Zejn
On 12. 12. 2017 06:58, Tom Lane wrote: > Craig Ringer writes: >> I doubt I've ever written just "exit" or "quit" without indentation. I >> think if it requires them to be a bareword with no indentation, strictly >> ^(exit|quit)\n when isatty, then that's probably a safe and helpful choice. > FWIW,

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Craig Ringer
On 12 December 2017 at 13:58, Tom Lane wrote: > Craig Ringer writes: > > I doubt I've ever written just "exit" or "quit" without indentation. I > > think if it requires them to be a bareword with no indentation, strictly > > ^(exit|quit)\n when isatty, then that's probably a safe and helpful > c

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Tom Lane
Craig Ringer writes: > I doubt I've ever written just "exit" or "quit" without indentation. I > think if it requires them to be a bareword with no indentation, strictly > ^(exit|quit)\n when isatty, then that's probably a safe and helpful choice. FWIW, I think that the special behavior (whatever

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Craig Ringer
On 12 December 2017 at 05:16, Tom Lane wrote: > Peter Eisentraut writes: > > On 12/9/17 19:28, Tom Lane wrote: > >> No, my problem with it is that there are lots of contexts where typing > >> "help" won't produce anything. Robert's proposal downthread would > >> go a long way towards fixing tha

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Craig Ringer
On 12 December 2017 at 05:38, Chapman Flack wrote: > On 12/11/2017 04:16 PM, Tom Lane wrote: > > Peter Eisentraut writes: > >> No opinion on that, but if the problem is that people don't know how to > >> quit psql, then we should just put that information back into the > >> welcome message and b

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Chapman Flack
On 12/11/2017 04:16 PM, Tom Lane wrote: > Peter Eisentraut writes: >> No opinion on that, but if the problem is that people don't know how to >> quit psql, then we should just put that information back into the >> welcome message and be done with it. > > I don't think people read the welcome mess

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Tom Lane
Peter Eisentraut writes: > On 12/9/17 19:28, Tom Lane wrote: >> No, my problem with it is that there are lots of contexts where typing >> "help" won't produce anything. Robert's proposal downthread would >> go a long way towards fixing that. > No opinion on that, but if the problem is that peopl

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Peter Eisentraut
On 12/9/17 19:28, Tom Lane wrote: > Peter Eisentraut writes: >> On 12/8/17 10:19, Tom Lane wrote: >>> Meh. I never thought that the "help" business was particularly well >>> thought out, and this proposal isn't better. > >> The perhaps the fix is to revert the "help" thing? > > No, my problem w

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread David Fetter
On Mon, Dec 11, 2017 at 11:14:29AM -0200, Fabrízio de Royes Mello wrote: > And what about create some way to create aliases for meta-commands in psql? At first blush, this sounds interesting, but on further reflection, it seems more like a MASSIVE foot gun on the useability/getting help side, and

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Everaldo Canuto
Hello. On Mon, Dec 11, 2017 at 11:14 AM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > And what about create some way to create aliases for meta-commands in > psql? Something like: > > \alias quit \q > \alias exit \q > > We also can create a special config variable to enable/disab

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Fabrízio de Royes Mello
On Sat, Dec 9, 2017 at 12:59 PM, David Fetter wrote: > > On Fri, Dec 08, 2017 at 02:12:06PM -0500, Robert Haas wrote: > > On Fri, Dec 8, 2017 at 10:28 AM, Szymon Lipiński wrote: > > > Well, if I have a new program I usually read some documentation. It really > > > helps people to exit vim as well

Re: proposal: alternative psql commands quit and exit

2017-12-09 Thread Tom Lane
Peter Eisentraut writes: > On 12/8/17 10:19, Tom Lane wrote: >> Meh. I never thought that the "help" business was particularly well >> thought out, and this proposal isn't better. > The perhaps the fix is to revert the "help" thing? No, my problem with it is that there are lots of contexts wher

  1   2   >