<div dir="ltr">Hi,<div><br></div><div>I think that error occurs only when you are viewing data as layer. Here's steps for replicating that.</div><div><br></div><div>1. Start with empty database with postgis extension created.</div><div>2. Create normal view with this command:</div><div>CREATE VIEW public.v_test<br> AS<br> WITH point_series AS (<br>         SELECT generate_series('-20'::integer::numeric, 20::numeric, 0.5) AS point_values<br>        )<br> SELECT row_number() OVER () AS id,<br>    st_setsrid(st_point(point_values::double precision, point_values::double precision), 4326) AS geom<br>   FROM point_series a;</div><div><br></div><div>3. Create database connection in Mapguide and layer from view above and and that to Map.</div><div>4. Browse Map and everything is fine.</div><div>5. Create materialized view to database. It should work with previous examples too but you can also create materialized view with geometry column in it.<br>CREATE MATERIALIZED VIEW public.mv_test2 <br>AS<br> WITH point_series AS (<br>         SELECT generate_series('-20'::integer::numeric, 20::numeric, 0.5) AS point_values<br>        )<br> SELECT row_number() OVER () AS id,<br>    st_setsrid(st_point(point_values::double precision, point_values::double precision), 4326) AS geom<br>   FROM point_series a;<br>6. Refresh database datasource in Mapguide so it will get info about new materialized view.</div><div>7. Browse Map for awhile. Layer will be lost and visible again and error log will have rows showing error  Class 'public:v_test' not found<br>8. Delete materialized view from database, refresh datasource and layer will work again when Browsing map.</div><div><br>If you run query shown in ticket with correct parameters it will return only table or normal view with same schema and name as in parameters and all materialized views. If you add these conditions to where part of second select after union query will return only wanted rows. Values should be the same as placed to first select.<br><br>AND ns.nspname='public' AND c.relname='v_test'  <br><br><br>SELECT  t.table_schema  || '.' || t.table_name AS name,  lower(t.table_type) AS type,  convert_to(t.table_schema,'UTF8') as collate_schema_name,  convert_to(t.table_name,'UTF8') as collate_table_name  <br>FROM information_schema.tables AS t<br>WHERE t.table_schema not in ( 'information_schema' ,'pg_catalog')  and  ( (t.table_schema = 'public' and t.table_name = 'v_test') ) AND t.table_type IN ('BASE TABLE','VIEW')  AND t.table_name not in ( 'geometry_columns', 'geography_columns','spatial_ref_sys', 'raster_columns', 'raster_overviews')<br>UNION  <br>SELECT ns.nspname || '.' || c.relname AS name,  'view' AS type,  convert_to(ns.nspname,'UTF8') AS collate_schema_name,  convert_to(c.relname,'UTF8') AS collate_table_name  <br>FROM pg_class AS c  JOIN pg_namespace ns ON c.relnamespace = ns.oid  <br>WHERE c.relkind = 'm' AND ns.nspname='public' AND c.relname='v_test'  <br>ORDER BY collate_schema_name, collate_table_name ASC;</div><div><br></div><div>Br, Ari</div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">pe 18.7.2025 klo 15.22 Jackie Ng via mapguide-users (<a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>) kirjoitti:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>In the interest of maximum transparency as to what I'm doing, this is my unit test.</div><div><br></div><div>I run these SQL statements on an empty database:</div><div><br></div><div>CREATE TABLE vec (id INTEGER PRIMARY KEY, a INTEGER, b INTEGER);<br>CREATE VIEW vec_view AS SELECT * FROM vec;<br>CREATE MATERIALIZED VIEW hypot AS SELECT id, sqrt(a*a + b*b) as c FROM vec;<br>CREATE MATERIALIZED VIEW squared AS SELECT id, pow(a, 2) as c, pow(b, 2) as d FROM vec;<br>CREATE SCHEMA Foo;<br>CREATE TABLE Foo.vec2 (id INTEGER PRIMARY KEY, a INTEGER, b INTEGER);<br>CREATE VIEW Foo.vec_view2 AS SELECT * FROM Foo.vec2;<br>CREATE MATERIALIZED VIEW Foo.hypot2 AS SELECT id, sqrt(a*a + b*b) as c FROM Foo.vec2;</div><div><br></div><div>This results in a database with the following schema/tables/views</div><div><ul><li>public</li><ul><li>vec [table]</li><li>vec_view [view]</li><li>hypot [mat view]</li><li>squared [mat view]</li></ul><li>Foo</li><ul><li>vec2 [table]</li><li>vec_view2 [view]</li><li>hypot2 [mat view]</li></ul></ul></div><div>I then proceed to run the following tests:</div><div><br></div><div>1. Describe the full schema. I expect each schema to be present and each table/view/matview under it is a class definition. Each column is a data property on their respective class.<br><br>Expectations: correct<br><br>2. Describe a partial schema with a schema hint of "public" and a class name hint of "hypot". I expect it to contain only one schema (public) with one class (hypot). Each column from the hypot view is present in the class as a data property.<br><br>Expectations: correct<br><br>What am I possibly missing here? No class definitions are being misplaced in other schemas.</div><div><br></div><div>- Jackie</div><div><br></div><div><br></div><div><br></div><div>You wrote:</div><div><br></div><div>Hi,<div dir="auto"><br></div><div dir="auto">Creating these two will trigger issue. Materialized views can be in public schema.</div><div dir="auto"><br></div><div dir="auto">Create materialized view mv_test1 as select 1 as foo;</div><div dir="auto"><br></div><div dir="auto">Create materialized view mv_test2 as select 2 as foo;<br><div dir="auto"><br></div><div dir="auto">Br, Ari</div></div></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div></div></div></div></div>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div>