daichirata / hammer

🛠 hammer is a command-line tool to schema management for Google Cloud Spanner.
MIT License
83 stars 24 forks source link

JSON_QUERY not recognized #55

Open tomrom-pomelo opened 1 year ago

tomrom-pomelo commented 1 year ago

The following fails when running hammer diff:

CREATE TABLE SomeTable (
  Id String(40),
  Data JSON,
  HasSomeValue BOOL AS (IF(JSON_QUERY(Data, '$.value') IS NOT NULL), true, false)) STORED
) PRIMARY KEY (Id);

with the error:

failed to parse ddl: schema.ddl:<line_num>: got "(" while expecting ","

When I replace JSON_QUERY with JSON_VALUE, though not semantically correct, the tool is able to produce a correct diff.