如何在 Tarantool 中将特定列从一个 table 复制到另一个

How to copy specific columns from one table to another in Tarantool

我有2张表,例如:

table X, columns:
 A integer
 B string
 C number

table X2, columns:
 A integer
 C number

如何在 Tarantool 中将 X 的内容复制到 X2(不包括缺失的列)?

尝试过,但没有成功:

(使用的版本:2.6.2)

你遇到了什么样的错误?我手边没有 2.6.2,但是当我尝试 2.7.0 时一切正常:

tarantool> \set language sql
tarantool> \set delimiter ;
tarantool> CREATE TABLE x (col1 INTEGER PRIMARY KEY, col2 VARCHAR(20), col3 INTEGER);
tarantool> CREATE TABLE x2 (col1 INTEGER PRIMARY KEY, col2 INTEGER);
tarantool> INSERT INTO x VALUES (1, 'a', 10), (2, 'b', 20), (3, 'c', 30);

tarantool> SELECT * FROM x;
---
- metadata:
  - name: COL1
    type: integer
  - name: COL2
    type: string
  - name: COL3
    type: integer
  rows:
  - [1, 'a', 10]
  - [2, 'b', 20]
  - [3, 'c', 30]
...

tarantool> SELECT * FROM x2;
---
- metadata:
  - name: COL1
    type: integer
  - name: COL2
    type: integer
  rows: []
...

tarantool> INSERT INTO x2 SELECT col1, col3 FROM x;

tarantool> SELECT * FROM x2;
---
- metadata:
  - name: COL1
    type: integer
  - name: COL2
    type: integer
  rows:
  - [1, 10]
  - [2, 20]
  - [3, 30]
...