mirror of https://github.com/hashicorp/boundary
This function was returning the set of deletion tables. A view seems
better suited for this task since it would allow for applying additional
filters of the result set. This was particularly necessary to easily
make changes to some sqltests due to switching the delete trigger for
the session table.
(cherry picked from commit 32d4163989)
pull/5128/head
parent
33037b4887
commit
a92c88dfb5
@ -0,0 +1,18 @@
|
||||
-- Copyright (c) HashiCorp, Inc.
|
||||
-- SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
begin;
|
||||
-- Originially added in 81/01_deleted_tables_and_triggers.up.sql
|
||||
-- This is being replaced with a view.
|
||||
drop function get_deletion_tables;
|
||||
|
||||
-- This view uses the pg_catalog to find all tables that end in _deleted and are visibile.
|
||||
-- See: https://www.postgresql.org/docs/current/catalog-pg-class.html
|
||||
-- https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-SCHEMA
|
||||
create view deletion_table as
|
||||
select c.relname as tablename
|
||||
from pg_catalog.pg_class c
|
||||
where c.relkind in ('r') -- r = ordinary table
|
||||
and c.relname operator(pg_catalog.~) '^(.+_deleted)$' collate pg_catalog.default
|
||||
and pg_catalog.pg_table_is_visible(c.oid);
|
||||
commit;
|
||||
Loading…
Reference in new issue