Re: Is this legal SQL? Is it a good practice? - Mailing list pgsql-general

From Tom Lane
Subject Re: Is this legal SQL? Is it a good practice?
Date
Msg-id 13002.1093388250@sss.pgh.pa.us
Whole thread Raw
In response to Re: Is this legal SQL? Is it a good practice?  (Carlos Moreno <moreno@mochima.com>)
List pgsql-general
Carlos Moreno <moreno@mochima.com> writes:
> I always thought the semicolon was a psql thing,
> which it would use to determine when the user is
> done entering the SQL statement.

Exactly.  psql parses what you type sufficiently well to locate
command-ending semicolons, and then sends one command at a time to the
backend.  libpq is much dumber; it just takes the string you give it and
ships that to the backend.

The backend's current behavior with multi-command input strings has been
that way since the beginning (or at least since before I got here).
People have occasionally proposed removing the feature, but it's pretty
well entrenched on backwards-compatibility grounds.

Note that the new "v3" fe/be protocol does *not* allow multiple commands
in an extended-query-mode input string, so if you are of the opinion
that allowing multiple commands is a bad idea you can just use extended
query mode all the time.  (In libpq that translates to not using PQexec,
but one of the newer functions.)

            regards, tom lane

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Deadlocks caused by referential integrity checks
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions