# 20.13. Version and Platform Compatibility
20.13.1. Previous PostgreSQL Versions
20.13.2. Platform and Client Compatibility
# 20.13.1. Previous PostgreSQL Versions
This controls whether the array input parser recognizes unquotedNULL
as specifying a null array element. By default, this ison
, allowing array values containing null values to be entered. However, PostgreSQL versions before 8.2 did not support null values in arrays, and therefore would treatNULL
as specifying a normal array element with the string value “NULL”. For backward compatibility with applications that require the old behavior, this variable can be turnedoff
.
Note that it is possible to create array values containing null values even when this variable isoff
.
This controls whether a quote mark can be represented by\'
in a string literal. The preferred, SQL-standard way to represent a quote mark is by doubling it (''
) but PostgreSQL has historically also accepted\'
.然而,使用\'
会产生安全风险,因为在某些客户端字符集编码中,存在最后一个字节在数字上等同于 ASCII 的多字节字符\
.如果客户端代码不正确地转义,则可能发生 SQL 注入攻击。通过使服务器拒绝其中引号似乎被反斜杠转义的查询,可以防止这种风险。的允许值反斜杠引用
是在
(允许\'
总是),离开
(总是拒绝),和安全编码
(仅当客户端编码不允许 ASCII 时才允许\
在一个多字节字符内)。安全编码
是默认设置。
请注意,在符合标准的字符串文字中,\
只是意味着\
反正。此参数仅影响对不符合标准的文字的处理,包括转义字符串语法 (E'...'
)。
打开时,如果反斜杠 (\
) 出现在普通字符串文字 (“……”
语法)和standard_conforming_strings
已关闭。默认是在
.
希望使用反斜杠作为转义的应用程序应修改为使用转义字符串语法 (E'...'
),因为根据 SQL 标准,普通字符串的默认行为现在是将反斜杠视为普通字符。可以启用此变量来帮助定位需要更改的代码。
在 PostgreSQL 9.0 之前的版本中,大对象没有访问权限,因此,所有用户始终可以读写。将此变量设置为在
禁用新的权限检查,以与以前的版本兼容。默认是离开
.只有超级用户可以更改此设置。
设置此变量不会禁用所有与大对象相关的安全检查——仅禁用那些在 PostgreSQL 9.0 中更改了默认行为的安全检查。
当数据库生成 SQL 时,强制所有标识符都被引用,即使它们不是(当前)关键字。这会影响输出解释
以及函数的结果,如pg_get_viewdef
.另见--quote-all-identifiers
选项皮克_倾倒和皮克_饺子.
standard_conforming_strings
(布尔值
)
这控制普通字符串文字(“……”
) 按照 SQL 标准中的规定逐字处理反斜杠。从 PostgreSQL 9.1 开始,默认值为在
(以前的版本默认为离开
)。应用程序可以检查此参数以确定如何处理字符串文字。此参数的存在也可以作为转义字符串语法 (E'...'
) 受支持。转义字符串语法 (第 4.1.2.2 节) 如果应用程序希望将反斜杠视为转义字符,则应使用。
This allows sequential scans of large tables to synchronize with each other, so that concurrent scans read the same block at about the same time and hence share the I/O workload. When this is enabled, a scan might start in the middle of the table and then “wrap around” the end to cover all rows, so as to synchronize with the activity of scans already in progress. This can result in unpredictable changes in the row ordering returned by queries that have noORDER BY
clause. Setting this parameter tooff
ensures the pre-8.3 behavior in which a sequential scan always starts from the beginning of the table. The default ison
.
# 20.13.2. Platform and Client Compatibility
transform_null_equals
(boolean
)
When on, expressions of the form*
expr* = NULL
(orNULL = *
expr*
) are treated as*
expr* IS NULL
, that is, they return true if*表达式
*评估为空值,否则为假。正确的符合 SQL 规范的行为*
表达式* = 空
是始终返回 null(未知)。因此该参数默认为离开
.
但是,Microsoft Access 中的筛选表单生成的查询似乎使用*
表达式* = 空
测试空值,因此如果您使用该接口访问数据库,您可能需要打开此选项。由于形式的表达*
表达式* = 空
总是返回空值(使用 SQL 标准解释),它们不是很有用,并且在正常应用程序中不经常出现,因此此选项在实践中几乎没有危害。但是新用户经常对涉及空值的表达式的语义感到困惑,所以这个选项默认是关闭的。
请注意,此选项仅影响确切的形式= 空
,而不是其他比较运算符或其他在计算上等效于某些涉及等于运算符的表达式的表达式(例如在
)。因此,此选项不是对不良编程的一般修复。
参考第 9.2 节获取相关信息。