SQL Conformance

Appendix C. SQL Conformance

Table of Contents
C.1. Supported Features
C.2. Unsupported Features

This section attempts to outline to what extent PostgreSQL conforms to the SQL standard. Full compliance to the standard or a complete statement about the compliance to the standard is complicated and not particularly useful, so this section can only give an overview.

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 one appearing in 1999. That version is refered to as ISO/IEC 9075:1999, or informally as SQL99. The version prior to that was SQL92. PostgreSQL development tends to aim for conformance with the latest official version of the standard where such conformance does not contradict traditional features or common sense. At the time of this writing, ballotting is under way for a new revision of the standard, which, if approved, will eventually become the conformance target for future PostgreSQL development.

SQL92 defined three feature sets for conformance: Entry, Intermediate, and Full. Most database products 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.

SQL99 defines a large set of individual features rather than the ineffectively broad three levels found in SQL92. 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. Some optional features are grouped together to form "packages", which SQL implementations can claim conformance to, thus claiming conformance to particular groups of features.

The SQL99 standard is also split into 5 parts: Framework, Foundation, Call Level Interface, Persistent Stored Modules, and Host Language Bindings. PostgreSQL only covers parts 1, 2, and 5. Part 3 is similar to the ODBC interface, and part 4 is similar to the PL/pgSQL programming language, but exact conformance is not specifically intended in either case.

In the following two sections, we provide a list of those features that PostgreSQL supports, followed by a list of the features defined in SQL99 which are not yet supported in PostgreSQL. Both of these lists are approximate: There may be minor details that are nonconforming for a feature that is listed as supported, and large parts of an unsupported feature may 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.

C.1. Supported Features

