Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

fix clickhouse (22.2.x) syntax errors #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vitrvvivs
Copy link

@vitrvvivs vitrvvivs commented Mar 7, 2022

Error

{"error": "dao.CreateBlocks: code: 62, message: Cannot parse expression of type UInt64 here: ?, ?, ?, ?, ?, ?) VALUES : While executing ValuesBlockInputFormat"}

Cause

There is a space missing in constructed SQL INSERT statements. This became an parse error in a recent clickhouse update.

INSERT INTO x (...)VALUES (...);
should be
INSERT INTO x (...) VALUES (...);

Error

dao.New{error 26 0  clickhouse.New: newConnection: can`t make makeMigration: migration failed in line 0: --CREATE VIEW IF NOT EXISTS block_row_view AS
--select * from blocks ANY LEFT JOIN
--              (select blk_lvl, sum(tx_gas_price), sum(tx_fee), count()
--from transactions group by blk_lvl) as s USING blk_lvl ORDER BY blk_lvl DESC (details: code: 62, message: Empty query)}

Cause

There appears to have been a regression in the comment parsing, where the semicolon is parsed before the comment indicator. A comment including a semicolon becomes an empty statement.

LEFT JOIN public_validators USING reg_entity_address --public validators 134 rows
;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need the semicolon on the next line here, or else --public validators 134 rows get interpreted as an empty statement.

@vitrvvivs vitrvvivs changed the title fix clickhouse syntax errors fix clickhouse (22.2.x) syntax errors Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant