[SCM] PostGIS branch master updated. 3.7.0beta1-225-g847b54bbb6

git at osgeo.org git at osgeo.org
Tue Aug 4 11:25:58 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  847b54bbb65052fc23909569ce4b29788317d3c0 (commit)
      from  dad477d05fb5a8a65284346f0ca41a764bd6e036 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 847b54bbb65052fc23909569ce4b29788317d3c0
Author: Regina Obe <lr at pcorp.us>
Date:   Tue Aug 4 14:24:11 2026 -0400

    Revert  #1705 constraint-based columns in views to register correctly
    References #1705
    References #6110

diff --git a/NEWS b/NEWS
index b51c441573..6f297904d6 100644
--- a/NEWS
+++ b/NEWS
@@ -39,7 +39,10 @@ These are only changes since 3.7.0beta1.
           (Darafei Praliaskouski)
  - #6109, Out-of-bounds heap read in BOX2D_out and BOX2D_expand
    on 65-byte box2d under ASAN (Dennis Tighe, Google)
- - #6110, regression in speed with geometry_columns (Regina Obe)
+ - #6110, Fix regression in speed with geometry_columns (Regina Obe)
+ - Revert feature  #1705 (constraint geometry column detection in views)
+    Added too much overhead to geometry_columns performance (Regina Obe)
+
  - Schema qualify references to pg_catalog and postgis
    in geometry_columns and geography_columns views (Regina Obe)
 
@@ -251,8 +254,6 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
           PDF builds while keeping HTML images transparent (Darafei Praliaskouski)
  - #2838, Emit valid X3D Coordinate nodes for 2D polygon output
           (Darafei Praliaskouski)
- - #1705, Infer constraint metadata for direct view and materialized view
-          geometry columns (Darafei Praliaskouski)
  - GH-899, [raster] Honor PostgreSQL interrupts in long-running GDAL
           progress callbacks (Darafei Praliaskouski)
  - #6073, #6074, Stabilize geography LRS endpoint interpolation and pole
diff --git a/doc/release_notes.xml b/doc/release_notes.xml
index a20a04d183..277b644856 100644
--- a/doc/release_notes.xml
+++ b/doc/release_notes.xml
@@ -74,7 +74,6 @@
       <para><link xlink:href="https://trac.osgeo.org/postgis/ticket/5645">#5645</link>, Docs: keep code operators ("=>") intact in translated manuals by enforcing verbatim CSS (Darafei Praliaskouski)</para>
       <para><link xlink:href="https://trac.osgeo.org/postgis/ticket/1408">#1408</link>, Docs: flatten transparent manual images onto white backgrounds for PDF builds while keeping HTML images transparent (Darafei Praliaskouski)</para>
       <para><link xlink:href="https://trac.osgeo.org/postgis/ticket/2838">#2838</link>, Emit valid X3D Coordinate nodes for 2D polygon output (Darafei Praliaskouski)</para>
-      <para><link xlink:href="https://trac.osgeo.org/postgis/ticket/1705">#1705</link>, Infer constraint metadata for direct view and materialized view geometry columns (Darafei Praliaskouski)</para>
       <para><link xlink:href="https://github.com/postgis/postgis/pull/899">GH-899</link>, [raster] Honor PostgreSQL interrupts in long-running GDAL progress callbacks (Darafei Praliaskouski)</para>
       <para><link xlink:href="https://trac.osgeo.org/postgis/ticket/2583">#2583</link>, Preserve Z/ZM dimensional qualifiers in ST_AsEWKT output for TIN (Darafei Praliaskouski)</para>
     </simplesect>
diff --git a/doc/using_postgis_dataman.xml b/doc/using_postgis_dataman.xml
index 7b48ba5177..594fe0708f 100644
--- a/doc/using_postgis_dataman.xml
+++ b/doc/using_postgis_dataman.xml
@@ -1601,10 +1601,9 @@ ON my_special_pois USING gist(geom gist_geometry_ops_nd);</programlisting>
 		<para>To retain constraint-based definition behavior, such as for inherited tables where all children do not have the same type and SRID, set the optional <varname>use_typmod</varname> argument to false.</para>
 	<programlisting language="sql">SELECT Populate_Geometry_Columns('myschema.my_special_pois'::regclass, false);</programlisting>
 
-<para>Although the old constraint-based method is still supported, direct
-pass-through view columns register correctly in <varname>geometry_columns</varname>
-for both typmod-based and constraint-based source columns. In this example we
-define a column using typmod and another using constraints.</para>
+<para>Although the old-constraint based method is still supported, a constraint-based geometry column used directly
+in a view, will not register correctly in geometry_columns, as will a typmod one.
+In this example we define a column using typmod and another using constraints.</para>
 	<programlisting language="sql">CREATE TABLE pois_ny(gid SERIAL PRIMARY KEY, poi_name text, cat text, geom geometry(POINT, 4326));
 SELECT AddGeometryColumn('pois_ny', 'geom_2160', 2160, 'POINT', 2, false);</programlisting>
 <para>If we run <command>\d pois_ny</command> in psql, we observe they are defined differently -- one is typmod, one is constraint.</para>
@@ -1642,21 +1641,20 @@ SELECT *
 SELECT f_table_name, f_geometry_column, srid, type
     FROM geometry_columns
     WHERE f_table_name = 'vw_pois_ny_parks';</programlisting>
-<para>Both the typmod based geom view column and the direct constraint based
-view column register correctly.</para>
+<para>The typmod based geom view column registers correctly,
+but the constraint based one does not.</para>
 	<screen role="text-primary">   f_table_name   | f_geometry_column | srid |   type
 ------------------+-------------------+------+----------
  vw_pois_ny_parks | geom              | 4326 | POINT
- vw_pois_ny_parks | geom_2160         | 2160 | POINT</screen>
+ vw_pois_ny_parks | geom_2160         |    0 | GEOMETRY</screen>
 
-<para>If the view applies a spatial function to the geometry, such as
-<function>ST_Transform</function>, you still need to cast the transformed
-column explicitly so the view can expose the correct type and SRID:</para>
+<para>This may change in future versions of PostGIS, but for now
+to force the constraint-based view column to register correctly, you need to do this:</para>
 	<programlisting language="sql">DROP VIEW vw_pois_ny_parks;
 CREATE VIEW vw_pois_ny_parks AS
 SELECT gid, poi_name, cat,
   geom,
-  ST_Transform(geom, 2160)::geometry(POINT, 2160) As geom_2160
+  geom_2160::geometry(POINT,2160) As geom_2160
   FROM pois_ny
   WHERE cat = 'park';
 SELECT f_table_name, f_geometry_column, srid, type
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 1df0e2b0bf..cd8cc4cb8d 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -6610,99 +6610,6 @@ LANGUAGE 'sql' STABLE STRICT PARALLEL SAFE _COST_MEDIUM;
 -- Changed: 2.4.0 List also Parent partitioned tables
 -- Changed: 2.5.2 replace use of pg_constraint.consrc with pg_get_constraintdef, consrc removed pg12
 
--- Extract base-column origin metadata only from a view rule's top-level target list.
--- pg_node_tree text also contains nested Query target lists for subqueries; treating
--- those as outer view columns would make expression outputs inherit constraints.
-CREATE OR REPLACE FUNCTION _postgis_geometry_columns_view_column_origin(
-    view_rule pg_node_tree,
-    view_attnum smallint)
-RETURNS TABLE(base_relid oid, base_attnum smallint)
-AS $$
-DECLARE
-    rule_text text := view_rule::text;
-    rule_len integer := length(rule_text);
-    i integer := 1;
-    token text := ':targetList (';
-    token_len integer := length(':targetList (');
-    ch text;
-    prev_ch text;
-    in_quote boolean := false;
-    paren_depth integer := 0;
-    brace_depth integer := 0;
-    in_top_targetlist boolean := false;
-    entry_start integer := 0;
-    entry_text text;
-    match text[];
-BEGIN
-    WHILE i <= rule_len LOOP
-        IF NOT in_quote AND NOT in_top_targetlist
-            AND paren_depth = 1
-            AND brace_depth = 1
-            AND substr(rule_text, i, token_len) = token
-        THEN
-            in_top_targetlist := true;
-            paren_depth := paren_depth + 1;
-            i := i + token_len;
-            CONTINUE;
-        END IF;
-
-        ch := substr(rule_text, i, 1);
-
-        IF ch = '"' AND prev_ch IS DISTINCT FROM chr(92) THEN
-            in_quote := NOT in_quote;
-        ELSIF NOT in_quote THEN
-            IF in_top_targetlist
-                AND entry_start = 0
-                AND paren_depth = 2
-                AND brace_depth = 1
-                AND substr(rule_text, i, 12) = '{TARGETENTRY'
-            THEN
-                entry_start := i;
-            END IF;
-
-            IF ch = '(' THEN
-                paren_depth := paren_depth + 1;
-            ELSIF ch = ')' THEN
-                paren_depth := paren_depth - 1;
-                IF in_top_targetlist AND paren_depth = 1 THEN
-                    RETURN;
-                END IF;
-            ELSIF ch = '{' THEN
-                brace_depth := brace_depth + 1;
-            ELSIF ch = '}' THEN
-                brace_depth := brace_depth - 1;
-                IF in_top_targetlist
-                    AND entry_start > 0
-                    AND brace_depth = 1
-                    AND paren_depth = 2
-                THEN
-                    entry_text := substr(rule_text, entry_start, i - entry_start + 1);
-                    entry_start := 0;
-                    match := regexp_match(
-                        entry_text,
-                        $re$^\{TARGETENTRY :expr \{VAR [^}]*\} :resno ([0-9]+) :resname [^:]+ :ressortgroupref [0-9]+ :resorigtbl ([0-9]+) :resorigcol ([0-9]+) :resjunk false\}$re$
-                    );
-                    IF match IS NOT NULL
-                        AND match[1]::smallint = view_attnum
-                        AND match[2] <> '0'
-                        AND match[3] <> '0'
-                    THEN
-                        base_relid := match[2]::oid;
-                        base_attnum := match[3]::smallint;
-                        RETURN NEXT;
-                        RETURN;
-                    END IF;
-                END IF;
-            END IF;
-        END IF;
-
-        prev_ch := ch;
-        i := i + 1;
-    END LOOP;
-END
-$$
-LANGUAGE 'plpgsql' STABLE STRICT PARALLEL SAFE;
-
 CREATE OR REPLACE VIEW geometry_columns AS
 WITH constraint_defs AS NOT MATERIALIZED (
     -- Trim trailing NOT VALID so metadata inference works before constraint validation (#4828).
@@ -6723,17 +6630,6 @@ SELECT pg_catalog.current_database()::pg_catalog.varchar(256) AS f_table_catalog
      JOIN pg_catalog.pg_attribute a ON a.attrelid OPERATOR(pg_catalog.=) c.oid AND NOT a.attisdropped
      JOIN pg_catalog.pg_namespace n ON c.relnamespace OPERATOR(pg_catalog.=) n.oid
      JOIN pg_catalog.pg_type t ON a.atttypid OPERATOR(pg_catalog.=) t.oid
-     -- Direct view columns have rewrite-rule target entries with origin metadata.
-     -- Use only top-level bare VAR target entries, so expressions keep needing explicit casts.
-     LEFT JOIN LATERAL (
-           SELECT origin.base_relid,
-                  origin.base_attnum
-             FROM pg_catalog.pg_rewrite AS r
-             CROSS JOIN LATERAL @extschema at ._postgis_geometry_columns_view_column_origin(r.ev_action, a.attnum) AS origin
-            WHERE c.relkind OPERATOR(pg_catalog.=) ANY (ARRAY['v'::pg_catalog."char", 'm'::pg_catalog."char"])
-              AND r.ev_class OPERATOR(pg_catalog.=) c.oid
-              AND r.rulename OPERATOR(pg_catalog.=) '_RETURN'
-     ) AS vco ON true
      LEFT JOIN (
            SELECT s.connamespace,
                   s.conrelid,
@@ -6741,7 +6637,7 @@ SELECT pg_catalog.current_database()::pg_catalog.varchar(256) AS f_table_catalog
                   (pg_catalog.regexp_match(s.consrc, $$geometrytype\(\w+\)\s*=\s*'(\w+)'$$, 'i'))[1]::pg_catalog.text AS type
              FROM constraint_defs AS s
             WHERE s.consrc OPERATOR(pg_catalog.~*) $$geometrytype\(\w+\)\s*=\s*'\w+'$$::pg_catalog.text
-     ) st ON st.conrelid OPERATOR(pg_catalog.=) COALESCE(vco.base_relid, c.oid) AND (COALESCE(vco.base_attnum, a.attnum) OPERATOR(pg_catalog.=) ANY (st.conkey))
+     ) st ON st.conrelid OPERATOR(pg_catalog.=) c.oid AND (a.attnum OPERATOR(pg_catalog.=) ANY (st.conkey))
      LEFT JOIN (
            SELECT s.connamespace,
                   s.conrelid,
@@ -6749,7 +6645,7 @@ SELECT pg_catalog.current_database()::pg_catalog.varchar(256) AS f_table_catalog
                   (pg_catalog.regexp_match(s.consrc, $$ndims\(\w+\)\s*=\s*(\d+)$$, 'i'))[1]::integer AS ndims
              FROM constraint_defs AS s
             WHERE s.consrc OPERATOR(pg_catalog.~*) $$ndims\(\w+\)\s*=\s*\d+$$::pg_catalog.text
-     ) sn ON sn.conrelid OPERATOR(pg_catalog.=) COALESCE(vco.base_relid, c.oid) AND (COALESCE(vco.base_attnum, a.attnum) OPERATOR(pg_catalog.=) ANY (sn.conkey))
+     ) sn ON sn.conrelid OPERATOR(pg_catalog.=) c.oid AND (a.attnum OPERATOR(pg_catalog.=) ANY (sn.conkey))
      LEFT JOIN (
            SELECT s.connamespace,
                   s.conrelid,
@@ -6757,7 +6653,7 @@ SELECT pg_catalog.current_database()::pg_catalog.varchar(256) AS f_table_catalog
                   (pg_catalog.regexp_match(s.consrc, $$srid\(\w+\)\s*=\s*(\d+)$$, 'i'))[1]::integer As srid
              FROM constraint_defs AS s
             WHERE s.consrc OPERATOR(pg_catalog.~*) $$srid\(\w+\)\s*=\s*\d+$$::pg_catalog.text
-     ) sr ON sr.conrelid OPERATOR(pg_catalog.=) COALESCE(vco.base_relid, c.oid) AND (COALESCE(vco.base_attnum, a.attnum) OPERATOR(pg_catalog.=) ANY (sr.conkey))
+     ) sr ON sr.conrelid OPERATOR(pg_catalog.=) c.oid AND (a.attnum OPERATOR(pg_catalog.=) ANY (sr.conkey))
   WHERE (c.relkind OPERATOR(pg_catalog.=) ANY (ARRAY['r'::pg_catalog."char", 'v'::pg_catalog."char", 'm'::pg_catalog."char", 'f'::pg_catalog."char", 'p'::pg_catalog."char"]))
   AND NOT c.relname OPERATOR(pg_catalog.=) 'raster_columns'::pg_catalog.name AND t.typname OPERATOR(pg_catalog.=) 'geometry'::pg_catalog.name
   AND NOT pg_catalog.pg_is_other_temp_schema(c.relnamespace)
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index fb5dd44d3d..80eb6d8b24 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1704,7 +1704,7 @@ SELECT f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, t
  ORDER BY f_table_name, f_geometry_column;
 DROP TABLE IF EXISTS test5829, test5978;
 
--- #1705, constraint-based geometry metadata for direct view columns
+-- #1705, view columns do not inherit constraint-based geometry metadata; only typmod-based view columns and constraint-based table columns register
 CREATE TABLE test1705 (
   gid integer,
   geom geometry(Point, 4326),
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 9f864b1077..065f490c72 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -518,15 +518,15 @@ public|test5978|geometry|2|4326|POINT
 public|test5978|shape|2|4326|POINT
 #1705|public|test1705|geom|2|4326|POINT
 #1705|public|test1705|geom_2160|2|2160|POINT
-#1705|public|test1705_alias_view|shape|2|2160|POINT
+#1705|public|test1705_alias_view|shape|2|0|GEOMETRY
 #1705|public|test1705_buffer_view|geom_2160|2|0|GEOMETRY
-#1705|public|test1705_matview|geom_2160|2|2160|POINT
+#1705|public|test1705_matview|geom_2160|2|0|GEOMETRY
 #1705|public|test1705_mixed_view|buffered|2|0|GEOMETRY
-#1705|public|test1705_mixed_view|geom_2160|2|2160|POINT
+#1705|public|test1705_mixed_view|geom_2160|2|0|GEOMETRY
 #1705|public|test1705_nested_buffer_view|geom_2160|2|0|GEOMETRY
 #1705|public|test1705_scalar_buffer_view|geom_2160|2|0|GEOMETRY
 #1705|public|test1705_view|geom|2|4326|POINT
-#1705|public|test1705_view|geom_2160|2|2160|POINT
+#1705|public|test1705_view|geom_2160|2|0|GEOMETRY
 #3103.1|4326
 #3103.2|3857
 #3103.3|test3103b|3857

-----------------------------------------------------------------------

Summary of changes:
 NEWS                          |   7 +--
 doc/release_notes.xml         |   1 -
 doc/using_postgis_dataman.xml |  20 ++++----
 postgis/postgis.sql.in        | 110 ++----------------------------------------
 regress/core/tickets.sql      |   2 +-
 regress/core/tickets_expected |   8 +--
 6 files changed, 21 insertions(+), 127 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list