DB::Exception: 从 localhost:8000 接收。 DB::Exception:列数不匹配

Posted

技术标签:

【中文标题】DB::Exception: 从 localhost:8000 接收。 DB::Exception:列数不匹配【英文标题】:DB::Exception: Received from localhost:8000. DB::Exception: Number of columns doesn't match 【发布时间】:2020-05-27 12:45:03 【问题描述】:

创建表:-

CREATE TABLE default.bankIfsc (
`event_date` Date DEFAULT toDate(now()), 
`id` Int32, 
`uid` Int32, 
`nid` Int32, 
`bank` String, 
`ifsc_code` String, 
`micr_code` String, 
`branch` String, 
`address` String, 
`contact` String, 
`city` String, 
`district` String, 
`state` String, 
`content` String, 
`feature_image` String, 
`var1` String, 
`var2` String, 
`var3` String, 
`var4` String, 
`var5` String, 
`createdtime` Int32, 
`createdtimestr` DateTime DEFAULT toDateTime(createdtime), 
`updatedtime` Int32, 
`updatedtimestr` DateTime DEFAULT toDateTime(updatedtime), 
`status` Int32) ENGINE = ReplacingMergeTree(event_date, id, 8192)

此表和表视图中的数据存储区:-

CREATE TABLE default.bankIfsc_bck (
`id` Int32, 
`uid` Int32, 
`nid` Int32, 
`bank` String, 
`ifsc_code` String, 
`micr_code` String, 
`branch` String, 
`address` String, 
`contact` String, 
`city` String, 
`district` String, 
`state` String, 
`content` String, 
`feature_image` String, 
`var1` String, 
`var2` String, 
`var3` String, 
`var4` String, 
`var5` String, 
`createdtime` Int32, 
`createdtimestr` DateTime, 
`updatedtime` Int32, 
`updatedtimestr` DateTime, 
`status` Int32) ENGINE = Log 

插入数据:-

INSERT INTO bankIfsc ( id, uid, nid, bank, ifsc_code, micr_code, branch,
 address, contact, city, district, state, content, feature_image, var1,
 var2, var3, var4, var5, createdtime, createdtimestr, updatedtime, 
updatedtimestr, status ) 
SELECT (id, uid, nid, bank, ifsc_code, micr_code, branch, address, 
contact, city, district, state, content, feature_image, var1, var2, var3, 
var4, var5, createdtime, createdtimestr, updatedtime, updatedtimestr,
 status) 
FROM bankIfsc_bck;

列数不匹配。 遇到这个错误,请大家帮忙

【问题讨论】:

【参考方案1】:
( ) -- makes tuple datatype.

2 columns -- select 1,2
desc (select 1,2)
┌─name─┬─type──┬
│ 1    │ UInt8 │
│ 2    │ UInt8 │
└──────┴───────┴

1 column -- select (1,2)    
desc (select (1,2))
─name────────┬─type────────────────┬
 tuple(1, 2) │ Tuple(UInt8, UInt8) │
─────────────┴─────────────────────┴

从您的选择中删除 ()

SELECT id, uid, nid, bank, ifsc_code, micr_code, branch, address, 
contact, city, district, state, content, feature_image, var1, var2, var3, 
var4, var5, createdtime, createdtimestr, updatedtime, updatedtimestr,
 status
FROM bankIfsc_bck;

【讨论】:

以上是关于DB::Exception: 从 localhost:8000 接收。 DB::Exception:列数不匹配的主要内容,如果未能解决你的问题,请参考以下文章

错误代码:38 DB::Exception:无法解析日期:值太短:无法从字符串解析日期:执行“FUNCTION toDate()”时

clickhouse:如何避免 DB::Exception:除以零

HTTP 状态代码:404 收到错误:代码:47,e.displayText() = DB::Exception:未知标识符:TableauSQL.cnt,e.what() = DB::Excepti

clickhouse未解决 ClickHouse exception, code: 1002 DB::Exception: Directory already exists

“DB::Exception: RangeReader read 7523 rows, but 7550 expected”异常在clickhouse中是啥意思?

clickhouse_driver.errors.ServerException:代码:62.DB::Exception:语法错误