2024-09-17 14:21:43 +02:00
|
|
|
--liquibase formatted sql
|
|
|
|
|
|
|
|
|
|
|
|
-- ============================================================================
|
|
|
|
--changeset michael.hoennig:base-COMBINE-TABLE-SCHEMA-AND-NAME endDelimiter:--//
|
|
|
|
-- ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
create or replace function base.combine_table_schema_and_name(tableSchema name, tableName name)
|
|
|
|
returns text
|
|
|
|
language plpgsql as $$
|
|
|
|
begin
|
2024-09-23 10:52:37 +02:00
|
|
|
assert LEFT(tableSchema, 1) <> '"', 'tableSchema must not start with "';
|
|
|
|
assert LEFT(tableName, 1) <> '"', 'tableName must not start with "';
|
|
|
|
|
2024-09-17 14:21:43 +02:00
|
|
|
if tableSchema is null or tableSchema = 'public' or tableSchema = '' then
|
|
|
|
return tableName::text;
|
|
|
|
else
|
|
|
|
return tableSchema::text || '.' || tableName::text;
|
|
|
|
end if;
|
|
|
|
end; $$;
|
|
|
|
--//
|