diff --git a/pkg/schema/table.go b/pkg/schema/table.go index b97bb8c..aca4f65 100644 --- a/pkg/schema/table.go +++ b/pkg/schema/table.go @@ -39,6 +39,7 @@ type Index struct { Columns []string IsUnique bool `db:"is_unique"` // TODO: `where ...` for partial indexes + // TODO: identify columns that are expressions } type Schema struct { diff --git a/pkg/schema/views.sql b/pkg/schema/views.sql index 915f1c7..d868e28 100644 --- a/pkg/schema/views.sql +++ b/pkg/schema/views.sql @@ -33,7 +33,8 @@ create temporary view indexes as create temporary view index_columns as select indexes.index_name, - idx_cols.name as column_name, + idx_cols.cid as column_idx, + ifnull(idx_cols.name, '') as column_name, idx_cols.seqno as rank from indexes join pragma_index_info(indexes.index_name) as idx_cols; diff --git a/sample_data/test_schemas/food.sql b/sample_data/test_schemas/food.sql index b96bd8a..9ff56f7 100644 --- a/sample_data/test_schemas/food.sql +++ b/sample_data/test_schemas/food.sql @@ -43,6 +43,7 @@ create table foods (rowid integer primary key, cook_ratio real not null default 1 ) strict; create index foods_protein on foods(protein); +create index foods_fake_index on foods(protein + 1); create table units (rowid integer primary key,