Commit 6c6d6fbf authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix bug: When a table is created ... AS SELECT ... the offsets (FLAG value)

  of the source table columns must be ignored by the created table.

modified:
  storage/connect/ha_connect.cc
  storage/connect/ha_connect.h
parent 322a99b0
......@@ -545,7 +545,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
valid_query_id= 0;
creat_query_id= (table && table->in_use) ? table->in_use->query_id : 0;
stop= false;
//hascond= false;
createas= false;
indexing= -1;
data_file_name= NULL;
index_file_name= NULL;
......@@ -1065,7 +1065,8 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf)
pcf->Length= 256; // BLOB?
if (fop) {
pcf->Offset= fop->offset;
// Offset must be set to default when the table is created AS select
pcf->Offset= (createas) ? -1 : fop->offset;
// pcf->Freq= fop->freq;
pcf->Datefmt= (char*)fop->dateformat;
pcf->Fieldfmt= (char*)fop->fieldformat;
......@@ -3050,8 +3051,9 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (newmode == MODE_WRITE) {
switch (thd->lex->sql_command) {
case SQLCOM_INSERT:
case SQLCOM_CREATE_TABLE:
createas= true;
case SQLCOM_INSERT:
case SQLCOM_LOAD:
case SQLCOM_INSERT_SELECT:
newmode= MODE_INSERT;
......
......@@ -395,7 +395,7 @@ const char *GetValStr(OPVAL vop, bool neg);
XINFO xinfo; // The table info structure
bool valid_info; // True if xinfo is valid
bool stop; // Used when creating index
//bool hascond; // Too late for Delete
bool createas; // True for CREATE TABLE ... AS SELECT
int indexing; // Type of indexing for CONNECT
#if !defined(MARIADB)
PTOS table_options;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment