[SCM] PostGIS branch master updated. 3.6.0rc2-642-g6884c2be4

git at osgeo.org git at osgeo.org
Sun Jun 21 07:06:09 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  6884c2be41810eb4d02a1d0f88ca61439024f827 (commit)
      from  3b1b4aae021865171c25a37bcfc929e6e4d7a74b (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 6884c2be41810eb4d02a1d0f88ca61439024f827
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Sun Jun 21 17:51:52 2026 +0400

    Clarify raster2pgsql index creation timing
    
    Document that -I and --create-index create the spatial index at the end of each raster2pgsql run, so repeated append batches should create the index only on the final run or create it manually after loading.
    
    Group related loader argument NEWS entries and use bounded formatting for the generated CREATE INDEX SQL while updating the same code path.
    
    Closes #4385
    
    Closes https://github.com/postgis/postgis/pull/1031

diff --git a/NEWS b/NEWS
index e4ac634d8..c67f2b50f 100644
--- a/NEWS
+++ b/NEWS
@@ -21,11 +21,10 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
 
 * New Features *
 
- - #1124, shp2pgsql can create UNLOGGED tables for transient staging loads
-          (Darafei Praliaskouski)
- - #2935, shp2pgsql --drop-table can emit DROP TABLE before prepare output
-          (Darafei Praliaskouski)
- - raster2pgsql and shp2pgsql expose loader actions as long options
+ - #1124, #2935, #4659, [loader] Rework loader arguments: shp2pgsql can
+          create UNLOGGED tables, shp2pgsql --drop-table can emit DROP TABLE
+          before prepare output, raster2pgsql/shp2pgsql expose loader actions
+          as long options, and --if-not-exists makes creation actions idempotent
           (Darafei Praliaskouski)
  - #4208, Add single-geometry variants of ST_MaxDistance and ST_LongestLine
           (Darafei Praliaskouski)
@@ -69,9 +68,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
  - #6062, [topology] Stop using recursive snapping, for improved robustness (Sandro Santilli)
  - #6065, Improved winding order computation robustness for rings having collapsed elements
           (Sandro Santilli)
- - #3743, [raster] Document and test raster2pgsql -s FROM_SRID:SRID
-          reprojection support (Darafei Praliaskouski)
- - #4659, [raster] Add raster2pgsql and shp2pgsql long loader action options
+ - #3743, #4385, [raster loader] Document raster2pgsql -s FROM_SRID:SRID
+          reprojection support and clarify index creation timing for append loads
           (Darafei Praliaskouski)
  - #4749, Use point-in-polygon predicate fast paths for point-only
           GeometryCollections (Darafei Praliaskouski)
diff --git a/doc/man/raster2pgsql.1 b/doc/man/raster2pgsql.1
index 5fd3e3f0d..17fa7194d 100644
--- a/doc/man/raster2pgsql.1
+++ b/doc/man/raster2pgsql.1
@@ -55,9 +55,10 @@ Create a new table and populate it. This is the default mode.
 Prepare mode. Only emit SQL to create the table.
 .TP
 \fB\-\-if\-not\-exists\fR
-Use IF NOT EXISTS for table creation in \-c and \-p modes. When \-I is also
-specified, use IF NOT EXISTS for index creation too. This option cannot be used
-with \-d. Append mode requires an explicit creation action.
+Use IF NOT EXISTS for table creation in \-c and \-p modes. When \-I or
+\-\-create\-index is also specified, use IF NOT EXISTS for index creation too.
+This option cannot be used with \-d. Append mode requires an explicit creation
+action.
 .TP
 \fB\-\-drop\-table\fR
 Drop the target table before other actions. With no mode specified, the default
@@ -88,10 +89,13 @@ overviews are stored in the database and are not affected by \-R.
 Wrap PostgreSQL identifiers in quotes.
 .TP
 \fB\-I\fR
-Create a GiST spatial index on the raster column.
+Alias for \-\-create\-index.
 .TP
 \fB\-\-create\-index\fR
-Create a GiST spatial index on the raster column.
+Create a GiST spatial index on the raster column at the end of this
+raster2pgsql run. With repeated \-a append runs, create the index on the final
+run or after loading; add \-\-if\-not\-exists to make reruns tolerate an
+existing index.
 .TP
 \fB\-M\fR
 Run VACUUM ANALYZE on the raster table. This is most useful when appending to an
diff --git a/doc/using_raster_dataman.xml b/doc/using_raster_dataman.xml
index 7568d3ada..a686de06e 100644
--- a/doc/using_raster_dataman.xml
+++ b/doc/using_raster_dataman.xml
@@ -143,10 +143,10 @@ Available GDAL raster formats:
             <para>
               Use <literal>IF NOT EXISTS</literal> for table creation in
               <option>-c</option> and <option>-p</option> modes. When
-              <option>-I</option> is also specified, use
-              <literal>IF NOT EXISTS</literal> for index creation too. This
-              option cannot be used with <option>-d</option>. Append mode
-              requires an explicit creation action.
+              <option>-I</option> or <option>--create-index</option> is also
+              specified, use <literal>IF NOT EXISTS</literal> for index
+              creation too. This option cannot be used with <option>-d</option>.
+              Append mode requires an explicit creation action.
             </para>
           </listitem>
         </varlistentry>
@@ -319,7 +319,20 @@ Available GDAL raster formats:
                   <term><option>-I</option></term>
                   <listitem>
                     <para>
-                      Create a GiST index on the raster column.
+                      Alias for <option>--create-index</option>.
+                    </para>
+                  </listitem>
+                </varlistentry>
+
+                <varlistentry>
+                  <term><option>--create-index</option></term>
+                  <listitem>
+                    <para>
+                      Create a GiST index on the raster column at the end of this
+                      raster2pgsql run.  With repeated <option>-a</option> append
+                      runs, create the index on the final run or after loading;
+                      add <option>--if-not-exists</option> to make reruns tolerate
+                      an existing index.
                     </para>
                   </listitem>
                 </varlistentry>
diff --git a/raster/loader/raster2pgsql.c b/raster/loader/raster2pgsql.c
index 0a7474945..450474eb6 100644
--- a/raster/loader/raster2pgsql.c
+++ b/raster/loader/raster2pgsql.c
@@ -382,14 +382,18 @@ usage() {
 	      "     -p  Prepare mode, only creates the table.\n"));
 	printf(
 	    _("  --if-not-exists  Use IF NOT EXISTS for table creation in -c and -p\n"
-	      "     modes. With -I, also use IF NOT EXISTS for index creation.\n"
+	      "     modes. With -I/--create-index, also use IF NOT EXISTS for index\n"
+	      "     creation.\n"
 	      "     Append mode requires an explicit creation action.\n"));
 	printf(
 	    _("  --drop-table  Drop the target table before other actions.\n"
 	      "      With no mode specified, the default create/load actions still apply.\n"
 	      "  --create-table  Create the target table.\n"
 	      "  --load-data  Load raster data into the target table.\n"
-	      "  --create-index  Create a GIST spatial index on the raster column.\n"));
+	      "  --create-index  Create a GIST spatial index on the raster column\n"
+	      "      at the end of this raster2pgsql run. With repeated -a append\n"
+	      "      runs, create the index on the final run or after loading; add\n"
+	      "      --if-not-exists to make reruns tolerate an existing index.\n"));
 	printf(_(
 		"  -f <column> Specify the name of the raster column\n"
 	));
