1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Remove "array_nulls" GUC parameter.

This backwards-compatibility hack was introduced twenty years ago (in
8.2), and has surely been of no value for at least the last ten years.
However, we shouldn't just leave it sit, because as was just pointed
out it creates a dump/reload hazard: if it's set in the receiving
environment then array contents will not be restored correctly.
Other applications would likely be broken by it too, so whatever
residual value it may have seems outweighed by the possibility of
misuse.

Our precedent for retiring some other comparable parameters, such as
standard_conforming_strings, has been to leave the parameter in
existence but force it to a fixed value.  I judge however that
that's not worth the trouble here, because there's no reason to
believe that a non-negligible number of applications are either
setting or reading this value.  Let's just delete it in the master
branch and be done with it.

Bug: #19747
Reported-by: Ke <kehan5800@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/19747-69b01e7fc190cd58@postgresql.org
This commit is contained in:
Tom Lane
2026-10-07 11:39:02 -04:00
parent 2906f0d5d7
commit e96efd07c7
6 changed files with 2 additions and 49 deletions

View File

@@ -756,10 +756,7 @@ SELECT f1[1][-2][3] AS e1, f1[1][-1][5] AS e2
If the value written for an element is <literal>NULL</literal> (in any case
variant), the element is taken to be NULL. The presence of any quotes
or backslashes disables this and allows the literal string value
<quote>NULL</quote> to be entered. Also, for backward compatibility with
pre-8.2 versions of <productname>PostgreSQL</productname>, the <xref
linkend="guc-array-nulls"/> configuration parameter can be turned
<literal>off</literal> to suppress recognition of <literal>NULL</literal> as a NULL.
<quote>NULL</quote> to be entered.
</para>
<para>

View File

@@ -11941,32 +11941,6 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir'
<variablelist>
<varlistentry id="guc-array-nulls" xreflabel="array_nulls">
<term><varname>array_nulls</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>array_nulls</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
This controls whether the array input parser recognizes
unquoted <literal>NULL</literal> as specifying a null array element.
By default, this is <literal>on</literal>, allowing array values containing
null values to be entered. However, <productname>PostgreSQL</productname> versions
before 8.2 did not support null values in arrays, and therefore would
treat <literal>NULL</literal> as specifying a normal array element with
the string value <quote>NULL</quote>. For backward compatibility with
applications that require the old behavior, this variable can be
turned <literal>off</literal>.
</para>
<para>
Note that it is possible to create array values containing null values
even when this variable is <literal>off</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-backslash-quote" xreflabel="backslash_quote">
<term><varname>backslash_quote</varname> (<type>enum</type>)
<indexterm><primary>strings</primary><secondary>backslash quotes</secondary></indexterm>

View File

@@ -38,11 +38,6 @@
#include "utils/typcache.h"
/*
* GUC parameter
*/
bool Array_nulls = true;
/*
* Local definitions
*/
@@ -925,7 +920,7 @@ unquoted_element:
elembuf->len = dstlen;
*srcptr = p;
/* Check if it's unquoted "NULL" */
if (Array_nulls && !has_escapes &&
if (!has_escapes &&
pg_strcasecmp(elembuf->data, "NULL") == 0)
return ATOK_ELEM_NULL;
else

View File

@@ -105,13 +105,6 @@
max => 'INT_MAX / 2',
},
{ name => 'array_nulls', type => 'bool', context => 'PGC_USERSET', group => 'COMPAT_OPTIONS_PREVIOUS',
short_desc => 'Enables input of NULL elements in arrays.',
long_desc => 'When turned on, unquoted NULL in an array input value means a null value; otherwise it is taken literally.',
variable => 'Array_nulls',
boot_val => 'true',
},
{ name => 'authentication_timeout', type => 'int', context => 'PGC_SIGHUP', group => 'CONN_AUTH_AUTH',
short_desc => 'Sets the maximum allowed time to complete client authentication.',
flags => 'GUC_UNIT_S',

View File

@@ -892,7 +892,6 @@
# - Previous PostgreSQL Versions -
#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#lo_compat_privileges = off
#quote_all_identifiers = off

View File

@@ -343,11 +343,6 @@ typedef struct ArrayIteratorData *ArrayIterator;
(a)->xpn.lbound : ARR_LBOUND((ArrayType *) (a)))
/*
* GUC parameter
*/
extern PGDLLIMPORT bool Array_nulls;
/*
* prototypes for functions defined in arrayfuncs.c
*/