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

sql: feature request: auto-refill column upon update of another column #28281

Closed
tim-o opened this issue Aug 6, 2018 · 6 comments
Closed

sql: feature request: auto-refill column upon update of another column #28281

tim-o opened this issue Aug 6, 2018 · 6 comments
Labels
A-schema-descriptors Relating to SQL table/db descriptor handling. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community T-sql-queries SQL Queries Team

Comments

@tim-o
Copy link
Contributor

tim-o commented Aug 6, 2018

FEATURE REQUEST

Please describe the feature you are requesting, as well as your proposed use case.

From the forum: https://forum.cockroachlabs.com/t/on-update-current-timestamp/1895

We currently support DEFAULT current_timestamp() when creating a table, but do not support the additional ON UPDATE current_timestamp() default, as described here in the mysql docs: https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html. The consequence (I believe) is that users would need to manage updates in app in order to adopt CRDB.

Jira issue: CRDB-4916

@tim-o tim-o added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community A-schema-changes labels Aug 6, 2018
@leomkkwan
Copy link

I brought this up in the forum. I believe in Postgre world, this needs to handle with trigger. CRDB does not have trigger now, but I believe the last modified date for a row is a very needed feature. Are there any internal/hidden column which contains this info?

@knz knz added A-schema-descriptors Relating to SQL table/db descriptor handling. and removed A-schema-changes labels Aug 17, 2018
@knz knz changed the title sql: users request support for "ON UPDATE current_timestamp()" sql: auto-refill column upon update of another column Aug 17, 2018
@knz knz changed the title sql: auto-refill column upon update of another column sql: feature request: auto-refill column upon update of another column Aug 17, 2018
@wzrdtales
Copy link

some ping after almost 2 years now :)

@wzrdtales
Copy link

I think this wouldn't be too hard to implement. It would insert into the executed query an update for all the onUpdate configured columns (probably similar to comments?) and the rest doesn't needs to be touched. So it needs additional metadata and similar action like defaultValue for inserting data.

@vy-ton
Copy link
Contributor

vy-ton commented Oct 20, 2021

@rafiss Can this be closed?

@jordanlewis
Copy link
Member

This is solved, we added ON UPDATE.

@NC-Cj
Copy link

NC-Cj commented Sep 27, 2023

Now how do I Automatically update the timestamp?
@jordanlewis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-schema-descriptors Relating to SQL table/db descriptor handling. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community T-sql-queries SQL Queries Team
Projects
Archived in project
Development

No branches or pull requests

7 participants