@@ -408,10 +412,7 @@ usage() {
 	printf(_(
 		"  -q  Wrap PostgreSQL identifiers in quotes.\n"
 	));
-	printf(_(
-		"  -I  Create a GIST spatial index on the raster column. The ANALYZE\n"
-		"      command will automatically be issued for the created index.\n"
-	));
+	printf(_("  -I  Alias for --create-index.\n"));
 	printf(
 	    _("  --add-constraints  Set the standard set of constraints on the\n"
 	      "      raster column after the rasters are loaded.\n"
@@ -1152,7 +1153,7 @@ create_index(const char *schema,
 	     STRINGBUFFER *buffer)
 {
 	char *sql = NULL;
-	uint32_t len = 0;
+	size_t len = 0;
 	char *_table = NULL;
 	char *_column = NULL;
 
@@ -1182,25 +1183,27 @@ create_index(const char *schema,
 	}
 	if (if_not_exists)
 	{
-		sprintf(sql,
-			"CREATE INDEX IF NOT EXISTS \"%s_%s_gist\" ON %s%s USING gist (st_convexhull(%s))%s%s;",
-			_table,
-			_column,
-			(schema != NULL ? schema : ""),
-			table,
-			column,
-			(tablespace != NULL ? " TABLESPACE " : ""),
-			(tablespace != NULL ? tablespace : ""));
+		snprintf(sql,
+			 len,
+			 "CREATE INDEX IF NOT EXISTS \"%s_%s_gist\" ON %s%s USING gist (st_convexhull(%s))%s%s;",
+			 _table,
+			 _column,
+			 (schema != NULL ? schema : ""),
+			 table,
+			 column,
+			 (tablespace != NULL ? " TABLESPACE " : ""),
+			 (tablespace != NULL ? tablespace : ""));
 	}
 	else
 	{
-		sprintf(sql,
-			"CREATE INDEX ON %s%s USING gist (st_convexhull(%s))%s%s;",
-			(schema != NULL ? schema : ""),
-			table,
-			column,
-			(tablespace != NULL ? " TABLESPACE " : ""),
-			(tablespace != NULL ? tablespace : ""));
+		snprintf(sql,
+			 len,
+			 "CREATE INDEX ON %s%s USING gist (st_convexhull(%s))%s%s;",
+			 (schema != NULL ? schema : ""),
+			 table,
+			 column,
+			 (tablespace != NULL ? " TABLESPACE " : ""),
+			 (tablespace != NULL ? tablespace : ""));
 	}
 	rtdealloc(_table);
 	rtdealloc(_column);

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

Summary of changes:
 NEWS                         | 14 ++++++-------
 doc/man/raster2pgsql.1       | 14 ++++++++-----
 doc/using_raster_dataman.xml | 23 ++++++++++++++++-----
 raster/loader/raster2pgsql.c | 49 +++++++++++++++++++++++---------------------
 4 files changed, 59 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list