Commit 7bbcc3e4 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix wrong error "Invalid offset for CVS table" when a special

  column is defined in a CSV table (MDEV-6187)
modified:
  storage/connect/ha_connect.cc
  storage/connect/reldef.h
  storage/connect/tabfmt.cpp
parent 3743e1e0
......@@ -2708,7 +2708,6 @@ int ha_connect::index_next_same(uchar *buf, const uchar *key, uint keylen)
*/
int ha_connect::rnd_init(bool scan)
{
int rc;
PGLOBAL g= ((table && table->in_use) ? GetPlug(table->in_use, xp) :
(xp) ? xp->g : NULL);
DBUG_ENTER("ha_connect::rnd_init");
......@@ -2742,8 +2741,8 @@ int ha_connect::rnd_init(bool scan)
if (xmod == MODE_UPDATE)
bitmap_union(table->read_set, table->write_set);
if ((rc= OpenTable(g, xmod == MODE_DELETE)))
DBUG_RETURN(rc);
if (OpenTable(g, xmod == MODE_DELETE))
DBUG_RETURN(HA_ERR_INITIALIZATION);
xp->nrd= xp->fnd= xp->nfd= 0;
xp->tb1= my_interval_timer();
......
......@@ -195,6 +195,7 @@ class DllExport COLDEF : public COLCRT { /* Column description block
int GetPoff(void) {return Poff;}
int Define(PGLOBAL g, void *memp, PCOLINFO cfp, int poff);
void Define(PGLOBAL g, PCOL colp);
bool IsSpecial(void) {return (Flags & U_SPECIAL) ? true : false;}
protected:
int Buf_Type; /* Internal data type */
......
......@@ -406,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
// Double check correctness of offset values
if (Catfunc == FNC_NO)
for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext())
if (cdp->GetOffset() < 1) {
if (cdp->GetOffset() < 1 && !cdp->IsSpecial()) {
strcpy(g->Message, MSG(BAD_OFFSET_VAL));
return true;
} // endif Offset
......
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