-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cubesql): Correctly type
pg_index
fields
- Loading branch information
1 parent
f7efec9
commit edadaf1
Showing
4 changed files
with
139 additions
and
19 deletions.
There are no files selected for viewing
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
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
8 changes: 8 additions & 0 deletions
8
...esql/src/compile/snapshots/cubesql__compile__tests__metabase_introspection_indoption.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,8 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(r#\"\n SELECT\n tmp.TABLE_CAT,\n tmp.TABLE_SCHEM,\n tmp.TABLE_NAME,\n tmp.NON_UNIQUE,\n tmp.INDEX_QUALIFIER,\n tmp.INDEX_NAME,\n tmp.TYPE,\n tmp.ORDINAL_POSITION,\n trim(\n both '\"'\n from\n pg_catalog.pg_get_indexdef(tmp.CI_OID, tmp.ORDINAL_POSITION, false)\n ) AS COLUMN_NAME,\n CASE\n tmp.AM_NAME\n WHEN 'btree' THEN CASE\n tmp.I_INDOPTION [tmp.ORDINAL_POSITION - 1] & 1 :: smallint\n WHEN 1 THEN 'D'\n ELSE 'A'\n END\n ELSE NULL\n END AS ASC_OR_DESC,\n tmp.CARDINALITY,\n tmp.PAGES,\n tmp.FILTER_CONDITION\n FROM\n (\n SELECT\n NULL AS TABLE_CAT,\n n.nspname AS TABLE_SCHEM,\n ct.relname AS TABLE_NAME,\n NOT i.indisunique AS NON_UNIQUE,\n NULL AS INDEX_QUALIFIER,\n ci.relname AS INDEX_NAME,\n CASE\n i.indisclustered\n WHEN true THEN 1\n ELSE CASE\n am.amname\n WHEN 'hash' THEN 2\n ELSE 3\n END\n END AS TYPE,\n (information_schema._pg_expandarray(i.indkey)).n AS ORDINAL_POSITION,\n ci.reltuples AS CARDINALITY,\n ci.relpages AS PAGES,\n pg_catalog.pg_get_expr(i.indpred, i.indrelid) AS FILTER_CONDITION,\n ci.oid AS CI_OID,\n i.indoption AS I_INDOPTION,\n am.amname AS AM_NAME\n FROM\n pg_catalog.pg_class ct\n JOIN pg_catalog.pg_namespace n ON (ct.relnamespace = n.oid)\n JOIN pg_catalog.pg_index i ON (ct.oid = i.indrelid)\n JOIN pg_catalog.pg_class ci ON (ci.oid = i.indexrelid)\n JOIN pg_catalog.pg_am am ON (ci.relam = am.oid)\n WHERE\n true\n AND n.nspname = 'public'\n AND ct.relname = 'IT_Assistance_Needed'\n ) AS tmp\n ORDER BY\n NON_UNIQUE,\n TYPE,\n INDEX_NAME,\n ORDINAL_POSITION\n \"#.to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+-----------+-------------+------------+------------+-----------------+------------+------+------------------+-------------+-------------+-------------+-------+------------------+ | ||
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | NON_UNIQUE | INDEX_QUALIFIER | INDEX_NAME | TYPE | ORDINAL_POSITION | COLUMN_NAME | ASC_OR_DESC | CARDINALITY | PAGES | FILTER_CONDITION | | ||
+-----------+-------------+------------+------------+-----------------+------------+------+------------------+-------------+-------------+-------------+-------+------------------+ | ||
+-----------+-------------+------------+------------+-----------------+------------+------+------------------+-------------+-------------+-------------+-------+------------------+ |