You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create or replaceview "pgstac"."partition_sys_meta"asSELECT (parse_ident((pg_partition_tree.relid)::text))[cardinality(parse_ident((pg_partition_tree.relid)::text))] AS partition,
392
+
replace(replace(
393
+
CASE
394
+
WHEN (pg_partition_tree.level=1) THEN pg_get_expr(c.relpartbound, c.oid)
395
+
ELSE pg_get_expr(parent.relpartbound, parent.oid)
396
+
END, 'FOR VALUES IN ('''::text, ''::text), ''')'::text, ''::text) AS collection,
397
+
pg_partition_tree.level,
398
+
c.reltuples,
399
+
c.relhastriggers,
400
+
COALESCE(constraint_tstzrange(pg_get_expr(c.relpartbound, c.oid)), tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS partition_dtrange,
401
+
COALESCE((dt_constraint(edt.oid)).dt, constraint_tstzrange(pg_get_expr(c.relpartbound, c.oid)), tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS constraint_dtrange,
402
+
COALESCE((dt_constraint(edt.oid)).edt, tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS constraint_edtrange
403
+
FROM (((pg_partition_tree('items'::regclass) pg_partition_tree(relid, parentrelid, isleaf, level)
404
+
JOIN pg_class c ON (((pg_partition_tree.relid)::oid=c.oid)))
405
+
JOIN pg_class parent ON ((((pg_partition_tree.parentrelid)::oid=parent.oid) ANDpg_partition_tree.isleaf)))
406
+
LEFT JOIN pg_constraint edt ON (((edt.conrelid=c.oid) AND (edt.contype='c'::"char"))))
407
+
WHEREpg_partition_tree.isleaf;
408
+
409
+
410
+
create or replaceview "pgstac"."partitions_view"asSELECT (parse_ident((pg_partition_tree.relid)::text))[cardinality(parse_ident((pg_partition_tree.relid)::text))] AS partition,
411
+
replace(replace(
412
+
CASE
413
+
WHEN (pg_partition_tree.level=1) THEN pg_get_expr(c.relpartbound, c.oid)
414
+
ELSE pg_get_expr(parent.relpartbound, parent.oid)
415
+
END, 'FOR VALUES IN ('''::text, ''::text), ''')'::text, ''::text) AS collection,
416
+
pg_partition_tree.level,
417
+
c.reltuples,
418
+
c.relhastriggers,
419
+
COALESCE(constraint_tstzrange(pg_get_expr(c.relpartbound, c.oid)), tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS partition_dtrange,
420
+
COALESCE((dt_constraint(edt.oid)).dt, constraint_tstzrange(pg_get_expr(c.relpartbound, c.oid)), tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS constraint_dtrange,
421
+
COALESCE((dt_constraint(edt.oid)).edt, tstzrange('-infinity'::timestamp with time zone, 'infinity'::timestamp with time zone, '[]'::text)) AS constraint_edtrange,
422
+
partition_stats.dtrange,
423
+
partition_stats.edtrange,
424
+
partition_stats.spatial,
425
+
partition_stats.last_updated
426
+
FROM ((((pg_partition_tree('items'::regclass) pg_partition_tree(relid, parentrelid, isleaf, level)
427
+
JOIN pg_class c ON (((pg_partition_tree.relid)::oid=c.oid)))
428
+
JOIN pg_class parent ON ((((pg_partition_tree.parentrelid)::oid=parent.oid) ANDpg_partition_tree.isleaf)))
429
+
LEFT JOIN pg_constraint edt ON (((edt.conrelid=c.oid) AND (edt.contype='c'::"char"))))
430
+
LEFT JOIN partition_stats ON (((parse_ident((pg_partition_tree.relid)::text))[cardinality(parse_ident((pg_partition_tree.relid)::text))] =partition_stats.partition)))
431
+
WHEREpg_partition_tree.isleaf;
432
+
433
+
434
+
CREATE OR REPLACEFUNCTIONpgstac.queryable(dotpath text, OUT pathtext, OUT expression text, OUT wrapper text, OUT nulled_wrapper text)
435
+
RETURNS record
436
+
LANGUAGE plpgsql
437
+
STABLE STRICT
438
+
AS $function$
439
+
DECLARE
440
+
q RECORD;
441
+
path_elements text[];
442
+
BEGIN
443
+
dotpath := replace(dotpath, 'properties.', '');
444
+
IF dotpath ='start_datetime' THEN
445
+
dotpath :='datetime';
446
+
END IF;
447
+
IF dotpath IN ('id', 'geometry', 'datetime', 'end_datetime', 'collection') THEN
448
+
path := dotpath;
449
+
expression := dotpath;
450
+
wrapper :=NULL;
451
+
RETURN;
452
+
END IF;
453
+
454
+
SELECT* INTO q FROM queryables
455
+
WHERE
456
+
name=dotpath
457
+
OR name ='properties.'|| dotpath
458
+
OR name = replace(dotpath, 'properties.', '')
459
+
;
460
+
IF q.property_wrapper IS NULL THEN
461
+
IF q.definition->>'type'='number' THEN
462
+
wrapper :='to_float';
463
+
nulled_wrapper := wrapper;
464
+
ELSIF q.definition->>'format'='date-time' THEN
465
+
wrapper :='to_tstz';
466
+
nulled_wrapper := wrapper;
467
+
ELSE
468
+
nulled_wrapper :=NULL;
469
+
wrapper :='to_text';
470
+
END IF;
471
+
ELSE
472
+
wrapper :=q.property_wrapper;
473
+
nulled_wrapper := wrapper;
474
+
END IF;
475
+
IF q.property_pathIS NOT NULL THEN
476
+
path :=q.property_path;
477
+
ELSE
478
+
path_elements := string_to_array(dotpath, '.');
479
+
IF path_elements[1] IN ('links', 'assets', 'stac_version', 'stac_extensions') THEN
0 commit comments