By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
with t as (
select '... from schema1.table_1_tmp ...' mycol
union all select '... from schema1.table_2 ...'
)
select mycol, regexp_replace(mycol, '\sschema1\.(\w+_tmp)\s', ' \1 ') newcol from t
mycol | newcol |
---|---|
... from schema1.table_1_tmp ... | ... from table_1_tmp ... |
... from schema1.table_2 ... | ... from schema1.table_2 ... |
SELECT 2