Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional MySQL-style ON UPDATE to columns #959

Merged
merged 3 commits into from
Mar 11, 2018

Conversation

katzyn
Copy link
Contributor

@katzyn katzyn commented Mar 11, 2018

An implementation of feature request #219.

This feature is available in all modes because in may be useful in default mode to.

CREATE TABLE and ALTER TABLE ADD COLUMN syntax is the same as in MySQL.

ALTER TABLE ALTER COLUMN syntax for changing existing columns is not compatible with MySQL, because in MySQL such parameters cannot be changed in regular way, CHANGE should be used instead, but H2 don't have this MySQL extension.

This implementation is not limited to date-time columns and CURRENT_TIMESTAMP function, any column and any expression can be used, just like in DEFAULT.

If update statement does not change any values in a row ON UPDATE column does not change its value, like in MySQL. Explicit value for this column can be specified to prevent execution of ON UPDATE expression also like in MySQL.

Non-standard INFORMATION_SCHEMA.COLUMNS.COLUMN_ON_UPDATE field is introduced. (COLUMN_DEFAULT was already here, so name for ON UPDATE follows this name convention).

Documentation is updated.

Minor issues with building of documentation are also fixed.

@katzyn katzyn mentioned this pull request Mar 11, 2018
@katzyn katzyn merged commit d3bbc1a into h2database:master Mar 11, 2018
@katzyn katzyn deleted the on_update branch March 11, 2018 14:46
@tazmaniax
Copy link

@katzyn thanks for making this improvement! Do you have an idea when this might be included in a release?

@katzyn
Copy link
Contributor Author

katzyn commented Mar 18, 2018

It will be included in the next release, but I have no idea when the next release will be built and published.

You can clone current sources or download them here on GitHub and build database for yourself with jar target:
http://www.h2database.com/html/build.html#building
Some additional testing before the release would be nice.

@cpaika
Copy link

cpaika commented Mar 30, 2018

Really appreciate this improvement! Big help for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants