← Back to team overview

maria-developers team mailing list archive

Re: Initial prototype for MDEV-10825 Persist exact view definitions DDL


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.20original.20formatting.20for.20views
> 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

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

> 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`
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx