Postgresql 中文操作指南

Appendix D. SQL Conformance

Table of Contents

本部分试图概述 PostgreSQL 符合当前 SQL 标准的程度。以下信息并非完整的一致性声明,但它尽可能详细地展示了主要主题,而且对于用户来说是有用和合理的。

This section attempts to outline to what extent PostgreSQL conforms to the current SQL standard. The following information is not a full statement of conformance, but it presents the main topics in as much detail as is both reasonable and useful for users.

SQL 标准的正式名称是 ISO/IEC 9075“数据库语言 SQL”。该标准的修订版会时不时发布;最近更新是在 2023 年。2023 年版本称为 ISO/IEC 9075: 2023,或简称为 SQL:2023。之前的版本有 SQL:2016、SQL:2011、SQL:2008、SQL:2006、SQL:2003、SQL:1999 和 SQL-92。每个版本取代前一个版本,因此对早期版本的符合性声明没有任何官方价值。PostgreSQL 开发的目标是与该标准的最新官方版本保持一致,但这种一致性不会与传统特性或常识相矛盾。SQL 标准要求的许多特性都得到支持,尽管有时语法或功能略有不同。随着时间的推移,可以预期朝着符合性进一步发展。

The formal name of the SQL standard is ISO/IEC 9075 “Database Language SQL”. A revised version of the standard is released from time to time; the most recent update appearing in 2023. The 2023 version is referred to as ISO/IEC 9075:2023, or simply as SQL:2023. The versions prior to that were SQL:2016, SQL:2011, SQL:2008, SQL:2006, SQL:2003, SQL:1999, and SQL-92. Each version replaces the previous one, so claims of conformance to earlier versions have no official merit. PostgreSQL development aims for conformance with the latest official version of the standard where such conformance does not contradict traditional features or common sense. Many of the features required by the SQL standard are supported, though sometimes with slightly differing syntax or function. Further moves towards conformance can be expected over time.

SQL-92 为符合性定义了三个特性集:基础、中级和完整。大多数宣称符合 SQL 标准的数据库管理系统仅在基础级别符合,因为中级和完整级别中的所有特性集要么过于庞大,要么与传统行为相冲突。

SQL-92 defined three feature sets for conformance: Entry, Intermediate, and Full. Most database management systems claiming SQL standard conformance were conforming at only the Entry level, since the entire set of features in the Intermediate and Full levels was either too voluminous or in conflict with legacy behaviors.

从 SQL:1999 开始,SQL 标准定义了一大组单独的特性,而不是在 SQL-92 中找到的无效的广义三个级别。这些特性中的大部分子集代表“核心”特性,每个符合的 SQL 实现都必须提供这些特性。其余的特性完全是可选的。

Starting with SQL:1999, the SQL standard defines a large set of individual features rather than the ineffectively broad three levels found in SQL-92. A large subset of these features represents the “Core” features, which every conforming SQL implementation must supply. The rest of the features are purely optional.

该标准被分成多个部分,每个部分都有一个简短名称:

The standard is split into a number of parts, each also known by a shorthand name:

请注意,某些部分号不再被使用(或未使用)。

Note that some part numbers are not (or no longer) used.

PostgreSQL 核心涵盖部分 1、2、9、11 和 14。ODBC 驱动程序涵盖部分 3,PL/Java 插件涵盖部分 13,但目前未针对这些组件验证准确的一致性。目前没有用于 PostgreSQL 的部分 4、10、15 和 16 的实现。

The PostgreSQL core covers parts 1, 2, 9, 11, and 14. Part 3 is covered by the ODBC driver, and part 13 is covered by the PL/Java plug-in, but exact conformance is currently not being verified for these components. There are currently no implementations of parts 4, 10, 15, and 16 for PostgreSQL.

PostgreSQL 支持 SQL:2023 的大多数主要特性。对于完全的核心一致性所需的 177 个必备特性中,PostgreSQL 至少符合 170 个。此外,还有一个受支持的可选特性的长列表。值得注意的是,在撰写本文时,没有任何一个当前版本的数据库管理系统声称完全符合 Core SQL:2023。

PostgreSQL supports most of the major features of SQL:2023. Out of 177 mandatory features required for full Core conformance, PostgreSQL conforms to at least 170. In addition, there is a long list of supported optional features. It might be worth noting that at the time of writing, no current version of any database management system claims full conformance to Core SQL:2023.

在接下来的两部分中,我们提供了一个列表,其中列出了 PostgreSQL 支持的特性,然后是一个列表,其中列出了 SQL:2023 中定义的尚未在 PostgreSQL 中支持的特性。这两个列表都是近似的:对于列为受支持的特性,可能有一些不符合的细节,而一个不受支持的特性的大部分实际上可能是实现的。文档的主体始终包含有关哪些确实有效以及哪些无效的最准确的信息。

In the following two sections, we provide a list of those features that PostgreSQL supports, followed by a list of the features defined in SQL:2023 which are not yet supported in PostgreSQL. Both of these lists are approximate: There might be minor details that are nonconforming for a feature that is listed as supported, and large parts of an unsupported feature might in fact be implemented. The main body of the documentation always contains the most accurate information about what does and does not work.

Note

包含连字符的特性代码是子特性。因此,如果特定子特性不受支持,则会将主特性列为不受支持,即使支持其他子特性。

Feature codes containing a hyphen are subfeatures. Therefore, if a particular subfeature is not supported, the main feature is listed as unsupported even if some other subfeatures are supported.