[Maria-developers] Initial prototype for MDEV-10825 Persist exact view definitions DDL

Hi Sergei! This email is a followup to the brief discussion on Zulip here: https://mariadb.zulipchat.com/#narrow/stream/118759-general/topic/preserve.2... You mentioned we store the view's definition (source) inside the FRM. I've used that information to extend the I_S.views table with a source column. The patch is very small, but I have 2 questions: 1. Is this how the feature should look like? I wonder if we should prepend *create view <view-name>* to the SOURCE column, to make it behave very similar to SHOW CREATE VIEW. Perhaps SOURCE as a column name is not the most well chosen name. 2. I don't know if I should use: table->field[11]->store(tables->source.str, tables->source.length, tables->view_creation_ctx->get_client_cs()); or table->field[11]->store(tables->source.str, tables->source.length, cs); when storing the source data. Here is the patch: https://github.com/MariaDB/server/compare/10.6-mdev-10825 As soon as we agree on the complete specs for the feature, I'll clean up test failures in other tests, etc. Vicențiu

Hi, Vicențiu! On Apr 16, Vicențiu Ciorbaru wrote:
Hi Sergei!
This email is a followup to the brief discussion on Zulip here:
https://mariadb.zulipchat.com/#narrow/stream/118759-general/topic/preserve.2...
You mentioned we store the view's definition (source) inside the FRM. I've used that information to extend the I_S.views table with a source column. The patch is very small, but I have 2 questions: 1. Is this how the feature should look like? I wonder if we should prepend *create view <view-name>* to the SOURCE column, to make it behave very similar to SHOW CREATE VIEW.
now it's similar to VIEW_DEFINITION, another column from I_S.VIEWS. In your test it looks quote logical that both column values in the same I_S table start from select.
Perhaps SOURCE as a column name is not the most well chosen name.
Feel free to choose something better. It doesn't have to be short, SQL is rather verbose language, and VIEW_DEFINITION isn't exactly short itself.
2. I don't know if I should use: table->field[11]->store(tables->source.str, tables->source.length, tables->view_creation_ctx->get_client_cs()); or table->field[11]->store(tables->source.str, tables->source.length, cs);
when storing the source data.
Check the frm file, I suspect the source value is the original bytes as received by the server, so in the view charset, not converted. That means, when saving it in a field you need to specify view charset, just as you did in your patch. Try to create a view with non-ascii characters and not in utf8 charset. May be, just change your test to start from `set names latin2` Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (2)
-
Sergei Golubchik
-
Vicențiu Ciorbaru