B012CoreEmbedded C 
B021 Direct SQL 
E011CoreNumeric data types 
E011-01CoreINTEGER and SMALLINT data types 
E011-02CoreREAL, DOUBLE PRECISON, and FLOAT data types 
E011-03CoreDECIMAL and NUMERIC data types 
E011-04CoreArithmetic operators 
E011-05CoreNumeric comparison 
E011-06CoreImplicit casting among the numeric data types 
E021CoreCharacter data types 
E021-01CoreCHARACTER data type 
E021-02CoreCHARACTER VARYING data type 
E021-03CoreCharacter literals 
E021-04CoreCHARACTER_LENGTH function 
E021-05CoreOCTET_LENGTH function 
E021-06CoreSUBSTRING function 
E021-07CoreCharacter concatenation 
E021-08CoreUPPER and LOWER functions 
E021-09CoreTRIM function 
E021-10CoreImplicit casting among the character data types 
E021-11CorePOSITION function 
E011-12CoreCharacter comparison 
E031-01CoreDelimited identifiers 
E031-02CoreLower case identifiers 
E031-03CoreTrailing underscore 
E051CoreBasic query specification 
E051-02CoreGROUP BY clause 
E051-04CoreGROUP BY can contain columns not in <select list> 
E051-05CoreSelect list items can be renamedAS is required
E051-06CoreHAVING clause 
E051-07CoreQualified * in select list 
E051-08CoreCorrelation names in the FROM clause 
E051-09CoreRename columns in the FROM clause 
E061CoreBasic predicates and search conditions 
E061-01CoreComparison predicate 
E061-02CoreBETWEEN predicate 
E061-03CoreIN predicate with list of values 
E061-04CoreLIKE predicate 
E061-05CoreLIKE predicate ESCAPE clause 
E061-06CoreNULL predicate 
E061-07CoreQuantified comparison predicate 
E061-08CoreEXISTS predicate 
E061-09CoreSubqueries in comparison predicate 
E061-11CoreSubqueries in IN predicate 
E061-12CoreSubqueries in quantified comparison predicate 
E061-13CoreCorrelated subqueries 
E061-14CoreSearch condition 
E071CoreBasic query expressions 
E071-01CoreUNION DISTINCT table operator 
E071-02CoreUNION ALL table operator 
E071-03CoreEXCEPT DISTINCT table operator 
E071-05CoreColumns combined via table operators need not have exactly the same data type 
E071-06CoreTable operators in subqueries 
E081-01CoreSELECT privilege 
E081-02CoreDELETE privilege 
E081-03CoreINSERT privilege at the table level 
E081-04CoreUPDATE privilege at the table level 
E081-06CoreREFERENCES privilege at the table level 
E091CoreSet functions 
E091-06CoreALL quantifier 
E091-07CoreDISTINCT quantifier 
E101CoreBasic data manipulation 
E101-01CoreINSERT statement 
E101-03CoreSearched UPDATE statement 
E101-04CoreSearched DELETE statement 
E111CoreSingle row SELECT statement 
E121-02CoreORDER BY columns need not be in select list 
E121-03CoreValue expressions in ORDER BY clause 
E121-08CoreCLOSE statement(cursor)
E121-10CoreFETCH statement implicit NEXT 
E131CoreNull value support (nulls in lieu of values) 
E141CoreBasic integrity constraints 
E141-01CoreNOT NULL constraints 
E141-02CoreUNIQUE constraints of NOT NULL columns 
E141-03CorePRIMARY KEY constraints 
E141-04CoreBasic FOREIGN KEY constraint with the NO ACTION default for both referential delete action and referential update action 
E141-06CoreCHECK constraints 
E141-07CoreColumn defaults 
E141-08CoreNOT NULL inferred on PRIMARY KEY 
E141-10CoreNames in a foreign key can be specified in any order 
E151CoreTransaction support 
E151-01CoreCOMMIT statement 
E151-02CoreROLLBACK statement 
E161CoreSQL comments using leading double minus 
F031CoreBasic schema manipulation 
F031-01CoreCREATE TABLE statement to create persistent base tables 
F031-02CoreCREATE VIEW statement 
F031-03CoreGRANT statement 
F031-04CoreALTER TABLE statement: ADD COLUMN clause 
F031-13CoreDROP TABLE statement: RESTRICT clause 
F031-16CoreDROP VIEW statement: RESTRICT clause 
F032 CASCADE drop behavior 
F033 ALTER TABLE statement: DROP COLUMN clause 
F041CoreBasic joined table 
F041-01CoreInner join (but not necessarily the INNER keyword) 
F041-02CoreINNER keyword 
F041-05CoreOuter joins can be nested 
F041-07CoreThe inner table in a left or right outer join can also be used in an inner join 
F041-08CoreAll comparison operators are supported (rather than just =) 
F051CoreBasic date and time 
F051-01CoreDATE data type (including support of DATE literal) 
F051-02CoreTIME data type (including support of TIME literal) with fractional seconds precision of at least 0 
F051-03CoreTIMESTAMP data type (including support of TIMESTAMP literal) with fractional seconds precision of at least 0 and 6 
F051-04CoreComparison predicate on DATE, TIME, and TIMESTAMP data types 
F051-05CoreExplicit CAST between datetime types and character types 
F052Enhanced datetime facilitiesIntervals and datetime arithmetic 
F081CoreUNION and EXCEPT in views 
F111-02 READ COMMITTED isolation level 
F131CoreGrouped operations 
F131-01CoreWHERE, GROUP BY, and HAVING clauses supported in queries with grouped views 
F131-02CoreMultiple tables supported in queries with grouped views 
F131-03CoreSet functions supported in queries with grouped views 
F131-04CoreSubqueries with GROUP BY and HAVING clauses and grouped views 
F131-05CoreSingle row SELECT with GROUP BY and HAVING clauses and grouped views 
F171 Multiple schemas per user 
F191Enhanced integrity managementReferential delete actions 
F201CoreCAST function 
F221CoreExplicit defaults 
F222 INSERT statement: DEFAULT VALUES clause 
F251 Domain support 
F261CoreCASE expression 
F261-01CoreSimple CASE 
F261-02CoreSearched CASE 
F271 Compound character literals 
F281 LIKE enhancements 
F302OLAP facilitiesINTERSECT table operator 
F302-01OLAP facilitiesINTERSECT DISTINCT table operator 
F302-02OLAP facilitiesINTERSECT ALL table operator 
F304OLAP facilitiesEXCEPT ALL table operator 
F311CoreSchema definition statement 
F311-02CoreCREATE TABLE for persistent base tables 
F311-05CoreGRANT 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 
F391 Long identifiers 
F401OLAP facilitiesExtended joined table 
F401-01OLAP facilitiesNATURAL JOIN 
F401-02OLAP facilitiesFULL OUTER JOIN 
F401-03OLAP facilitiesUNION JOIN 
F401-04OLAP facilitiesCROSS JOIN 
F411Enhanced datetime facilitiesTime zone specification 
F421 National character 
F431-01 FETCH with explicit NEXT 
F441 Extended set function support 
F471CoreScalar subquery values 
F481CoreExpanded NULL predicate 
F491Enhanced integrity managementConstraint management 
F511 BIT data type 
F531 Temporary tables 
F555Enhanced datetime facilitiesEnhanced seconds precision 
F561 Full value expressions 
F571 Truth value tests 
F591OLAP facilitiesDerived tables 
F611 Indicator data types 
F651 Catalog name qualifiers 
F701Enhanced integrity managementReferential update actions 
F761 Session management 
F791 Insensitive cursors 
F801 Full set function 
S071Enhanced object supportSQL paths in function and type name resolution 
S111Enhanced object supportONLY in query expressions 
S211Enhanced object support, SQL/MM supportUser-defined cast functions 
T031 BOOLEAN data type 
T141 SIMILAR predicate 
T151 DISTINCT predicate 
T191Enhanced integrity managementReferential action RESTRICT 
T201Enhanced integrity managementComparable data types for referential constraints 
T211-01Enhanced integrity managementTriggers activated on UPDATE, INSERT, or DELETE of one base table 
T211-02Enhanced integrity managementBEFORE triggers 
T211-03Enhanced integrity managementAFTER triggers 
T211-04Enhanced integrity managementFOR EACH ROW triggers 
T211-07Enhanced integrity managementTRIGGER privilege 
T231 SENSITIVE cursors 
T312 OVERLAY function 
T321-01CoreUser-defined functions with no overloading 
T321-03CoreFunction invocation 
T322PSM, SQL/MM supportOverloading of SQL-invoked functions and procedures 
T323 Explicit security for external routines 
T351 Bracketed SQL comments (/*...*/ comments) 
T441 ABS and MOD functions 
T501 Enhanced EXISTS predicate 
T551 Optional key words for default syntax 
T581 Regular expression substring function 
T591 UNIQUE constraints of possibly null columns 

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.