Appendix G – Errata¶
This concise errata list concerns apparent errors in some of our source literature, such as the SQL standard documents or the ODBC manual. We do not intend this as a comment. Like any errata list, its sole use is to help you avoid confusion if you happen to read one of those texts. And, like any errata list, it’s ephemeral. At some time, the original documents will cease to contain these errors.
Table of Contents
SQL Foundation¶
The data type and size of
CURRENT_ROLEis not defined, but we have assumed that it’s supposed to match the data type and size defined forCURRENT_USER.The Standard declares that precision is the number of “significant digits”. We have to assume they don’t use the usual definition of significant.
The Standard speaks of valid datetime or interval results “according to the Gregorian calendar”. But the Gregorian calendar only validates dates. We assume they mean “based on a 24 hour clock” for times, with adjustments according to the Gregorian calendar in the case of timestamps and (where applicable) intervals.
The word “satisfies” means “is
TRUE” when the context is theHAVINGclause, or “is notFALSE” when the context is a constraint. But it is not clear what “satisfies” means when the context is aWHENclause or a view’sWITH CHECK OPTIONclause. Therefore it is not possible to be sure whether these clauses are “satisfied” if the search conditions that they refer to areUNKNOWN.SQL3’s
BOOLEANdata type should have four values:TRUE,FALSE,UNKNOWNandNULL.For “effect of replacing rows in base tables”, the trigger event is defined as
DELETE. We assume thatUPDATEis meant.The
DROP TABLE ... CASCADEdefinition fails to specify that all dependent triggers will also be dropped. TheDROP TABLE ... RESTRICTdefinition fails to specify that, if there are dependent triggers, the drop will fail. Since analogous statements are true forDROP VIEW, we assume that they should also be true forDROP TABLE.The Standard states six times that the following statement, or a slight variation thereof, is “implicit” (in column definitions etc.):
"CREATE TRIGGER BTN BEFORE DELETE ON TND FOR EACH STATEMENT SET CONSTRAINT CCN DEFERRED"
But
SET CONSTRAINTstatements are illegal within triggers.According to the Standard,
DROP TRIGGERis legal in Core SQL; butCREATE TRIGGERis illegal. We assume that the intent is not to includeDROP TRIGGERin Core SQL either.In the description of <cast specification> there is a reference to an
SQLSTATE error 'Data exception - invalid interval format'; this error does not appear in the list ofSQLSTATEexception conditions so we haven’t been able to provide anSQLSTATEcode for it.The
ASCII_FULLcharacter set does not include the\0character. This contradicts FIPS, and makes casts from bit strings difficult.The Standard’s Section 9.7 <type name determination> has no mention of
BOOLEAN. Neither does Section 10.14.BOOLEANappears to have been forgotten in many places.There is an initial definition of “subtype”. The Standard’s description of UDTs is comprehensible only if this definition is ignored.
The Standard’s definition of “direct subtype” is confusing:
“A type
T(a)is a direct subtype of a typeT(b)ifT(a)is a proper subtype ofT(b)and there does not exist a typeT(c)such thatT(c)is a proper subtype ofT(b)and a proper subtype ofT(a).”Perhaps it should read:
“A type
T(a)is a direct subtype of a typeT(b)ifT(a)is a proper subtype ofT(b)and there does not exist a typeT(c)such thatT(c)is a proper subtype ofT(b)and a proper supertype ofT(a).”If this emendation is correct, then the terms “every direct supertype” and “every direct supertable” are misleading; more English are the terms “the direct supertype” and “the direct supertable”, passim.
The
CREATE TYPEdefinition contains a contradiction:"4) If <subtype clause> is not specified, then <representation> shall be specified. 5) If <subtype clause> is not specified, then NOT FINAL shall be specified. 6) If <representation> specifies <predefined type>, then: a) ... b) FINAL shall be specified. c) <subtype clause> shall not be specified."We have made no assumption as to the Standard’s intent here.
The
BNFnonterminal <method specification> is defined differently in two separate sections. We have made no assumption as to which definition is the correct one.For the
NEWstatement, the Standard contains this suspicious looking grammer:"<new specification> ::= NEW <routine invocation> <new invocation> ::= <method invocation>"
<new invocation> is not used elsewhere. We assume that the definition is actually “
NEW<method invocation>”.If this assumption is incorrect, the first syntax rule for the
NEWstatement seems like it would work only for the main option:“1) Let
RNbe the <routine name> immediately contained in the <routine invocation>. LetMNbe the <qualified identifier> immediately contained inRN.”Possibly what is meant is:
“1) Let
RNbe the <routine name> immediately contained in the <routine invocation> or <method invocation>. LetMNbe the <qualified identifier> immediately contained inRN.”This note looks out of place, and in any case is superseded by Note 243:
“NOTE 242 - The comparison categories of two user-defined types in the same type family must be the same.”
Possibly what is meant is:
“NOTE 242 - The comparison forms of two user-defined types in the same type family must be the same.”
The
INFORMATION_SCHEMA.ATTRIBUTESview definition contains references toTABLE_CATALOGandCOLUMN_DEFAULTcolumns – neither of which are applicable here. We assume they should beUDT_CATALOGandATTRIBUTE_DEFAULT.The
DEFINITION_SCHEMA.ATTRIBUTESbase table is also defined as having two columns –TABLE_CATALOGandTABLE_SCHEMA– which are not applicable here. We assume they should beUDT_CATALOGandUDT_SCHEMA.Also, this table’s columns
USER_DEFINED_TYPE_CATALOG,USER_DEFINED_TYPE_SCHEMAandUSER_DEFINED_TYPE_NAMEare defined on domainINFORMATION_SCHEMA.CHARACTER_DATA.But everywhere else, such columns are defined on domain
INFORMATION_SCHEMA.SQL_IDENTIFIER. We assume the intent is to be consistent here as well.The
NUMERIC_PRECISION_RADIXvalue for datetime / interval data types is unclear. TheGetTypeInfodescription of the ODBC 3.0 manual says: “If the data type is an approximate numeric type, this column contains the value2to indicate thatCOLUMN_SIZEspecifies a number of bits. For exact numeric types, this column contains the value10to indicate thatCOLUMN_SIZEspecifies a number of decimal digits. Otherwise, this column isNULL.”The same section in the SQL/CLI document says:
"r) The value of NUM_PREC_RADIX is Case: i) If the value of PRECISION is the value of a precision, then the radix of that precision. ii) Otherwise, the null value."While the definition of the
DEFINITION_SCHEMA.DATA_TYPE_DESCRIPTORbase table, where this information is stored has this constraint:" CHECK ( ... DATA_TYPE IN ( 'DATE', 'TIME', 'TIMESTAMP', 'TIME WITH TIME ZONE', 'TIMESTAMP WITH TIME ZONE' ) ... AND ( NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX ) IS NOT NULL"From the above quotes, some disagreements are visible:
- The writers of ODBC thought datetime/interval radices are nullable.
- The SQL/CLI writers had no idea
PRECISIONis a nonexistent column but agree that radices can be nullable if a data type has no precision. - The foundation writers thought datetime/interval radices couldn’t be
NULL.
For
GET_TYPE_INFO, we assume the first two quotes reflect the true intent: thatNUMERIC_PRECISION_RADIXvalue for datetimes and intervals isNULL.The definition of the
INFORMATION_SCHEMA.ROLE_ROUTINE_GRANTSview contains:"SELECT ... ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME ... FROM ROUTINE_PRIVILEGES"
But these three columns do not exist in the
ROUTINE_PRIVILEGEStable. We assume these columns should be omitted from the view.The definition of the
INFORMATION_SCHEMA.ROLE_USER_DEFINED_TYPE_GRANTSview contains:"SELECT ... OBJECT_TYPE ... FROM DEFINITION_SCHEMA.USER_DEFINED_TYPE_PRIVILEGES"
But this column does not exist the in
USER_DEFINED_TYPE_PRIVILEGEStable. We assume this column should be omitted from the view.
SQL/CLI¶
- The “Description of CLI item descriptors” says that
DEFERREDis true if the octet length pointer points toSQL NULL DATA. - For
SQLGetTypeInfo,NULLvalues are returned forsql_prefixandsql_suffix– i.e.:NULLis used to mean “blank string”. In other fields it means N/A. - For
SQLExecuteandSQLExecute, the general rules are ordered in such a way that input parameters will be checked for consistencyAFTERexecution. We assume that checking should take place before execution. The embedded SQL document has parameter-checking in the logical place. - The
SQLDisconnectfunction description contains a reference to an exception “active SQL-statement”; we assume this should read “active SQL-transaction”. - The
SQLGetDatafunction description contains a reference toIPandDP, which do not exist. - The
SQLSetDescFieldfunction description suggests that it is illegal to set theSQL_DESC_TYPEfield toSQL_SMALLINT,SQL_INTEGER,SQL_REALorSQL_DOUBLE_PRECISION(or several other legal data types). This is clearly an oversight. - The
SQLSetDescFieldfunction description fails to state that theRecordNumberparameter should be ignored ifFieldIdentifierisSQL_DESC_COUNT. We assume this is the case. - The
SQLGetDescRecfunction description is ambiguous about the field to be used as the source for Length. - For
SQLGetDiagField, the Standard saysSQL_DIAG_MOREis associated with a return of'Y'or'N'. ButSQL_DIAG_MOREis not defined as a string. - For
SQLGetLength: exception “Invalid argument value” is undefined. - For
SQLColumns: for a <fractional seconds precision>, the value is taken fromINFORMATION_SCHEMA.COLUMNS.NUMERIC_PRECISION. The value is actually inINFORMATION_SCHEMA.COLUMNS.DATETIME_PRECISIONand we assume this is the intent. Also: theSQL_DATA_TYPEcolumn has been forgotten; we assume it is included. Also: for calculatingSQL_DATETIME_SUB, the Standard says one is supposed to useINFORMATION_SCHEMA.COLUMNS.DATA_TYPEto look up a'Code'– however, the information is actually in found inINFORMATION_SCHEMA.COLUMNS.INTERVAL_TYPE; we assume this is the intent. - There is an implicit assumption that
CASTis possible between two character sets (otherwise, why bother having character set in the descriptor IDA?). ButCASTis illegal if repertoires differ.