-
Task
-
-
Major
-
Resolution:
Fixed
-
-
-
Some code in sql_table.cc is not friendly to pluggable data types:
In mysql_prepare_alter_table():
if ((def->real_field_type() == MYSQL_TYPE_DATE ||
|
def->real_field_type() == MYSQL_TYPE_NEWDATE ||
|
def->real_field_type() == MYSQL_TYPE_DATETIME ||
|
def->real_field_type() == MYSQL_TYPE_DATETIME2) &&
|
!alter_ctx->datetime_field &&
|
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
|
thd->variables.sql_mode & MODE_NO_ZERO_DATE)
|
{
|
alter_ctx->datetime_field= def;
|
alter_ctx->error_if_not_empty= TRUE;
|
}
|
|
In mysql_alter_table():
switch (alter_ctx.datetime_field->real_field_type())
|
{
|
case MYSQL_TYPE_DATE:
|
case MYSQL_TYPE_NEWDATE:
|
f_val= "0000-00-00";
|
t_type= MYSQL_TIMESTAMP_DATE;
|
break;
|
case MYSQL_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME2:
|
f_val= "0000-00-00 00:00:00";
|
t_type= MYSQL_TIMESTAMP_DATETIME;
|
break;
|
default:
|
/* Shouldn't get here. */
|
DBUG_ASSERT(0);
|
}
|
Let's split this code into two new virtual methods in Type_handler:
virtual const Name default_value() const;
|
virtual bool validate_implicit_default_value(THD *thd,
|
const Column_definition &def)
|
const;
|
- blocks
-
MDEV-4912
Data type plugin API version 1
-
-
Closed
Alexander Barkov
made changes -
Description
|
Some code in sql_table.cc is not friendly to pluggable data types:
In mysql_prepare_alter_table():
{code:cpp}
if ((def->real_field_type() == MYSQL_TYPE_DATE ||
def->real_field_type() == MYSQL_TYPE_NEWDATE ||
def->real_field_type() == MYSQL_TYPE_DATETIME ||
def->real_field_type() == MYSQL_TYPE_DATETIME2) &&
!alter_ctx->datetime_field &&
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
thd->variables.sql_mode & MODE_NO_ZERO_DATE)
{
alter_ctx->datetime_field= def;
alter_ctx->error_if_not_empty= TRUE;
}
{code}
In mysql_alter_table():
{code:cpp}
switch (alter_ctx.datetime_field->real_field_type())
{
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_NEWDATE:
f_val= "0000-00-00";
t_type= MYSQL_TIMESTAMP_DATE;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_DATETIME2:
f_val= "0000-00-00 00:00:00";
t_type= MYSQL_TIMESTAMP_DATETIME;
break;
default:
/* Shouldn't get here. */
DBUG_ASSERT(0);
}
{code}
Let's split this code into two new virtual methods in {{Type_handler}}:
{code:cpp}
virtual const Name default_value() const= 0;
virtual bool validate_implicit_default_value(THD *thd,
const Column_definition &def)
const;
{code}
|
Some code in sql_table.cc is not friendly to pluggable data types:
In mysql_prepare_alter_table():
{code:cpp}
if ((def->real_field_type() == MYSQL_TYPE_DATE ||
def->real_field_type() == MYSQL_TYPE_NEWDATE ||
def->real_field_type() == MYSQL_TYPE_DATETIME ||
def->real_field_type() == MYSQL_TYPE_DATETIME2) &&
!alter_ctx->datetime_field &&
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
thd->variables.sql_mode & MODE_NO_ZERO_DATE)
{
alter_ctx->datetime_field= def;
alter_ctx->error_if_not_empty= TRUE;
}
{code}
In mysql_alter_table():
{code:cpp}
switch (alter_ctx.datetime_field->real_field_type())
{
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_NEWDATE:
f_val= "0000-00-00";
t_type= MYSQL_TIMESTAMP_DATE;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_DATETIME2:
f_val= "0000-00-00 00:00:00";
t_type= MYSQL_TIMESTAMP_DATETIME;
break;
default:
/* Shouldn't get here. */
DBUG_ASSERT(0);
}
{code}
Let's split this code into two new virtual methods in {{Type_handler}}:
{code:cpp}
virtual const Name default_value() const;
virtual bool validate_implicit_default_value(THD *thd,
const Column_definition &def)
const;
{code}
|
Alexander Barkov
made changes -
issue.field.resolutiondate
|
2019-05-28 13:04:10.0
|
2019-05-28 13:04:10.176
|
Alexander Barkov
made changes -
Fix Version/s
|
|
10.5.0
[ 23709
]
|
Fix Version/s
|
10.5
[ 23123
]
|
|
Resolution
|
|
Fixed
[ 1
]
|
Status
|
Open
[ 1
]
|
Closed
[ 6
]
|
Sergei Golubchik
made changes -
Workflow
|
MariaDB v3
[ 97014
]
|
MariaDB v4
[ 133974
]
|
{"report":{"fcp":864.9000000953674,"ttfb":269.80000019073486,"pageVisibility":"visible","entityId":76304,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"02b5bfda-52d6-4a20-bb01-cb48f2d71093","navigationType":0,"readyForUser":1010.0999999046326,"redirectCount":0,"resourceLoadedEnd":936.5,"resourceLoadedStart":276.2000002861023,"resourceTiming":[{"duration":24,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":276.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":276.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":300.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":24,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":276.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":276.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":300.5,"responseStart":0,"secureConnectionStart":0},{"duration":82.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":276.7000002861023,"connectEnd":276.7000002861023,"connectStart":276.7000002861023,"domainLookupEnd":276.7000002861023,"domainLookupStart":276.7000002861023,"fetchStart":276.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":276.7000002861023,"responseEnd":359.40000009536743,"responseStart":359.40000009536743,"secureConnectionStart":276.7000002861023},{"duration":167,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":276.90000009536743,"connectEnd":276.90000009536743,"connectStart":276.90000009536743,"domainLookupEnd":276.90000009536743,"domainLookupStart":276.90000009536743,"fetchStart":276.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":276.90000009536743,"responseEnd":443.90000009536743,"responseStart":443.90000009536743,"secureConnectionStart":276.90000009536743},{"duration":172.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":277,"connectEnd":277,"connectStart":277,"domainLookupEnd":277,"domainLookupStart":277,"fetchStart":277,"redirectEnd":0,"redirectStart":0,"requestStart":277,"responseEnd":449.2000002861023,"responseStart":449.2000002861023,"secureConnectionStart":277},{"duration":172.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":277.2000002861023,"connectEnd":277.2000002861023,"connectStart":277.2000002861023,"domainLookupEnd":277.2000002861023,"domainLookupStart":277.2000002861023,"fetchStart":277.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":277.2000002861023,"responseEnd":449.80000019073486,"responseStart":449.80000019073486,"secureConnectionStart":277.2000002861023},{"duration":174.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":277.40000009536743,"connectEnd":277.40000009536743,"connectStart":277.40000009536743,"domainLookupEnd":277.40000009536743,"domainLookupStart":277.40000009536743,"fetchStart":277.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":277.40000009536743,"responseEnd":451.7000002861023,"responseStart":451.7000002861023,"secureConnectionStart":277.40000009536743},{"duration":240.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":277.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":518.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":174.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":277.80000019073486,"connectEnd":277.80000019073486,"connectStart":277.80000019073486,"domainLookupEnd":277.80000019073486,"domainLookupStart":277.80000019073486,"fetchStart":277.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":277.80000019073486,"responseEnd":452.59999990463257,"responseStart":452.59999990463257,"secureConnectionStart":277.80000019073486},{"duration":240.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":277.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":518.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":176.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":278.09999990463257,"connectEnd":278.09999990463257,"connectStart":278.09999990463257,"domainLookupEnd":278.09999990463257,"domainLookupStart":278.09999990463257,"fetchStart":278.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":278.09999990463257,"responseEnd":454.59999990463257,"responseStart":454.59999990463257,"secureConnectionStart":278.09999990463257},{"duration":538.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":283.7000002861023,"connectEnd":283.7000002861023,"connectStart":283.7000002861023,"domainLookupEnd":283.7000002861023,"domainLookupStart":283.7000002861023,"fetchStart":283.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":283.7000002861023,"responseEnd":822.4000000953674,"responseStart":822.4000000953674,"secureConnectionStart":283.7000002861023},{"duration":574.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":283.80000019073486,"connectEnd":283.80000019073486,"connectStart":283.80000019073486,"domainLookupEnd":283.80000019073486,"domainLookupStart":283.80000019073486,"fetchStart":283.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":283.80000019073486,"responseEnd":858,"responseStart":858,"secureConnectionStart":283.80000019073486},{"duration":308.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":530.8000001907349,"connectEnd":530.8000001907349,"connectStart":530.8000001907349,"domainLookupEnd":530.8000001907349,"domainLookupStart":530.8000001907349,"fetchStart":530.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":530.8000001907349,"responseEnd":839,"responseStart":839,"secureConnectionStart":530.8000001907349},{"duration":204.40000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":855,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":855,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1059.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":57.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":879.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":879.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":936.5,"responseStart":0,"secureConnectionStart":0},{"duration":41.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":880.4000000953674,"connectEnd":880.4000000953674,"connectStart":880.4000000953674,"domainLookupEnd":880.4000000953674,"domainLookupStart":880.4000000953674,"fetchStart":880.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":880.4000000953674,"responseEnd":922,"responseStart":922,"secureConnectionStart":880.4000000953674},{"duration":47.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":881,"connectEnd":881,"connectStart":881,"domainLookupEnd":881,"domainLookupStart":881,"fetchStart":881,"redirectEnd":0,"redirectStart":0,"requestStart":881,"responseEnd":928.5,"responseStart":928.5,"secureConnectionStart":881}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":94,"responseStart":270,"responseEnd":275,"domLoading":274,"domInteractive":1092,"domContentLoadedEventStart":1092,"domContentLoadedEventEnd":1154,"domComplete":1368,"loadEventStart":1368,"loadEventEnd":1369,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1066.2000002861023},{"name":"bigPipe.sidebar-id.end","time":1067},{"name":"bigPipe.activity-panel-pipe-id.start","time":1067.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1069.7000002861023},{"name":"activityTabFullyLoaded","time":1180.7000002861023}],"measures":[],"correlationId":"f5ebf2cd4977bc","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":110,"dbReadsTimeInMs":15,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}