Re: failure and silence of SQL commands

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Poor <rdpoor(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: failure and silence of SQL commands
Date: 2011-04-28 18:30:24
Message-ID: 1342.1304015424@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Robert Poor <rdpoor(at)gmail(dot)com> writes:
> On Thu, Apr 28, 2011 at 10:40, Leif Biberg Kristensen
> <leif(at)solumslekt(dot)org> wrote:
>> 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
psql (9.1devel)
Type "help" for help.

postgres=# 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
postgres=#

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
postgres-# help
postgres-#

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Leif Biberg Kristensen 2011-04-28 18:41:18 Re: failure and silence of SQL commands
Previous Message Michael Swierczek 2011-04-28 18:04:43 Re: failure and silence of SQL commands