cloudspannerecosystem / memefish

memefish is the foundation to analyze Spanner SQL
https://cloudspannerecosystem.dev/memefish/
MIT License
76 stars 19 forks source link

Incompatibility: Empty column list in {CREATE | ALTER} CHANGE STREAM must be allowed #91

Open apstndb opened 2 months ago

apstndb commented 2 months ago

This incompatibility is detected by #90.

Spec

https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#create-change-stream

CREATE CHANGE STREAM change_stream_name
[ FOR { table_columns [, ... ] | ALL } ]
[ OPTIONS ( change_stream_option [, ... ] ) ]

where table_columns is:
    table_name [ ( [ column_name, ... ] ) ]

table_name ( [column_name, ... ] ): You can optionally specify a list of zero or more non-key columns following the table name. This watches only the primary key and the listed non-key columns of the table. With an empty list of non-key columns, table_name() watches only the primary key.

Reproducing input

CREATE CHANGE STREAM change_stream FOR Users();

Current behavior

syntax error:testdata/change_streams.test:6:46: expected token: <ident>, but: )

  6:  CREATE CHANGE STREAM change_stream FOR Users();
                                                   ^

Note: ALTER CHANGE STREAM also supports empty column lists

ALTER CHANGE STREAM change_stream_name
    action

where action is:
    { SET FOR { table_columns [, ... ] | ALL } |
      DROP FOR ALL |
      SET OPTIONS ( change_stream_option [, ... ] ) }

and table_columns is:
    table_name [ ( [ column_name, ... ] ) ]