66\pset format unaligned
77\pset tuples_only true
88\pset pager off
9+ \timing off
910
1011-- Revert all changes on failure.
1112\set ON_ERROR_ROLLBACK 1
@@ -17,15 +18,23 @@ CREATE EXTENSION IF NOT EXISTS pgtap;
1718SET SEARCH_PATH TO pgstac, pgtap, public;
1819
1920-- Plan the tests.
20- SELECT plan(50 );
21+ SELECT plan(62 );
2122-- SELECT * FROM no_plan();
2223
2324-- Run the tests.
2425
2526-- Core
27+
28+ -- Check that schema exists
2629SELECT has_schema(' pgstac' ::name);
30+
31+ -- Check that PostGIS and PG_Partman extensions are installed and available on the path
2732SELECT has_extension(' postgis' );
2833SELECT has_extension(' pg_partman' );
34+
35+ SELECT has_table(' pgstac' ::name, ' migrations' ::name);
36+
37+
2938SELECT has_function(' pgstac' ::name, ' textarr' , ARRAY[' jsonb' ]);
3039SELECT results_eq(
3140 $$ SELECT textarr(' ["a","b","c"]' ::jsonb) $$,
@@ -46,48 +55,67 @@ SELECT results_eq(
4655 $$ SELECT ' {"a":1,"b":"b"}' ::jsonb $$,
4756 ' properties_idx returns slimmed lower case jsonb'
4857);
58+
59+ SELECT has_function(' pgstac' ::name, ' stac_geom' , ARRAY[' jsonb' ]);
60+ SELECT has_function(' pgstac' ::name, ' stac_datetime' , ARRAY[' jsonb' ]);
61+ SELECT has_function(' pgstac' ::name, ' jsonb_paths' , ARRAY[' jsonb' ]);
62+ SELECT has_function(' pgstac' ::name, ' jsonb_obj_paths' , ARRAY[' jsonb' ]);
63+ SELECT has_function(' pgstac' ::name, ' jsonb_val_paths' , ARRAY[' jsonb' ]);
64+ SELECT has_function(' pgstac' ::name, ' path_includes' , ARRAY[' text[]' ,' text[]' ]);
65+ SELECT has_function(' pgstac' ::name, ' path_excludes' , ARRAY[' text[]' ,' text[]' ]);
66+ SELECT has_function(' pgstac' ::name, ' jsonb_obj_paths_filtered' , ARRAY[' jsonb' ,' text[]' ,' text[]' ]);
67+ SELECT has_function(' pgstac' ::name, ' empty_arr' , ARRAY[' anyarray' ]);
68+ SELECT has_function(' pgstac' ::name, ' filter_jsonb' , ARRAY[' jsonb' ,' text[]' ,' text[]' ]);
69+
70+
4971-- Collections
5072SELECT has_table(' pgstac' ::name, ' collections' ::name);
5173SELECT col_is_pk(' pgstac' ::name, ' collections' ::name, ' id' , ' collections has primary key' );
74+
5275SELECT has_function(' pgstac' ::name, ' create_collection' , ARRAY[' jsonb' ]);
76+ SELECT has_function(' pgstac' ::name, ' update_collection' , ARRAY[' jsonb' ]);
77+ SELECT has_function(' pgstac' ::name, ' upsert_collection' , ARRAY[' jsonb' ]);
5378SELECT has_function(' pgstac' ::name, ' get_collection' , ARRAY[' text' ]);
79+ SELECT has_function(' pgstac' ::name, ' delete_collection' , ARRAY[' text' ]);
5480SELECT has_function(' pgstac' ::name, ' all_collections' , NULL );
55- SELECT has_function(' pgstac' ::name, ' collection_bbox' , ARRAY[' text' ]);
56- SELECT has_function(' pgstac' ::name, ' collection_temporal_extent' , ARRAY[' text' ]);
57- SELECT has_function(' pgstac' ::name, ' update_collection_extents' , NULL );
58-
59- SELECT has_function(' pgstac' ::name, ' collections_trigger_func' , ' collections trigger function exists' );
60- SELECT has_trigger(' pgstac' ::name, ' collections' , ' collections_trigger' , ' trigger exists on collections table' );
6181
6282
6383
6484
6585
6686-- Items
6787SELECT has_table(' pgstac' ::name, ' items' ::name);
68- SELECT col_is_pk(' pgstac' ::name, ' items' , ' id' , NULL );
6988
70- SELECT has_table(' pgstac' ::name, ' items_search' ::name);
71- -- SELECT col_is_pk('pgstac'::name, 'items_search'::name, 'id', 'id should be primary key');
72- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ARRAY[' datetime' ,' id' ]);
73- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' properties' );
74- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' geometry' );
75- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' collection_id' );
89+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ARRAY[' datetime' ,' id' ]);
90+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' properties' );
91+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' geometry' );
92+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' collection_id' );
7693
7794SELECT has_type(' pgstac' ::name, ' item' ::name);
78- SELECT is_partitioned(' pgstac' ::name,' items_search ' ::name);
95+ SELECT is_partitioned(' pgstac' ::name,' items ' ::name);
7996
8097
81- SELECT has_function(' pgstac' ::name, ' feature_to_item' , ARRAY[' jsonb' ]);
82- SELECT has_function(' pgstac' ::name, ' features_to_items' , ARRAY[' jsonb' ]);
8398SELECT has_function(' pgstac' ::name, ' get_item' , ARRAY[' text' ]);
8499SELECT has_function(' pgstac' ::name, ' delete_item' , ARRAY[' text' ]);
85100SELECT has_function(' pgstac' ::name, ' create_item' , ARRAY[' jsonb' ]);
101+ SELECT has_function(' pgstac' ::name, ' update_item' , ARRAY[' jsonb' ]);
102+ SELECT has_function(' pgstac' ::name, ' upsert_item' , ARRAY[' jsonb' ]);
103+
86104
87- SELECT has_function(' pgstac' ::name, ' items_trigger_func' , ' items trigger function exists' );
88- SELECT has_trigger(' pgstac' ::name, ' items' ::name, ' items_trigger' , ' items table has trigger' );
89105
90- SELECT has_view(' pgstac' ::name, ' items_search_partitions' ::name, ' items_search_partitions view exists' );
106+ SELECT has_function(' pgstac' ::name, ' analyze_empty_partitions' , NULL );
107+ SELECT has_function(' pgstac' ::name, ' backfill_partitions' , NULL );
108+ SELECT has_function(' pgstac' ::name, ' items_trigger_stmt_func' , NULL );
109+
110+
111+ SELECT has_view(' pgstac' ::name, ' all_items_partitions' ::name, ' all_items_partitions view exists' );
112+ SELECT has_view(' pgstac' ::name, ' items_partitions' ::name, ' items_partitions view exists' );
113+
114+ -- tools to update collection extents based on extents in items
115+ SELECT has_function(' pgstac' ::name, ' collection_bbox' , ARRAY[' text' ]);
116+ SELECT has_function(' pgstac' ::name, ' collection_temporal_extent' , ARRAY[' text' ]);
117+ SELECT has_function(' pgstac' ::name, ' update_collection_extents' , NULL );
118+
91119
92120
93121-- Search
@@ -107,7 +135,6 @@ SELECT has_function('pgstac'::name, 'filter_by_order', ARRAY['item','jsonb','tex
107135SELECT has_function(' pgstac' ::name, ' search_dtrange' , ARRAY[' jsonb' ]);
108136SELECT has_function(' pgstac' ::name, ' search' , ARRAY[' jsonb' ]);
109137
110-
111138-- Finish the tests and clean up.
112139SELECT * FROM finish();
113- ROLLBACK ;
140+ ROLLBACK ;
0 commit comments