FirebirdSQL / firebird-documentation

Firebird documentation
https://firebirdsql.org/en/documentation/
35 stars 15 forks source link

Error on description of values of IDENTITY_TYPE #168

Closed serval2412 closed 2 years ago

serval2412 commented 2 years ago

Hello, IDENTITY_TYPE is described as this on documentation (3.0 and 4.0) in Appendix D: System Tables: NULL - not an identity column 0 - identity column, GENERATED BY DEFAULT 1 - identity column, GENERATED ALWAYS (not supported in Firebird 3.0, will be introduced in Firebird 4.0)

it corresponds to https://www.ibexpert.net/ibe/pmwiki.php?n=Doc.IDENTITY: "Currently, RDB$IDENTITY_TYPE always stores the value 0 (GENERATED BY DEFAULT) for identity columns and NULL for non-identity columns. In the future this column will be able to store the value 1 (GENERATED ALWAYS) when that type of identity column is supported by Firebird."

But: https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rnfb30-ddl-enhance.html indicates: "Currently, RDB$IDENTITY_TYPE will currently always store the value 1 (by default) for identity columns and NULL for non-identity columns. In the future this column will store the value 0, too (for ALWAYS) when Firebird implements support for this type of identity column. "

and above all in source code src/jrd/constants.h, we got: enum IdentityType { IDENT_TYPE_ALWAYS, IDENT_TYPE_BY_DEFAULT }; So IDENT_TYPE_ALWAYS = 0 and IDENT_TYPE_BY_DEFAULT = 1

Also in doc/sql.extensions/README.identity_columns.txt: 29 Implementation: 30 Two columns have been inserted in RDB$RELATION_FIELDS: RDB$GENERATOR_NAME and RDB$IDENTITY_TYPE. 31 RDB$GENERATOR_NAME stores the automatically created generator for the column. In RDB$GENERATORS, 32 the value of RDB$SYSTEM_FLAG of that generator will be 6. RDB$IDENTITY_TYPE will currently 33 always store the value 1 (by default) for identity columns and NULL for non-identity columns. 34 In the future this column will store the value 0, too (for ALWAYS) when Firebird support this type 35 of identity column.

I know that Firebird comes from a fork of Interbase so either there's a typo in https://www.ibexpert.net/ibe/pmwiki.php?n=Doc.IDENTITY and only Appendix D: System Tables should be fixed to indicated that the current is 1 and corresponds to identity type by default or we got a bug.

mrotteveel commented 2 years ago

Thanks for reporting. You're right, this is a mistake in that appendix, I will publish a fix of fblangref30 and fblangref40.

As an aside, the linked documentation of IB Expert is also about Firebird, and was copied from an older version of the Firebird 3.0 release notes (Firebird 3.0 alpha 1, which possibly contained that mistake as well). Interbase is not involved at all.

serval2412 commented 2 years ago

Thank you for the very quick fix!