-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cubesql): Normalize column names for joins and aliased columns
- Loading branch information
1 parent
0f8a522
commit 7faadc9
Showing
5 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__powerbi_from_subquery.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"\n select\n pkcol.COLUMN_NAME as PK_COLUMN_NAME,\n fkcol.TABLE_SCHEMA AS FK_TABLE_SCHEMA,\n fkcol.TABLE_NAME AS FK_TABLE_NAME,\n fkcol.COLUMN_NAME as FK_COLUMN_NAME,\n fkcol.ORDINAL_POSITION as ORDINAL,\n fkcon.CONSTRAINT_SCHEMA || '_' || fkcol.TABLE_NAME || '_' || 'users' || '_' || fkcon.CONSTRAINT_NAME as FK_NAME\n from\n (select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name\n from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon\n inner join\n INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol\n on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA\n and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME\n inner join\n INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol\n on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA\n and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME\n where pkcol.TABLE_SCHEMA = 'public' and pkcol.TABLE_NAME = 'users'\n and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION\n order by FK_NAME, fkcol.ORDINAL_POSITION\n ;\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
++ | ||
++ | ||
++ |
7 changes: 7 additions & 0 deletions
7
...besql/cubesql/src/compile/snapshots/cubesql__compile__tests__powerbi_uppercase_alias.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"\n select\n i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME as INDEX_NAME,\n ii.COLUMN_NAME,\n ii.ORDINAL_POSITION,\n case\n when i.CONSTRAINT_TYPE = 'PRIMARY KEY' then 'Y'\n else 'N'\n end as PRIMARY_KEY\n from INFORMATION_SCHEMA.table_constraints i\n inner join INFORMATION_SCHEMA.key_column_usage ii on\n i.CONSTRAINT_SCHEMA = ii.CONSTRAINT_SCHEMA and\n i.CONSTRAINT_NAME = ii.CONSTRAINT_NAME and\n i.TABLE_SCHEMA = ii.TABLE_SCHEMA and\n i.TABLE_NAME = ii.TABLE_NAME\n where\n i.TABLE_SCHEMA = 'public' and\n i.TABLE_NAME = 'KibanaSampleDataEcommerce' and\n i.CONSTRAINT_TYPE in ('PRIMARY KEY', 'UNIQUE')\n order by\n i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME,\n ii.TABLE_SCHEMA,\n ii.TABLE_NAME,\n ii.ORDINAL_POSITION\n ;\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
++ | ||
++ | ||
++ |