{ "description": "indexes test", "depends": [], "items": [ { "name": "create_body", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "request": { "kind": "create_table", "body": { "primary_key": [ "id" ], "name": "a", "columns": [ { "type": "serial", "name": "id" }, { "type": "integer", "name": "a" }, { "type": "integer", "name": "b" }, { "type": "integer", "name": "c" }, { "type": "varchar", "name": "d" } ] } } }, { "name": "create index only cols", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE INDEX a_a_b_c_d_idx ON a USING btree (a, b, c NULLS FIRST, d DESC)'" ], "request": { "kind": "create_index", "body": { "table": "a", "columns": [ "a", "+b", { "column": "c", "nulls": "first" }, { "column": "d", "nulls": "first", "order": "desc" } ] } } }, { "name": "create index only cols + using", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE INDEX a_a_idx ON a USING btree (a)'" ], "request": { "kind": "create_index", "body": { "table": "a", "using": "btree", "columns": [ "a" ] } } }, { "name": "create index only cols + using + with", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE INDEX a_b_idx ON a USING btree (b) WITH (fillfactor=50)'" ], "request": { "kind": "create_index", "body": { "table": "a", "using": "btree", "with": { "fillfactor": 50 }, "columns": [ "b" ] } } }, { "name": "create index only cols + name", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE INDEX myindex ON a USING btree (c)'" ], "request": { "kind": "create_index", "body": { "name": "myindex", "table": "a", "columns": [ "c" ] } } }, { "name": "create index only cols + unique", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE UNIQUE INDEX a_b_idx1 ON a USING btree (b)'" ], "request": { "kind": "create_index", "body": { "unique": true, "table": "a", "columns": [ "b" ] } } }, { "name": "create index only cols + where", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select * from pg_catalog.pg_indexes where indexdef = 'CREATE INDEX a_b_idx2 ON a USING btree (b) WHERE (((id > 1000) AND true) AND true)'" ], "request": { "kind": "create_index", "body": { "table": "a", "where": { "id": { "$gt": 1000 } }, "columns": [ "b" ] } } }, { "name": "create index only cols + where", "url": "/api/1/query", "role": "admin", "status_code": 200, "method": "POST", "user_id": "1", "sql_check": [ "select 1 where not exists (select * from pg_catalog.pg_indexes where indexname = 'myindex')" ], "request": { "kind": "drop_index", "body": { "index": "myindex" } } } ] }