-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WITH SYSTEM VERSIONING
(mariaDB) causes print-schema
to fail
#3570
Comments
Thanks for filling this issue. That written: As it's currently, we do not officially support mariadb, but only mysql. So all features/bugs that are mariadb specific are unfortunate but are not really considered to be bugs with the mysql backend. At some point in the past we decided that we would accept an additional backend for mariadb (see #1882). That would allow to address these low level differences in a much more targeted way. That backend is waiting of someone to sit down and write it. At least I personally do currently not have the capacity for that, but contributions there are welcome. |
Thanks for the response, seems like there's a couple reasons for a dedicated mariadb backend. What would be the bare minimum PR to get support moving in the right direction? It seems like duplicating (feel free to reply at #1882) |
Here's a dump from information_schema using specifically the mysql command line:
It looks like the only difference is in
|
Thanks for investigating and putting up a PR. That's at least a good starting point. |
Setup
Versions
Feature Flags
Problem Description
Enabling tables with system versioning (
WITH SYSTEM VERSIONING
) means there is no output in the schema.rs file.What are you trying to accomplish?
Generate the schema using
diesel print-schema
What is the expected output?
Some invocation of the
diesel::table!
macro inschema.rs
What is the actual output?
No output (just the comment)
Are you seeing any additional errors?
None
Steps to reproduce
System versioned tables are supported in MariaDB (also in IBM DB2, and SQL server, current WIP with PG) but using them seems like Diesel can't reflect the tables. For example:
Creates no output. Dropping
WITH SYSTEM VERSIONING
generates create outputI haven't tried it, but I would have to imagine that application versioning doesn't work either
Context
MySQL doesn't yet support system versioning, so the issue probably stems from some incompatibility there. There are a few small but growing incompatibilities, so it might make sense to have a
mariadb
connection string option (SQLAlchemy went this route for some features where autodetection didn't work well)The clause
WITH SYSTEM VERSIONING
adds two columns hidden by default:ROW_START
andROW_END
. It also creates a quasi-column ("period" type) calledSYSTEM_TIME
that can be selected with a special syntax (select * from my_table for SYSTEM_TIME all
). These column & period names can also be specified. When updating a row, a system versioned table just duplicates the row and changes the end date, to keep a history of all changes without triggers (and hides the historical rows by default).There is also application versioning, which is a bit different but uses similar new syntax & temporal constructs.
Ideally, I think it would be good for Diesel to provide a way to work with system versioned tables (e.g.
.filter(foo).system_time(all)
) since they're slowly popping up in more database flavors. But for now, I'd just be happy if the tables reflect to Rust properly, ignoring any system versioning constructs (though adding the ROW_START and ROW_END columns to reflection would be quite awesome)Links:
If diesel would want to add some more specific SV/AV support, I'd be happy to help architect
Checklist
closed if this is not the case)
The text was updated successfully, but these errors were encountered: