gh0st
gh0st

Reputation: 1722

Why does my schema qualifier gets dropped after I create a materialized view?

Curiously I'm running into a situation where if I create a materialized view such as

create materialized view if not exists banana.my_view tablespace pg_default
as
select column_a, column_b, column_c
from "SchemaName".table_name
where column_a > 200
with data;

in pgAdmin 4 and then look for that new view in my Object Explorer, right click it and select "Scripts -> CREATE Script" it returns this

create materialized view if not exists banana.my_view tablespace pg_default
as
select column_a, column_b, column_c
from table_name
where column_a > 200
with data;

Where "SchemaName" has been dropped from the view definition.

Is there some strange server setting I don't know about that's causing this?

Upvotes: 0

Views: 39

Answers (1)

gh0st
gh0st

Reputation: 1722

I found that this was simply a matter of those schemas being in my search_path. Once I identified that "SchemaName" was in my search_path, I cleared it. And from that point forward, using "Scripts -> CREATE Script" yielded a fully qualified table name with the associated schema.

I used this answer to help me update my search_path.

Upvotes: 0

Related Questions