Re: proposal: alternative psql commands quit and exit

2017-12-09 Thread Daniel Vérité
Everaldo Canuto wrote:

> >
> > postgres=> select 2+2
> >2-> help
> >3-> quit
> >4-> exit
> 
> 
> I like it! Maybe another proposal to change PROMPT2?

Thanks. Yes, I think it should be a different proposal.

On closer inspection, mysql doesn't make a real effort
to align prompts, the secondary prompt happens
to coincide with the default primary prompt, but
when it's non-default, the alignment is lost.
Their secondary prompt does not seem to be 
configurable.

By contrast PROMPT2 is fully configurable in psql.
The issue of alignment is non-trivial if we wish to retain the
nice-to-have property that if you copy-paste psql session
in an editor, the prompting can generally be filtered out
with a simple column-cut.

Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



Re: proposal: alternative psql commands quit and exit

2017-12-08 Thread Daniel Vérité
Everaldo Canuto wrote:

> Oracle's sqlplus uses "quit" or "exit" and MySQL client can be exited using
> "quit" and "exit" but for compatibility with psql, it also supports "\q"
> and "\quit".

When looking at the most popular postgres questions on stackoverflow:

https://stackoverflow.com/questions/tagged/postgresql?sort=votes

the first one (most up-voted) happens to be:

"How to exit from PostgreSQL command line utility: psql"

now at 430k views and 1368 upvotes.

Independently of the syntax-compatibility with other tools,
it can be a miserable experience for people who almost
never use psql to type "quit" or "exit" after they're done
with whatever they wanted to do, and nothing
happens except a tiny change in the prompt.

Implementing it is easy, but it might be a hard sell for the project
because it creates a precedent.
The next question in that list is "PostgreSQL DESCRIBE TABLE", so
why not implement "desc tablename;" as a synonym for
"\d tablename"?

The question after that is "Show tables in PostgreSQL", so
why not implement "show tablename;"? Well, this one is
impossible because SHOW is already a SQL command that does
something else, so that's already the end of that road to
compatibility.

Personally I'm +1 on accepting the additional "exit" and "quit"
as synonyms for \q, to comply with the "Do What I Mean" UX rule,
rather than just compatibility with other tools.
I guess this is why "help" is already a synonym of \h.


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite