pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

cross-schema table references in views should be fully qualified

Open whoward opened this issue 1 year ago • 1 comments

Given the following database definition:

create schema some_schema;

create table public.some_table (id serial primary key);

create view some_schema.some_view as select * from public.some_table;

pgschema dump --schema some_schema has the following output:

--
-- pgschema database dump
--

-- Dumped from database version PostgreSQL 17.0
-- Dumped by pgschema version 1.4.0


--
-- Name: some_view; Type: VIEW; Schema: -; Owner: -
--

CREATE OR REPLACE VIEW some_view AS
 SELECT id
   FROM some_table;

you can see that the view definition here is not correct as the reference to some_table should be public.some_table as some_table is only defined in the public schema

whoward avatar Oct 20 '25 15:10 whoward

just tested and this works great - thanks!

whoward avatar Oct 20 '25 19:10 whoward