Cette section explique dans quelle mesure PostgreSQL™ se conforme à la norme SQL en vigueur. Les informations qui suivent ne représentent pas une liste exhaustive de conformance, mais présentent les thèmes principaux utilement et raisonnablement détaillés.
Le nom complet du standard SQL est ISO/IEC 9075 « Database Language SQL ». Le standard est modifié de temps en temps. La mise à jour la plus récente apparaît en 2008. La version 2008 est référencée ISO/IEC 9075:2008, ou plus simplement SQL:2008. Les versions antérieures étaient SQL:2003, SQL:1999 et SQL-92. Chaque version remplace la précédente. Il n'y a donc aucun mérite à revendiquer une compatibilité avec une version antérieure du standard.
Le développement de PostgreSQL™ respecte le standard en vigueur, tant que celui-ci ne s'oppose pas aux fonctionnalités traditionnelles ou au bon sens. Le projet PostgreSQL n'est pas représenté au sein du groupe de travail ISO/IEC 9075 lors de la préparation des versions du standard SQL. Malgré cela, un grand nombre des fonctionnalités requises par le standard SQL sont déjà supportées. Parfois avec une syntaxe ou un fonctionnement légèrement différents. Une meilleure compatibilité est attendue pour les prochaines versions.
SQL-92 définit trois niveaux de conformité : basique (Entry), intermédiaire (Intermediate) et complète (Full). La majorité des systèmes de gestion de bases de données se prétendaient compatibles au standard SQL dès lors qu'ils se conformaient au niveau Entry ; l'ensemble des fonctionnalités des niveaux Intermediate et Full étaient, soit trop volumineux, soit en conflit avec les fonctionnalités implantées.
À partir de SQL99, le standard SQL définit un vaste ensemble de fonctionnalités individuelles à la place des trois niveaux de fonctionnalités définis dans SQL-92. Une grande partie représente les fonctionnalités « centrales » que chaque implantation conforme de SQL doit fournir. Les fonctionnalités restantes sont purement optionnelles. Certaines sont regroupées au sein de « paquetages » auxquels une implantation peut se déclarer conforme. On parle alors de conformité à un groupe de fonctionnalités.
Les standards SQL:2008 et SQL:2003 sont également divisé en parties. Chacune est connue par un pseudonyme. Leur numérotation n'est pas consécutive :
ISO/IEC 9075-1 Framework (SQL/Framework)
ISO/IEC 9075-2 Foundation (SQL/Foundation)
ISO/IEC 9075-3 Call Level Interface (SQL/CLI)
ISO/IEC 9075-4 Persistent Stored Modules (SQL/PSM)
ISO/IEC 9075-9 Management of External Data (SQL/MED)
ISO/IEC 9075-10 Object Language Bindings (SQL/OLB)
ISO/IEC 9075-11 Information and Definition Schemas (SQL/Schemata)
ISO/IEC 9075-13 Routines and Types using the Java Language (SQL/JRT)
ISO/IEC 9075-14 XML-related specifications (SQL/XML)
PostgreSQL™ couvre les parties 1, 2, 9, 11 et 14. La partie 3 est couverte par l'interface ODBC, et la partie 13 est couverte par le plugin PL/Java, mais une conformance exacte n'est pas actuellement vérifiée par ses composants. Il n'y a pas actuellement d'implantations des parties 4 et 10 pour PostgreSQL™.
PostgreSQL supporte la plupart des fonctionnalités majeures de SQL:2008. Sur les 179 fonctionnalités requises pour une conformité « centrale » complète (full Core conformance), PostgreSQL se conforme à plus de 160. De plus, il existe une longue liste de fonctionnalités optionelles supportées. À la date de rédaction de ce document, aucune version de quelque système de gestion de bases de données que ce soit n'affiche une totale conformité au cœur de SQL:2008.
Les deux sections qui suivent présentent la liste des fonctionnalités supportées par PostgreSQL™ et celle des fonctionnalités définies dans SQL:2008 qui ne sont pas encore prises en compte. Ces deux listes sont approximatives : certains détails d'une fonctionnalité présentée comme supportée peuvent ne pas être conformes, alors que de grandes parties d'une fonctionnalité non supportée peuvent être implantées. La documentation principale fournit les informations précises sur ce qui est, ou non, supporté.
Les codes de fonctionnalité contenant un tiret sont des sous-fonctionnalités. Si une sous-fonctionnalité n'est pas supportée, la fonctionnalité elle-même sera déclarée non supportée, alors même que d'autres de ses sous-fonctionnalités le sont.
Identifiant | Paquetage | Description | Commentaire |
---|---|---|---|
B012 | Embedded C | ||
B021 | Direct SQL | ||
E011 | Core | Numeric data types | |
E011-01 | Core | INTEGER and SMALLINT data types | |
E011-02 | Core | REAL, DOUBLE PRECISION, and FLOAT data types | |
E011-03 | Core | DECIMAL and NUMERIC data types | |
E011-04 | Core | Arithmetic operators | |
E011-05 | Core | Numeric comparison | |
E011-06 | Core | Implicit casting among the numeric data types | |
E021 | Core | Character data types | |
E021-01 | Core | CHARACTER data type | |
E021-02 | Core | CHARACTER VARYING data type | |
E021-03 | Core | Character literals | |
E021-04 | Core | CHARACTER_LENGTH function | trims trailing spaces from CHARACTER values before counting |
E021-05 | Core | OCTET_LENGTH function | |
E021-06 | Core | SUBSTRING function | |
E021-07 | Core | Character concatenation | |
E021-08 | Core | UPPER and LOWER functions | |
E021-09 | Core | TRIM function | |
E021-10 | Core | Implicit casting among the character string types | |
E021-11 | Core | POSITION function | |
E021-12 | Core | Character comparison | |
E031 | Core | Identifiers | |
E031-01 | Core | Delimited identifiers | |
E031-02 | Core | Lower case identifiers | |
E031-03 | Core | Trailing underscore | |
E051 | Core | Basic query specification | |
E051-01 | Core | SELECT DISTINCT | |
E051-02 | Core | GROUP BY clause | |
E051-04 | Core | GROUP BY can contain columns not in <select list> | |
E051-05 | Core | Select list items can be renamed | |
E051-06 | Core | HAVING clause | |
E051-07 | Core | Qualified * in select list | |
E051-08 | Core | Correlation names in the FROM clause | |
E051-09 | Core | Rename columns in the FROM clause | |
E061 | Core | Basic predicates and search conditions | |
E061-01 | Core | Comparison predicate | |
E061-02 | Core | BETWEEN predicate | |
E061-03 | Core | IN predicate with list of values | |
E061-04 | Core | LIKE predicate | |
E061-05 | Core | LIKE predicate ESCAPE clause | |
E061-06 | Core | NULL predicate | |
E061-07 | Core | Quantified comparison predicate | |
E061-08 | Core | EXISTS predicate | |
E061-09 | Core | Subqueries in comparison predicate | |
E061-11 | Core | Subqueries in IN predicate | |
E061-12 | Core | Subqueries in quantified comparison predicate | |
E061-13 | Core | Correlated subqueries | |
E061-14 | Core | Search condition | |
E071 | Core | Basic query expressions | |
E071-01 | Core | UNION DISTINCT table operator | |
E071-02 | Core | UNION ALL table operator | |
E071-03 | Core | EXCEPT DISTINCT table operator | |
E071-05 | Core | Columns combined via table operators need not have exactly the same data type | |
E071-06 | Core | Table operators in subqueries | |
E081-01 | Core | SELECT privilege | |
E081-02 | Core | DELETE privilege | |
E081-03 | Core | INSERT privilege at the table level | |
E081-04 | Core | UPDATE privilege at the table level | |
E081-05 | Core | UPDATE privilege at the column level | |
E081-06 | Core | REFERENCES privilege at the table level | |
E081-07 | Core | REFERENCES privilege at the column level | |
E081-08 | Core | WITH GRANT OPTION | |
E081-10 | Core | EXECUTE privilege | |
E091 | Core | Set functions | |
E091-01 | Core | AVG | |
E091-02 | Core | COUNT | |
E091-03 | Core | MAX | |
E091-04 | Core | MIN | |
E091-05 | Core | SUM | |
E091-06 | Core | ALL quantifier | |
E091-07 | Core | DISTINCT quantifier | |
E101 | Core | Basic data manipulation | |
E101-01 | Core | INSERT statement | |
E101-03 | Core | Searched UPDATE statement | |
E101-04 | Core | Searched DELETE statement | |
E111 | Core | Single row SELECT statement | |
E121 | Core | Basic cursor support | |
E121-01 | Core | DECLARE CURSOR | |
E121-02 | Core | ORDER BY columns need not be in select list | |
E121-03 | Core | Value expressions in ORDER BY clause | |
E121-04 | Core | OPEN statement | |
E121-06 | Core | Positioned UPDATE statement | |
E121-07 | Core | Positioned DELETE statement | |
E121-08 | Core | CLOSE statement | |
E121-10 | Core | FETCH statement implicit NEXT | |
E121-17 | Core | WITH HOLD cursors | |
E131 | Core | Null value support (nulls in lieu of values) | |
E141 | Core | Basic integrity constraints | |
E141-01 | Core | NOT NULL constraints | |
E141-02 | Core | UNIQUE constraints of NOT NULL columns | |
E141-03 | Core | PRIMARY KEY constraints | |
E141-04 | Core | Basic FOREIGN KEY constraint with the NO ACTION default for both referential delete action and referential update action | |
E141-06 | Core | CHECK constraints | |
E141-07 | Core | Column defaults | |
E141-08 | Core | NOT NULL inferred on PRIMARY KEY | |
E141-10 | Core | Names in a foreign key can be specified in any order | |
E151 | Core | Transaction support | |
E151-01 | Core | COMMIT statement | |
E151-02 | Core | ROLLBACK statement | |
E152 | Core | Basic SET TRANSACTION statement | |
E152-01 | Core | SET TRANSACTION statement: ISOLATION LEVEL SERIALIZABLE clause | |
E152-02 | Core | SET TRANSACTION statement: READ ONLY and READ WRITE clauses | |
E161 | Core | SQL comments using leading double minus | |
E171 | Core | SQLSTATE support | |
F021 | Core | Basic information schema | |
F021-01 | Core | COLUMNS view | |
F021-02 | Core | TABLES view | |
F021-03 | Core | VIEWS view | |
F021-04 | Core | TABLE_CONSTRAINTS view | |
F021-05 | Core | REFERENTIAL_CONSTRAINTS view | |
F021-06 | Core | CHECK_CONSTRAINTS view | |
F031 | Core | Basic schema manipulation | |
F031-01 | Core | CREATE TABLE statement to create persistent base tables | |
F031-02 | Core | CREATE VIEW statement | |
F031-03 | Core | GRANT statement | |
F031-04 | Core | ALTER TABLE statement: ADD COLUMN clause | |
F031-13 | Core | DROP TABLE statement: RESTRICT clause | |
F031-16 | Core | DROP VIEW statement: RESTRICT clause | |
F031-19 | Core | REVOKE statement: RESTRICT clause | |
F032 | CASCADE drop behavior | ||
F033 | ALTER TABLE statement: DROP COLUMN clause | ||
F034 | Extended REVOKE statement | ||
F034-01 | REVOKE statement performed by other than the owner of a schema object | ||
F034-02 | REVOKE statement: GRANT OPTION FOR clause | ||
F034-03 | REVOKE statement to revoke a privilege that the grantee has WITH GRANT OPTION | ||
F041 | Core | Basic joined table | |
F041-01 | Core | Inner join (but not necessarily the INNER keyword) | |
F041-02 | Core | INNER keyword | |
F041-03 | Core | LEFT OUTER JOIN | |
F041-04 | Core | RIGHT OUTER JOIN | |
F041-05 | Core | Outer joins can be nested | |
F041-07 | Core | The inner table in a left or right outer join can also be used in an inner join | |
F041-08 | Core | All comparison operators are supported (rather than just =) | |
F051 | Core | Basic date and time | |
F051-01 | Core | DATE data type (including support of DATE literal) | |
F051-02 | Core | TIME data type (including support of TIME literal) with fractional seconds precision of at least 0 | |
F051-03 | Core | TIMESTAMP data type (including support of TIMESTAMP literal) with fractional seconds precision of at least 0 and 6 | |
F051-04 | Core | Comparison predicate on DATE, TIME, and TIMESTAMP data types | |
F051-05 | Core | Explicit CAST between datetime types and character string types | |
F051-06 | Core | CURRENT_DATE | |
F051-07 | Core | LOCALTIME | |
F051-08 | Core | LOCALTIMESTAMP | |
F052 | Enhanced datetime facilities | Intervals and datetime arithmetic | |
F053 | OVERLAPS predicate | ||
F081 | Core | UNION and EXCEPT in views | |
F111 | Isolation levels other than SERIALIZABLE | ||
F111-01 | READ UNCOMMITTED isolation level | ||
F111-02 | READ COMMITTED isolation level | ||
F111-03 | REPEATABLE READ isolation level | ||
F131 | Core | Grouped operations | |
F131-01 | Core | WHERE, GROUP BY, and HAVING clauses supported in queries with grouped views | |
F131-02 | Core | Multiple tables supported in queries with grouped views | |
F131-03 | Core | Set functions supported in queries with grouped views | |
F131-04 | Core | Subqueries with GROUP BY and HAVING clauses and grouped views | |
F131-05 | Core | Single row SELECT with GROUP BY and HAVING clauses and grouped views | |
F171 | Multiple schemas per user | ||
F191 | Enhanced integrity management | Referential delete actions | |
F200 | TRUNCATE TABLE statement | ||
F201 | Core | CAST function | |
F221 | Core | Explicit defaults | |
F222 | INSERT statement: DEFAULT VALUES clause | ||
F231 | Privilege tables | ||
F231-01 | TABLE_PRIVILEGES view | ||
F231-02 | COLUMN_PRIVILEGES view | ||
F231-03 | USAGE_PRIVILEGES view | ||
F251 | Domain support | ||
F261 | Core | CASE expression | |
F261-01 | Core | Simple CASE | |
F261-02 | Core | Searched CASE | |
F261-03 | Core | NULLIF | |
F261-04 | Core | COALESCE | |
F271 | Compound character literals | ||
F281 | LIKE enhancements | ||
F302 | INTERSECT table operator | ||
F302-01 | INTERSECT DISTINCT table operator | ||
F302-02 | INTERSECT ALL table operator | ||
F304 | EXCEPT ALL table operator | ||
F311-01 | Core | CREATE SCHEMA | |
F311-02 | Core | CREATE TABLE for persistent base tables | |
F311-03 | Core | CREATE VIEW | |
F311-05 | Core | GRANT statement | |
F321 | User authorization | ||
F361 | Subprogram support | ||
F381 | Extended schema manipulation | ||
F381-01 | ALTER TABLE statement: ALTER COLUMN clause | ||
F381-02 | ALTER TABLE statement: ADD CONSTRAINT clause | ||
F381-03 | ALTER TABLE statement: DROP CONSTRAINT clause | ||
F382 | Alter column data type | ||
F391 | Long identifiers | ||
F392 | Unicode escapes in identifiers | ||
F393 | Unicode escapes in literals | ||
F401 | Extended joined table | ||
F401-01 | NATURAL JOIN | ||
F401-02 | FULL OUTER JOIN | ||
F401-04 | CROSS JOIN | ||
F402 | Named column joins for LOBs, arrays, and multisets | ||
F411 | Enhanced datetime facilities | Time zone specification | differences regarding literal interpretation |
F421 | National character | ||
F431 | Read-only scrollable cursors | ||
F431-01 | FETCH with explicit NEXT | ||
F431-02 | FETCH FIRST | ||
F431-03 | FETCH LAST | ||
F431-04 | FETCH PRIOR | ||
F431-05 | FETCH ABSOLUTE | ||
F431-06 | FETCH RELATIVE | ||
F441 | Extended set function support | ||
F442 | Mixed column references in set functions | ||
F471 | Core | Scalar subquery values | |
F481 | Core | Expanded NULL predicate | |
F491 | Enhanced integrity management | Constraint management | |
F501 | Core | Features and conformance views | |
F501-01 | Core | SQL_FEATURES view | |
F501-02 | Core | SQL_SIZING view | |
F501-03 | Core | SQL_LANGUAGES view | |
F502 | Enhanced documentation tables | ||
F502-01 | SQL_SIZING_PROFILES view | ||
F502-02 | SQL_IMPLEMENTATION_INFO view | ||
F502-03 | SQL_PACKAGES view | ||
F531 | Temporary tables | ||
F555 | Enhanced datetime facilities | Enhanced seconds precision | |
F561 | Full value expressions | ||
F571 | Truth value tests | ||
F591 | Derived tables | ||
F611 | Indicator data types | ||
F651 | Catalog name qualifiers | ||
F661 | Simple tables | ||
F672 | Retrospective check constraints | ||
F701 | Enhanced integrity management | Referential update actions | |
F711 | ALTER domain | ||
F731 | INSERT column privileges | ||
F761 | Session management | ||
F762 | CURRENT_CATALOG | ||
F763 | CURRENT_SCHEMA | ||
F771 | Connection management | ||
F781 | Self-referencing operations | ||
F791 | Insensitive cursors | ||
F801 | Full set function | ||
F850 | Top-level <order by clause> in <query expression> | ||
F851 | <order by clause> in subqueries | ||
F852 | Top-level <order by clause> in views | ||
F855 | Nested <order by clause> in <query expression> | ||
F856 | Nested <fetch first clause> in <query expression> | ||
F857 | Top-level <fetch first clause> in <query expression> | ||
F858 | <fetch first clause> in subqueries | ||
F859 | Top-level <fetch first clause> in views | ||
F860 | <fetch first row count> in <fetch first clause> | ||
F861 | Top-level <result offset clause> in <query expression> | ||
F862 | <result offset clause> in subqueries | ||
F863 | Nested <result offset clause> in <query expression> | ||
F864 | Top-level <result offset clause> in views | ||
F865 | <offset row count> in <result offset clause> | ||
S071 | Enhanced object support | SQL paths in function and type name resolution | |
S092 | Arrays of user-defined types | ||
S095 | Array constructors by query | ||
S096 | Optional array bounds | ||
S111 | Enhanced object support | ONLY in query expressions | |
S211 | Enhanced object support | User-defined cast functions | |
T031 | BOOLEAN data type | ||
T071 | BIGINT data type | ||
T121 | WITH (excluding RECURSIVE) in query expression | ||
T122 | WITH (excluding RECURSIVE) in subquery | ||
T131 | Recursive query | ||
T132 | Recursive query in subquery | ||
T141 | SIMILAR predicate | ||
T151 | DISTINCT predicate | ||
T152 | DISTINCT predicate with negation | ||
T171 | LIKE clause in table definition | ||
T172 | AS subquery clause in table definition | ||
T173 | Extended LIKE clause in table definition | ||
T191 | Enhanced integrity management | Referential action RESTRICT | |
T201 | Enhanced integrity management | Comparable data types for referential constraints | |
T211-01 | Active database, Enhanced integrity management | Triggers activated on UPDATE, INSERT, or DELETE of one base table | |
T211-02 | Active database, Enhanced integrity management | BEFORE triggers | |
T211-03 | Active database, Enhanced integrity management | AFTER triggers | |
T211-04 | Active database, Enhanced integrity management | FOR EACH ROW triggers | |
T211-07 | Active database, Enhanced integrity management | TRIGGER privilege | |
T212 | Enhanced integrity management | Enhanced trigger capability | |
T231 | Sensitive cursors | ||
T241 | START TRANSACTION statement | ||
T271 | Savepoints | ||
T281 | SELECT privilege with column granularity | ||
T312 | OVERLAY function | ||
T321-01 | Core | User-defined functions with no overloading | |
T321-03 | Core | Function invocation | |
T321-06 | Core | ROUTINES view | |
T321-07 | Core | PARAMETERS view | |
T322 | PSM | Overloading of SQL-invoked functions and procedures | |
T323 | Explicit security for external routines | ||
T351 | Bracketed SQL comments (/*...*/ comments) | ||
T441 | ABS and MOD functions | ||
T461 | Symmetric BETWEEN predicate | ||
T501 | Enhanced EXISTS predicate | ||
T551 | Optional key words for default syntax | ||
T581 | Regular expression substring function | ||
T591 | UNIQUE constraints of possibly null columns | ||
T614 | NTILE function | ||
T615 | LEAD and LAG functions | ||
T617 | FIRST_VALUE and LAST_VALUE function | ||
T621 | Enhanced numeric functions | ||
X010 | XML type | ||
X011 | Arrays of XML type | ||
X016 | Persistent XML values | ||
X020 | XMLConcat | ||
X031 | XMLElement | ||
X032 | XMLForest | ||
X034 | XMLAgg | ||
X036 | XMLComment | ||
X037 | XMLPI | ||
X041 | Basic table mapping: nulls absent | ||
X042 | Basic table mapping: null as nil | ||
X043 | Basic table mapping: table as forest | ||
X044 | Basic table mapping: table as element | ||
X045 | Basic table mapping: with target namespace | ||
X046 | Basic table mapping: data mapping | ||
X047 | Basic table mapping: metadata mapping | ||
X048 | Basic table mapping: base64 encoding of binary strings | ||
X049 | Basic table mapping: hex encoding of binary strings | ||
X051 | Advanced table mapping: nulls absent | ||
X052 | Advanced table mapping: null as nil | ||
X053 | Advanced table mapping: table as forest | ||
X054 | Advanced table mapping: table as element | ||
X055 | Advanced table mapping: target namespace | ||
X056 | Advanced table mapping: data mapping | ||
X057 | Advanced table mapping: metadata mapping | ||
X058 | Advanced table mapping: base64 encoding of binary strings | ||
X059 | Advanced table mapping: hex encoding of binary strings | ||
X060 | XMLParse: Character string input and CONTENT option | ||
X061 | XMLParse: Character string input and DOCUMENT option | ||
X070 | XMLSerialize: Character string serialization and CONTENT option | ||
X071 | XMLSerialize: Character string serialization and DOCUMENT option | ||
X072 | XMLSerialize: Character string serialization | ||
X090 | XML document predicate | ||
X120 | XML parameters in SQL routines | ||
X121 | XML parameters in external routines |