Re: Willing to fix a PQexec() in libpq module

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: wufei(dot)fnst(at)cn(dot)fujitsu(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Willing to fix a PQexec() in libpq module
Date: 2019-03-19 14:30:45
Message-ID: 10415.1553005845@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> writes:
> At Tue, 19 Mar 2019 08:18:23 +0000, "Wu, Fei" <wufei(dot)fnst(at)cn(dot)fujitsu(dot)com> wrote in <52E6E0843B9D774C8C73D6CF64402F05621F0FFC(at)G08CNEXMBPEKD02(dot)g08(dot)fujitsu(dot)local>
>> I will try to fix it~

> I don't oppose that, but as the discussion linked from there [1],
> psql already has a feature that sends multiple statements by one
> PQexec() in two ways. Fixing it means making the features
> obsolete.

Yeah, the problem here is that a lot of people think that that's
a feature not a bug. You certainly can't get away with just summarily
changing the behavior of PQexec without any recourse. Maybe there
would be acceptance for either of

(1) a different function that is like PQexec but restricts the
query string

(2) a connection option or state variable that affects PQexec's
behavior --- but it probably still has to default to permissive.

Unfortunately, if the default behavior doesn't change, then there's little
argument for doing this at all. The security reasoning behind doing
anything in this area would be to provide an extra measure of protection
against SQL-injection attacks on carelessly-written clients, and of course
it's unlikely that a carelessly-written client would get changed to make
use of a non-default feature.

So that's why nothing has been done about this for umpteen years.
If somebody can think of a way to resolve this tension, maybe the
item will get finished; but it's not just a matter of writing some
code.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2019-03-19 14:43:31 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Previous Message Dmitry Dolgov 2019-03-19 14:09:17 Re: [HACKERS] [PATCH] Generic type subscripting