1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

doc: Update SQL features/conformance information to SQL:2023

Optional subfeatures have been changed to top-level features, so there
is a bit of a churn in the list for that.

Some existing functions have been added to the standard, so they are
moved from the "other" to the "standard" lists in their sections.

Discussion: https://www.postgresql.org/message-id/flat/63f285d9-4ec8-0c9e-4bf5-e76334ddc0af@enterprisedb.com
This commit is contained in:
Peter Eisentraut
2023-04-05 08:55:44 +02:00
parent fb6fad6ef1
commit c9f57541d9
6 changed files with 273 additions and 238 deletions

View File

@ -1242,8 +1242,7 @@ SELECT '52093.89'::money::numeric::float8;
than zero and cannot exceed 10485760.
<type>character</type> without length specifier is equivalent to
<type>character(1)</type>. If <type>character varying</type> is used
without length specifier, the type accepts strings of any size. The
latter behavior is a <productname>PostgreSQL</productname> extension.
without length specifier, the type accepts strings of any size.
</para>
<para>

View File

@ -14,9 +14,9 @@
<para>
The formal name of the SQL standard is ISO/IEC 9075 <quote>Database
Language SQL</quote>. A revised version of the standard is released
from time to time; the most recent update appearing in 2016.
The 2016 version is referred to as ISO/IEC 9075:2016, or simply as SQL:2016.
The versions prior to that were SQL:2011, SQL:2008, SQL:2006, SQL:2003,
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.
@ -62,6 +62,7 @@
<listitem><para>ISO/IEC 9075-13 Routines and Types using the Java Language (SQL/JRT)</para><indexterm><primary>SQL/JRT</primary></indexterm></listitem>
<listitem><para>ISO/IEC 9075-14 XML-related specifications (SQL/XML)</para><indexterm><primary>SQL/XML</primary></indexterm></listitem>
<listitem><para>ISO/IEC 9075-15 Multi-dimensional arrays (SQL/MDA)</para><indexterm><primary>SQL/MDA</primary></indexterm></listitem>
<listitem><para>ISO/IEC 9075-16 Property Graph Queries (SQL/PGQ)</para><indexterm><primary>SQL/PGQ</primary></indexterm></listitem>
</itemizedlist>
Note that some part numbers are not (or no longer) used.
@ -72,23 +73,23 @@
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, and 15
implementations of parts 4, 10, 15, and 16
for <productname>PostgreSQL</productname>.
</para>
<para>
PostgreSQL supports most of the major features of SQL:2016. Out of
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:2016.
system claims full conformance to Core SQL:2023.
</para>
<para>
In the following two sections, we provide a list of those features
that <productname>PostgreSQL</productname> supports, followed by a
list of the features defined in <acronym>SQL:2016</acronym> which
list of the features defined in <acronym>SQL:2023</acronym> which
are not yet supported in <productname>PostgreSQL</productname>.
Both of these lists are approximate: There might be minor details that
are nonconforming for a feature that is listed as supported, and
@ -135,7 +136,7 @@
<title>Unsupported Features</title>
<para>
The following features defined in <acronym>SQL:2016</acronym> are not
The following features defined in <acronym>SQL:2023</acronym> are not
implemented in this release of
<productname>PostgreSQL</productname>. In a few cases, equivalent
functionality is available.

View File

@ -2452,6 +2452,26 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters
in <parameter>characters</parameter> (a space by default)
from the start and end of <parameter>string</parameter>.
</para>
<para>
<literal>btrim('xyxtrimyyx', 'xyz')</literal>
<returnvalue>trim</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -2547,6 +2567,49 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lpad</primary>
</indexterm>
<function>lpad</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by prepending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated (on the right).
</para>
<para>
<literal>lpad('hi', 5, 'xy')</literal>
<returnvalue>xyxhi</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ltrim</primary>
</indexterm>
<function>ltrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the start of
<parameter>string</parameter>.
</para>
<para>
<literal>ltrim('zzzytest', 'xyz')</literal>
<returnvalue>test</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -2650,6 +2713,49 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rpad</primary>
</indexterm>
<function>rpad</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by appending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated.
</para>
<para>
<literal>rpad('hi', 5, 'xy')</literal>
<returnvalue>hixyx</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rtrim</primary>
</indexterm>
<function>rtrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the end of
<parameter>string</parameter>.
</para>
<para>
<literal>rtrim('testxxzx', 'xyz')</literal>
<returnvalue>test</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -2842,26 +2948,6 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters
in <parameter>characters</parameter> (a space by default)
from the start and end of <parameter>string</parameter>.
</para>
<para>
<literal>btrim('xyxtrimyyx', 'xyz')</literal>
<returnvalue>trim</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -2999,49 +3085,6 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lpad</primary>
</indexterm>
<function>lpad</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by prepending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated (on the right).
</para>
<para>
<literal>lpad('hi', 5, 'xy')</literal>
<returnvalue>xyxhi</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ltrim</primary>
</indexterm>
<function>ltrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the start of
<parameter>string</parameter>.
</para>
<para>
<literal>ltrim('zzzytest', 'xyz')</literal>
<returnvalue>test</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -3505,49 +3548,6 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rpad</primary>
</indexterm>
<function>rpad</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by appending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated.
</para>
<para>
<literal>rpad('hi', 5, 'xy')</literal>
<returnvalue>hixyx</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rtrim</primary>
</indexterm>
<function>rtrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the end of
<parameter>string</parameter>.
</para>
<para>
<literal>rtrim('testxxzx', 'xyz')</literal>
<returnvalue>test</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -4138,6 +4138,46 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start and end of
<parameter>bytes</parameter>.
</para>
<para>
<literal>btrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x345678</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ltrim</primary>
</indexterm>
<function>ltrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start of
<parameter>bytes</parameter>.
</para>
<para>
<literal>ltrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x34567890</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -4196,6 +4236,26 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rtrim</primary>
</indexterm>
<function>rtrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the end of
<parameter>bytes</parameter>.
</para>
<para>
<literal>rtrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x12345678</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -4306,26 +4366,6 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start and end of
<parameter>bytes</parameter>.
</para>
<para>
<literal>btrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x345678</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -4406,26 +4446,6 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ltrim</primary>
</indexterm>
<function>ltrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start of
<parameter>bytes</parameter>.
</para>
<para>
<literal>ltrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x34567890</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -4444,26 +4464,6 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rtrim</primary>
</indexterm>
<function>rtrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
</para>
<para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the end of
<parameter>bytes</parameter>.
</para>
<para>
<literal>rtrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x12345678</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
@ -18354,16 +18354,14 @@ SELECT NULLIF(value, '(none)') ...
largest or smallest value from a list of any number of expressions.
The expressions must all be convertible to a common data type, which
will be the type of the result
(see <xref linkend="typeconv-union-case"/> for details). NULL values
in the list are ignored. The result will be NULL only if all the
expressions evaluate to NULL.
(see <xref linkend="typeconv-union-case"/> for details).
</para>
<para>
Note that <function>GREATEST</function> and <function>LEAST</function> are not in
the SQL standard, but are a common extension. Some other databases
make them return NULL if any argument is NULL, rather than only when
all are NULL.
NULL values in the argument list are ignored. The result will be NULL
only if all the expressions evaluate to NULL. (This is a deviation from
the SQL standard. According to the standard, the return value is NULL if
any argument is NULL. Some other databases behave this way.)
</para>
</sect2>
</sect1>