mirror of
https://github.com/MariaDB/server.git
synced 2025-10-16 04:32:16 +02:00
![]() This patch implements basic IDENTITY feature, with the following syntax: <col> GENERATED {ALWAYS AS | BY DEFAULT [ON NULL]} identity_props The following identity_props are acknowleged: - START WITH num - Supported, only positive values - INCREMENT BY num - Supported, only positive values - MAXVALUE num - Supported, only positive values. Engine treating may vary. The following identity_props are recognized and saved in the table metadata, but ignored - ORDER - CYCLE - MINVALUE num The following identity_props are recognized and fully ignored at the parser level. These properties are newly added keywords, however they are not reserved, i.e. can be used as identifiers, column names, etc. just as before: - KEEP - SCALE - SHARD - EXTEND - NOKEEP - NOSCALE - NOSHARD - NOEXTEND The patch is designed in minimalistic manner, re-using existing AUTO_INCREMENT implementation, yet utilizing the default values evaluation mechanism. As a result, it grants usage of CHECK constraints and other table expressions: vcols, default values with identity column. Some notes: * IDENTITY is evaluated as Field's default_value. Even GENERATED ALWAYS is considered "default", since the IDENTITY expression is not determistic. * However, the GENERATED ALWAYS kind cannot be assigned in DMLs in STRICT SQL_MODE. That is, the behavior for users is like other GENERATED ALWAYS columns. * It honors INSERT_ID and uses it. * IDENTITY column is always replicated and saved in mariadb-dump, which is guaranteed by using default_value instead of vcol_expr (vcols, even stored, are usually not replicated) * In frm, it is loaded and saved as a default expression. For that, parse_vcol_expr definition was extended to support things like GENERATED BY DEFAULT, and even GENERATED ALWAYS. That is, no EXTRA2 header had to be added. * struct Autoinc_spec is stored in Item_dentity_next, so table structures are preserved as they were. * New IDENTITY keyword is not reserved Known issues: * LAST_INSERT_ID() is not working for now. * update t set col=default(identity_column) is broken, as reported in MDEV-31854 for nextval. |
||
---|---|---|
.. | ||
archive | ||
atomic | ||
binlog | ||
binlog_encryption | ||
client | ||
compat | ||
csv | ||
encryption | ||
engines | ||
events | ||
federated | ||
funcs_1 | ||
funcs_2 | ||
galera | ||
galera_3nodes | ||
galera_3nodes_sr | ||
galera_sr | ||
gcol | ||
handler | ||
heap | ||
innodb | ||
innodb_fts | ||
innodb_gis | ||
innodb_i_s | ||
innodb_zip | ||
jp | ||
json | ||
large_tests | ||
maria | ||
mariabackup | ||
merge | ||
mtr/t | ||
mtr2 | ||
multi_source | ||
optimizer_unfixed_bugs | ||
parts | ||
perfschema | ||
perfschema_stress | ||
period | ||
plugins | ||
roles | ||
rpl | ||
s3 | ||
sql_sequence | ||
storage_engine | ||
stress | ||
sys_vars | ||
sysschema | ||
unit | ||
vcol | ||
versioning | ||
wsrep |