Skip to content

Duplicate column name 'id' when select count(*) from ... #36

@lunny

Description

@lunny
go get github.com/go-xorm/tidb

and run go test, then it panic. Then we open the db use interpreter, and the result is below.

➜  tidb git:(master) ✗ interpreter -dbpath=./tidb -store=goleveldb
Welcome to the TiDB.
Version:
Git Commit Hash: None
UTC Build Time:  None

tidb> show tables;
+----------------+
| Tables_in_tidb |
+----------------+
| numeric        |
| picture        |
| userdetail     |
| userinfo       |
+----------------+
tidb> select * from userinfo;
2015/09/07 14:58:22 main.go:202: [error] github.com/pingcap/tidb/rset/rsets/join.go:210: Duplicate column name 'id'
github.com/pingcap/tidb/rset/rsets/join.go:104:
github.com/pingcap/tidb/rset/rsets/join.go:225:
github.com/pingcap/tidb/tidb.go:160:
github.com/pingcap/tidb/session.go:133:
github.com/pingcap/tidb/driver.go:309:
github.com/pingcap/tidb/interpreter/main.go:60:
tidb> desc userinfo;
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | BIGINT (20)   | NO   | PRI | NULL    | auto_increment |
| username   | VARCHAR (255) | YES  | UNI | NULL    |                |
| departname | VARCHAR (255) | YES  |     | NULL    |                |
| created    | DATETIME      | YES  |     | NULL    |                |
| detail_id  | INT (11)      | YES  |     | NULL    |                |
| height     | DOUBLE        | YES  |     | NULL    |                |
| avatar     | BLOB          | YES  |     | NULL    |                |
| is_man     | TINYINT (1)   | YES  |     | NULL    |                |
| id         | BIGINT (20)   | NO   | PRI | NULL    | auto_increment |
| username   | VARCHAR (255) | YES  |     | NULL    |                |
| departname | VARCHAR (255) | YES  |     | NULL    |                |
| created    | DATETIME      | YES  |     | NULL    |                |
| detail_id  | INT (11)      | YES  |     | NULL    |                |
| height     | DOUBLE        | YES  |     | NULL    |                |
| avatar     | BLOB          | YES  |     | NULL    |                |
| is_man     | TINYINT (1)   | YES  |     | NULL    |                |
+------------+---------------+------+-----+---------+----------------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions