Re: pgsql: Disallow newlines in parameter values to be set in ALTER SYSTEM.

From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Disallow newlines in parameter values to be set in ALTER SYSTEM.
Date: 2016-04-05 06:08:45
Message-ID: CAF4Au4zdfYk0V9OeeU0eTuuLNoWFsiu=yu2-bOsXz1RotivdXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, Apr 5, 2016 at 9:05 AM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:

>
>
> On Tue, Apr 5, 2016 at 1:05 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Disallow newlines in parameter values to be set in ALTER SYSTEM.
>>
>
> it's also fixed problem with setting parameter to ''. Before
>
> alter system SET shared_preload_libraries = '';
>
> produced wrong postgresql.auto.conf and the only way was to use RESET
>
> alter system RESET shared_preload_libraries;
>
>
Ooops, it doesn't :(

FATAL: could not access file "": No such file or directory

cat /usr/local/pgsql-head/data/postgresql.auto.conf
# Do not edit this file manually!
# It will be overwritten by ALTER SYSTEM command.
shared_preload_libraries = '""'

>
>
>> As noted by Julian Schauder in bug #14063, the configuration-file parser
>> doesn't support embedded newlines in string literals. While there might
>> someday be a good reason to remove that restriction, there doesn't seem
>> to be one right now. However, ALTER SYSTEM SET could accept strings
>> containing newlines, since many of the variable-specific value-checking
>> routines would just see a newline as whitespace. This led to writing a
>> postgresql.auto.conf file that was broken and had to be removed manually.
>>
>> Pending a reason to work harder, just throw an error if someone tries
>> this.
>>
>> In passing, fix several places in the ALTER SYSTEM logic that failed to
>> provide an errcode() for an ereport(), and thus would falsely log the
>> failure as an internal XX000 error.
>>
>> Back-patch to 9.4 where ALTER SYSTEM was introduced.
>>
>> Branch
>> ------
>> REL9_5_STABLE
>>
>> Details
>> -------
>>
>> http://git.postgresql.org/pg/commitdiff/f3d17491c49362b78da0c1a5b0691821dcc8c435
>>
>> Modified Files
>> --------------
>> src/backend/utils/misc/guc.c | 23 ++++++++++++++++++++---
>> 1 file changed, 20 insertions(+), 3 deletions(-)
>>
>>
>> --
>> Sent via pgsql-committers mailing list (pgsql-committers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-committers
>>
>
>

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2016-04-05 09:05:29 pgsql: Fix typo
Previous Message Oleg Bartunov 2016-04-05 06:05:49 Re: pgsql: Disallow newlines in parameter values to be set in ALTER SYSTEM.