GoogleCloudPlatform / cloud-spanner-emulator

An open source emulator for Cloud Spanner.
Apache License 2.0
273 stars 45 forks source link

INSERT using a SELECT statement broken in 1.5.12 #146

Closed silas closed 11 months ago

silas commented 1 year ago

It seems like the INSERT using a SELECT statement is broken in 1.5.12 when the SELECT table contains a STORED column.

CREATE TABLE test1 (id STRING(MAX) NOT NULL) PRIMARY KEY (id);

CREATE TABLE test2 (
  id STRING(MAX) NOT NULL,
  delete_time TIMESTAMP,
  deleted BOOL NOT NULL AS (delete_time IS NOT NULL) STORED,
) PRIMARY KEY (id);
INSERT INTO test1 (id) SELECT id FROM test2;

Results in the following error:

spanner: code = "Internal", desc = "ZETASQL_RET_CHECK failure (external/com_google_zetasql/zetasql/analyzer/resolver_dml.cc:803) column_index >= 0 (-1 vs. 0) "

If you rerun with the following schema it works:

CREATE TABLE test1 (id STRING(MAX) NOT NULL) PRIMARY KEY (id);

CREATE TABLE test2 (
  id STRING(MAX) NOT NULL,
  delete_time TIMESTAMP,
) PRIMARY KEY (id);
silas commented 11 months ago

Looks to be fixed in GoogleCloudPlatform/cloud-spanner-emulator@v1.5.13