Robert Poor writes:
On Thu, Apr 28, 2011 at 10:40, Leif Biberg Kristensen
Your suggestion is, frankly said, ridiculous.
Gosh, Leif, where's the love? We were all novices once upon a time.
Yeah, and John's not exactly the first person to forget a semicolon.
I don't much like his proposed solution, because it would degrade from
"useful" to "incredibly irritating" after just a few minutes, or at
least it would as soon as you knew enough SQL to be entering multiline
queries. But it's worth thinking about how to respond to the problem.
In recent versions of psql, if you type "help" as the startup prompt
suggests, it will mention use of a semicolon:
$ psql postgres
Type "help" for help.
You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Now the first question is whether the "terminate with semicolon"
bit is clear enough for a novice. Some comments on this message
from someone who's just seen it for the first time might be useful.
The other thing that strikes me is that in order to make sure that
we don't accidentally take part of a SQL command as a help request,
"help" is only recognized as the very first word of input. So if
you'd put in some text and then started to wonder why you're not
getting an answer, "help" doesn't help:
postgres=# select 2+2
Maybe we should be a little looser there? I mean, in theory the word
"help" alone on a line could be an intended part of a larger SQL
command, but in practice what are the odds?
regards, tom lane