Re: [HACKERS] Disallowing multiple queries per PQexec() - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: [HACKERS] Disallowing multiple queries per PQexec()
Date
Msg-id b08edad5-f9d0-4dbd-a999-d529f46ac8fe@manitou-mail.org
Whole thread Raw
In response to Re: [HACKERS] Disallowing multiple queries per PQexec()  (Surafel Temesgen <surafel3000@gmail.com>)
Responses Re: [HACKERS] Disallowing multiple queries per PQexec()
Re: [HACKERS] Disallowing multiple queries per PQexec()
List pgsql-hackers
    Surafel Temesgen wrote:

> I modified the patch as such and added to commitfest 2017-07.

A couple comments:

+        {"disallow_multiple_queries", PGC_POSTMASTER,
CLIENT_CONN_OTHER,
+            gettext_noop("Disallow multiple queries per query
string."),
+            NULL
+        },

PGC_POSTMASTER implies that it's an instance-wide setting.
Is is intentional? I can understand that it's more secure for this not to
be changeable in an existing session, but it's also much less usable if you
can't set it per-database and per-user.
Maybe it should be PGC_SUSET ?


+        if ((strcmp(commandTagHead, "BEGIN") != 0) ||
(strcmp(commandTagTail, "COMMIT") != 0) )
+            ereport(ERROR,
+                    (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot execute multiple commands unless it is a transaction
block")));

Shouldn't ROLLBACK be considered too as ending a transaction block?
Also, can it use a more specific code than ERRCODE_SYNTAX_ERROR?
It feels more like a rule violation than a syntax error.



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



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Proposal : For Auto-Prewarm.
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Disallowing multiple queries per PQexec()