[MDEV-19029] Better handling of system versioning for generated stored columns Created: 2019-03-23  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Versioned Tables, Virtual Columns
Affects Version/s: 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-18869 Assertion `!((field)->vcol_info && (f... Closed

 Description   

Now generated stored columns are always system versioned. WITH/WITHOUT SYSTEM VERSIONING is not supported for generated columns at parser level:

field_def:
          opt_attribute
        | opt*generated_always AS virtual_column*func
         {
           Lex->last*field->vcol*info= $3;
           Lex->last*field->flags&= ~NOT_NULL*FLAG; // undo automatic NOT NULL for timestamps
         }
          vcol*opt_specifier vcol_opt*attribute
        | opt*generated_always AS ROW_SYM START_SYM opt_asrow*attribute
          {
            if (Lex->last*field_generated_always_as_row*start())
              MYSQL_YYABORT;
          }
        | opt*generated_always AS ROW_SYM END opt_asrow*attribute
          {
            if (Lex->last*field_generated_always_as_row*end())
              MYSQL_YYABORT;
          }
        ;

Better feature would be to detect if all the components of generated stored column are WITHOUT SYSTEM VERSIONING and make it so accordingly. Of course independent WITHOUT SYSTEM VERSIONING for generated stored also makes sense.

Please vote if your production use case will benefit from these features.



 Comments   
Comment by Sergei Golubchik [ 2019-04-09 ]

test case: a system versioned table, a column f1 WITHOUT SYSTEM VERSIONING, a persisten generated column based on f1. Changing f1 should not generate a new history record.

Generated at Thu Feb 08 08:48:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.