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