-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table aliases don't work with ClickHouse #503
Comments
I tried to reproduce this with the latest dbmate v2.10 and ClickHouse 22.8.21.38 on Ubuntu 20.04.6 LTS, and could not reproduce with this: $ mkdir issue_503
$ printf -- '-- migrate:up\ncreate table some_table (some_column int) engine=MergeTree order by some_column;\n-- migrate:down\n' > issue_503/20240105002500_create_table.sql
$ printf -- '-- migrate:up\ncreate view some_view as (select t.some_column from some_table as t);\n-- migrate:down\n' > issue_503/20240105002501_create_view.sql
$ dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 drop
$ dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 -s issue_503/schema.sql up
$ cat issue_503/schema.sql Output:
If you can provide a minimal reproducible example of the issue, I'll try to see if I can reproduce it. |
I tested it with your setup and it worked. I did few more tests. Seems that it's not an issue of dbmate, but a ClickHouse issue. I can reproduce it with ClickHouse 21.8.13, but with the latest versions it works fine. Closing the issue |
Description
If I use table alias in query it is excluded from query and migration fails.
Steps To Reproduce
I've created a table
some_table
in databasemydb
with columnsome_column
, then added migrationand executed
dbmate up
.I've got an error:
Missing columns: 't.some_column' while processing query: 'SELECT t.some_column FROM mydb.some_table', required columns: 't.some_column'
.You can see that
AS t
part was excluded from query.If I replace
SELECT t.some_column
toSELECT some_column
, it works.Expected Behavior
It has to work with given query.
The text was updated successfully, but these errors were encountered: