[SCM] PostGIS branch master updated. 3.4.0rc1-1092-g260b2eeef

git at osgeo.org git at osgeo.org
Mon Apr 22 08:53:51 PDT 2024


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  260b2eeefc720995c5922efee6b535fee111a10a (commit)
      from  8c30a25acb166de09a7d647e1e02dc6d71eae9ea (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 260b2eeefc720995c5922efee6b535fee111a10a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Apr 22 08:39:27 2024 -0700

    Remove WFS_locks and associated documentation, unused and unmaintained for many years

diff --git a/README.postgis b/README.postgis
index c6e303fa8..36e28a4c3 100644
--- a/README.postgis
+++ b/README.postgis
@@ -16,8 +16,8 @@ Directory structure::
   ./doc         PostGIS Documentation
   ./extensions  Support for the PostgreSQL Extensions framework
   ./extras      Various pieces that didn't belong to mainstream
-                (package management specfiles, WFS_locks
-                  , sample WKB parser, postgis_tiger_geocoder)
+                (package management specfiles, sample WKB parser, 
+                postgis_tiger_geocoder)
   ./fuzzers     Google fuzz tests for liblwgeom
   ./liblwgeom   LWGEOM geometry library
   ./libpgcommon PostGIS library to bridge LWGEOM to PostgreSQL
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 8dacae4af..3dac515be 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -193,7 +193,6 @@ XML_SOURCES = \
 	reference_sfcgal.xml \
 	reference_srs.xml \
 	reference_trajectory.xml \
-	reference_transaction.xml \
 	reference_transformation.xml \
 	reference_troubleshooting.xml \
 	reference_type.xml \
diff --git a/doc/postgis.xml b/doc/postgis.xml
index 75b529bc5..8e7912614 100644
--- a/doc/postgis.xml
+++ b/doc/postgis.xml
@@ -49,7 +49,6 @@
 <!ENTITY reference_lrs SYSTEM "reference_lrs.xml">
 <!ENTITY reference_srs SYSTEM "reference_srs.xml">
 <!ENTITY reference_trajectory SYSTEM "reference_trajectory.xml">
-<!ENTITY reference_transaction SYSTEM "reference_transaction.xml">
 <!ENTITY reference_transformation SYSTEM "reference_transformation.xml">
 <!ENTITY reference_misc SYSTEM "reference_misc.xml">
 <!ENTITY reference_troubleshooting SYSTEM "reference_troubleshooting.xml">
diff --git a/doc/reference.xml b/doc/reference.xml
index 3c2b0b380..af4e487ff 100644
--- a/doc/reference.xml
+++ b/doc/reference.xml
@@ -36,9 +36,8 @@
   &reference_bbox;
   &reference_lrs;
   &reference_trajectory;
-  &reference_transaction;
   &reference_version;
   &reference_guc;
   &reference_troubleshooting;
 
-</chapter>
\ No newline at end of file
+</chapter>
diff --git a/doc/reference_transaction.xml b/doc/reference_transaction.xml
deleted file mode 100644
index 91d5c0d57..000000000
--- a/doc/reference_transaction.xml
+++ /dev/null
@@ -1,349 +0,0 @@
-<!-- Converted by db4-upgrade version 1.1 -->
-<section xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Long_Transactions_Support">
-    <title>Long Transaction Support</title><info>
-    <abstract>
-
-	  <para>These functions implement a row locking mechanism to support long transactions.
-		They are provided primarily for implementors of the
-		<link xlink:href="http://www.opengeospatial.org/standards/wfs">Web Feature Service</link> specification.</para>
-
-    </abstract>
-    </info>
-
-
-
-	  <note>
-			<para>For the locking mechanism to operate correctly the <emphasis role="bold">serializable</emphasis>
-			<link xlink:href="http://www.postgresql.org/docs/current/static/transaction-iso.html">
-			transaction isolation level</link> must be used.</para>
-	  </note>
-
-
-	<refentry xml:id="AddAuth">
-	  <refnamediv>
-		<refname>AddAuth</refname>
-
-		<refpurpose>Adds an authorization token to be used in the current transaction.</refpurpose>
-	  </refnamediv>
-
-	  <refsynopsisdiv>
-		<funcsynopsis>
-		  <funcprototype>
-			<funcdef>boolean <function>AddAuth</function></funcdef>
-			<paramdef><type>text </type> <parameter>auth_token</parameter></paramdef>
-		  </funcprototype>
-		</funcsynopsis>
-	  </refsynopsisdiv>
-
-	  <refsection>
-		<title>Description</title>
-
-		<para>Adds an authorization token to be used in the current transaction.</para>
-
-		<para>Adds the current transaction identifier
-			and authorization token to a temporary table called <varname>temp_lock_have_table</varname>.</para>
-
-		<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-	  </refsection>
-
-	  <refsection>
-		<title>Examples</title>
-
-		<programlisting>
-		SELECT LockRow('towns', '353', 'priscilla');
-		BEGIN TRANSACTION;
-			SELECT AddAuth('joey');
-			UPDATE towns SET geom = ST_Translate(geom,2,2) WHERE gid = 353;
-		COMMIT;
-
-
-		---Error--
-		ERROR:  UPDATE where "gid" = '353' requires authorization 'priscilla'
-		</programlisting>
-	  </refsection>
-
-	  <!-- Optionally add a "See Also" section -->
-	  <refsection>
-		<title>See Also</title>
-
-		<para><xref linkend="LockRow"/></para>
-	  </refsection>
-	</refentry>
-
-	  <refentry xml:id="CheckAuth">
-		  <refnamediv>
-			<refname>CheckAuth</refname>
-
-			<refpurpose>Creates a trigger on a table to prevent/allow updates and deletes of rows based on authorization token.</refpurpose>
-		  </refnamediv>
-
-		  <refsynopsisdiv>
-			<funcsynopsis>
-			  <funcprototype>
-				<funcdef>integer <function>CheckAuth</function></funcdef>
-				<paramdef><type>text </type> <parameter>a_schema_name</parameter></paramdef>
-				<paramdef><type>text </type> <parameter>a_table_name</parameter></paramdef>
-				<paramdef><type>text </type> <parameter>a_key_column_name</parameter></paramdef>
-			  </funcprototype>
-
-			  <funcprototype>
-				<funcdef>integer <function>CheckAuth</function></funcdef>
-				<paramdef><type>text </type> <parameter>a_table_name</parameter></paramdef>
-				<paramdef><type>text </type> <parameter>a_key_column_name</parameter></paramdef>
-			  </funcprototype>
-			</funcsynopsis>
-		  </refsynopsisdiv>
-
-		  <refsection>
-			<title>Description</title>
-
-			<para>Creates trigger on a table to prevent/allow updates and deletes of rows based on an authorization token.
-			Identify rows using <rowid_col> column.</para>
-
-			<para>If a_schema_name is not passed in, then searches for table in current schema.</para>
-			<note><para>If an authorization trigger already exists on this table function errors.</para>
-				<para>If Transaction support is not enabled, function throws an exception.</para>
-			</note>
-
-			<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-
-		  </refsection>
-
-
-		  <refsection>
-			<title>Examples</title>
-
-			<programlisting>
-			SELECT CheckAuth('public', 'towns', 'gid');
-			result
-			------
-			0
-			</programlisting>
-		  </refsection>
-
-		  <!-- Optionally add a "See Also" section -->
-		  <refsection>
-			<title>See Also</title>
-
-			<para><xref linkend="EnableLongTransactions"/></para>
-		  </refsection>
-		</refentry>
-
-	  <refentry xml:id="DisableLongTransactions">
-		<refnamediv>
-		  <refname>DisableLongTransactions</refname>
-
-		  <refpurpose>Disables long transaction support.</refpurpose>
-		</refnamediv>
-
-		<refsynopsisdiv>
-		  <funcsynopsis>
-			<funcprototype>
-			  <funcdef>text <function>DisableLongTransactions</function></funcdef>
-			  <paramdef></paramdef>
-			</funcprototype>
-		  </funcsynopsis>
-		</refsynopsisdiv>
-
-		<refsection>
-		  <title>Description</title>
-
-			<para>Disables long transaction support. This function removes the
-			long transaction support metadata tables, and drops all triggers
-			attached to lock-checked tables.</para>
-			<para>Drops meta table called <varname>authorization_table</varname> and a view called <varname>authorized_tables</varname>
-				and all triggers called <varname>checkauthtrigger</varname></para>
-
-			<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-
-		</refsection>
-
-
-		<refsection>
-		  <title>Examples</title>
-
-		  <programlisting>SELECT DisableLongTransactions();
---result--
-Long transactions support disabled
-		  </programlisting>
-		</refsection>
-
-		<!-- Optionally add a "See Also" section -->
-		<refsection>
-		  <title>See Also</title>
-
-		  <para><xref linkend="EnableLongTransactions"/></para>
-		</refsection>
-	  </refentry>
-
-	  <refentry xml:id="EnableLongTransactions">
-		<refnamediv>
-		  <refname>EnableLongTransactions</refname>
-
-		  <refpurpose>Enables long transaction support.</refpurpose>
-		</refnamediv>
-
-		<refsynopsisdiv>
-		  <funcsynopsis>
-			<funcprototype>
-			  <funcdef>text <function>EnableLongTransactions</function></funcdef>
-			  <paramdef></paramdef>
-			</funcprototype>
-		  </funcsynopsis>
-		</refsynopsisdiv>
-
-		<refsection>
-		  <title>Description</title>
-
-			<para>Enables long transaction support.
-			This function creates the
-			required metadata tables. It must be called once before using the
-			other functions in this section. Calling it twice is
-			harmless.</para>
-			<para>Creates a meta table called <varname>authorization_table</varname> and a view called <varname>authorized_tables</varname></para>
-
-			<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-
-		</refsection>
-
-
-		<refsection>
-		  <title>Examples</title>
-
-		  <programlisting>SELECT EnableLongTransactions();
---result--
-Long transactions support enabled
-		  </programlisting>
-		</refsection>
-
-		<!-- Optionally add a "See Also" section -->
-		<refsection>
-		  <title>See Also</title>
-
-		  <para><xref linkend="DisableLongTransactions"/></para>
-		</refsection>
-	  </refentry>
-
-	<refentry xml:id="LockRow">
-	  <refnamediv>
-		<refname>LockRow</refname>
-
-		<refpurpose>Sets lock/authorization for a row in a table.</refpurpose>
-	  </refnamediv>
-
-	  <refsynopsisdiv>
-		<funcsynopsis>
-		  <funcprototype>
-			<funcdef>integer <function>LockRow</function></funcdef>
-			<paramdef><type>text </type> <parameter>a_schema_name</parameter></paramdef>
-			<paramdef><type>text </type> <parameter>a_table_name</parameter></paramdef>
-			<paramdef><type>text </type> <parameter>a_row_key</parameter></paramdef>
-			<paramdef><type>text</type> <parameter>an_auth_token</parameter></paramdef>
-			<paramdef><type>timestamp</type> <parameter>expire_dt</parameter></paramdef>
-		  </funcprototype>
-
-		  <funcprototype>
-			<funcdef>integer <function>LockRow</function></funcdef>
-			<paramdef><type>text </type> <parameter>a_table_name</parameter></paramdef>
-			<paramdef><type>text </type> <parameter>a_row_key</parameter></paramdef>
-			<paramdef><type>text</type> <parameter>an_auth_token</parameter></paramdef>
-			<paramdef><type>timestamp</type> <parameter>expire_dt</parameter></paramdef>
-		  </funcprototype>
-
-		  <funcprototype>
-			<funcdef>integer <function>LockRow</function></funcdef>
-			<paramdef><type>text </type> <parameter>a_table_name</parameter></paramdef>
-			<paramdef><type>text </type> <parameter>a_row_key</parameter></paramdef>
-			<paramdef><type>text</type> <parameter>an_auth_token</parameter></paramdef>
-		  </funcprototype>
-
-		</funcsynopsis>
-	  </refsynopsisdiv>
-
-	  <refsection>
-		<title>Description</title>
-
-		<para>Sets lock/authorization for a specific row in a table.
-		<varname>an_auth_token</varname> is a text value.
-		<varname>expire_dt</varname> is a timestamp
-		which defaults to <emphasis>now() + 1 hour</emphasis>.
-		Returns 1 if lock has been assigned, 0
-		otherwise (i.e. row is already locked by another auth.)</para>
-
-		<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-	  </refsection>
-
-
-	  <refsection>
-		<title>Examples</title>
-
-		<programlisting>SELECT LockRow('public', 'towns', '2', 'joey');
-LockRow
--------
-1
-
---Joey has already locked the record and Priscilla is out of luck
-SELECT LockRow('public', 'towns', '2', 'priscilla');
-LockRow
--------
-0
-
-		</programlisting>
-	  </refsection>
-
-	  <!-- Optionally add a "See Also" section -->
-	  <refsection>
-		<title>See Also</title>
-
-		<para><xref linkend="UnlockRows"/></para>
-	  </refsection>
-	</refentry>
-
-	<refentry xml:id="UnlockRows">
-	  <refnamediv>
-		<refname>UnlockRows</refname>
-
-		<refpurpose>Removes all locks held by an authorization token.
-		</refpurpose>
-	  </refnamediv>
-
-	  <refsynopsisdiv>
-		<funcsynopsis>
-		  <funcprototype>
-			<funcdef>integer <function>UnlockRows</function></funcdef>
-			<paramdef><type>text </type> <parameter>auth_token</parameter></paramdef>
-		  </funcprototype>
-		</funcsynopsis>
-	  </refsynopsisdiv>
-
-	  <refsection>
-		<title>Description</title>
-
-		<para>Removes all locks held by specified authorization token.
-		Returns the number of locks released.</para>
-
-		<para role="availability" conformance="1.1.3">Availability: 1.1.3</para>
-	  </refsection>
-
-
-	  <refsection>
-		<title>Examples</title>
-
-		<programlisting>
-		SELECT LockRow('towns', '353', 'priscilla');
-		SELECT LockRow('towns', '2', 'priscilla');
-		SELECT UnLockRows('priscilla');
-		UnLockRows
-		------------
-		2
-		</programlisting>
-	  </refsection>
-
-	  <!-- Optionally add a "See Also" section -->
-	  <refsection>
-		<title>See Also</title>
-
-		<para><xref linkend="LockRow"/></para>
-	  </refsection>
-	</refentry>
-  </section>
diff --git a/extras/WFS_locks/Makefile b/extras/WFS_locks/Makefile
deleted file mode 100644
index b27c26a62..000000000
--- a/extras/WFS_locks/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-CFLAGS += -g -Wall -O2 -pedantic -Wno-long-long -I$(shell pg_config --includedir-server)
-CC = gcc
-MODULE_FILENAME = $(PWD)/libWFS_locks.so
-
-ifneq ($(findstring 7.1,$(shell pg_config --version)),)
-	USE_VERSION=71
-else
-	ifneq ($(findstring 7.2,$(VERSION)),)
-		USE_VERSION=72
-	else
-		ifneq ($(findstring 7.3,$(VERSION)),)
-			USE_VERSION=73
-		else
-			ifneq ($(findstring 7.4,$(VERSION)),)
-				USE_VERSION=74
-			else
-				USE_VERSION=80
-			endif
-		endif
-	endif
-endif
-
-
-all: libWFS_locks.so WFS_locks.sql
-
-libWFS_locks.so: WFS_locks.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $<
-
-WFS_locks.sql: WFS_locks.sql.in
-	cpp -P -traditional-cpp -DUSE_VERSION=$(USE_VERSION) $< | sed -e 's:@MODULE_FILENAME@:$(MODULE_FILENAME):g' | grep -v '^#' > $@
-
-clean:
-	rm -f libWFS_locks.so WFS_locks.sql
diff --git a/extras/WFS_locks/README b/extras/WFS_locks/README
deleted file mode 100644
index 5641d1c8b..000000000
--- a/extras/WFS_locks/README
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Thu Mar 24 17:25:48 CET 2005
-----------------------------
-
-This module and associated pl/pgsql functions have been implemented
-to provide long locking support required by Web Feature Service
-specification (https://portal.opengeospatial.org/files/?artifact_id=7176)
-
-It is based on original work by David Blasby <dblasby at openplans.org>
-and has been modified and packaged by Sandro Santilli <strk at refractions.net>.
-
-
-  Usage:
-	
-	-- Enable long transaction support
-	SELECT EnableLongTransactions();
-
-	-- Disable long transaction support
-	SELECT DisableLongTransactions();
-
-	-- Check updates and deletes of rows in
-	-- given table for being authorized.
-	-- Identify rows using <column> value.
-	SELECT CheckAuth([<schema>], <table>, <column>)
-
-	-- Set lock/authorization for specific row in table
-	-- <authid> is a text value, <expires> is a timestamp
-	-- defaulting to now()+1hour.
-	-- Returns 1 if lock has been assigned, 0 otherwise
-	-- (already locked by other auth)
-	SELECT LockRow([<schema>], <table>, <rowid>, <authid>, [<expires>])
-
-	-- Remove all locks held by specified authorization id.
-	-- Returns the number of locks released.
-	SELECT UnlockRows(<authid>)
-
-	-- Add an authorization token to be used in current
-	-- transaction. 
-	SELECT AddAuth(<authid>)
-
-  WARNING! users must use serializable transaction level
-  (see http://www.postgresql.org/docs/7.4/static/transaction-iso.html)
-  otherwise locking mechanism would break
-  
-  
-	--strk;
diff --git a/extras/WFS_locks/WFS_locks.c b/extras/WFS_locks/WFS_locks.c
deleted file mode 100644
index 6655ac191..000000000
--- a/extras/WFS_locks/WFS_locks.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "postgres.h"
-#include "executor/spi.h"       /* this is what you need to work with SPI */
-#include "commands/trigger.h"   /* ... and triggers */
-#include "utils/lsyscache.h"	/* for get_namespace_name() */
-
-/*#define PGIS_DEBUG 1*/
-
-#define ABORT_ON_AUTH_FAILURE 1
-
-Datum check_authorization(PG_FUNCTION_ARGS);
-
-/*
- * This trigger will check for authorization before
- * allowing UPDATE or DELETE of specific rows.
- * Rows are identified by the provided column.
- * Authorization info is extracted by the
- * "authorization_table"
- *
- */
-PG_FUNCTION_INFO_V1(check_authorization);
-Datum check_authorization(PG_FUNCTION_ARGS)
-{
-	TriggerData *trigdata = (TriggerData *) fcinfo->context;
-	char *colname;
-	HeapTuple rettuple_ok;
-	HeapTuple rettuple_fail;
-	TupleDesc tupdesc;
-	int SPIcode;
-	char query[1024];
-	const char *pk_id = NULL;
-	SPITupleTable *tuptable;
-	HeapTuple tuple;
-	char *lockcode;
-	char *authtable = "authorization_table";
-	const char *op;
-	char errmsg[256];
-
-
-	/* Make sure trigdata is pointing at what I expect */
-	if ( ! CALLED_AS_TRIGGER(fcinfo) )
-	{
-		elog(ERROR,"check_authorization: not fired by trigger manager");
-	}
-
-	if ( ! TRIGGER_FIRED_BEFORE(trigdata->tg_event) )
-	{
-		elog(ERROR,"check_authorization: not fired *before* event");
-	}
-
-	if ( TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event) )
-	{
-		rettuple_ok = trigdata->tg_newtuple;
-		rettuple_fail = NULL;
-		op = "UPDATE";
-	}
-	else if ( TRIGGER_FIRED_BY_DELETE(trigdata->tg_event) )
-	{
-		rettuple_ok = trigdata->tg_trigtuple;
-		rettuple_fail = NULL;
-		op = "DELETE";
-	}
-	else
-	{
-		elog(ERROR,"check_authorization: not fired by update or delete");
-		PG_RETURN_NULL();
-	}
-
-
-	tupdesc = trigdata->tg_relation->rd_att;
-
-	/* Connect to SPI manager */
-	SPIcode = SPI_connect();
-
-	if (SPIcode  != SPI_OK_CONNECT)
-	{
-		elog(ERROR,"check_authorization: could not connect to SPI");
-		PG_RETURN_NULL() ;
-	}
-
-	colname  = trigdata->tg_trigger->tgargs[0];
-	pk_id = SPI_getvalue(trigdata->tg_trigtuple, tupdesc,
-	                     SPI_fnumber(tupdesc, colname));
-
-#if PGIS_DEBUG
-	elog(NOTICE,"check_authorization called");
-#endif
-
-	snprintf(query, sizeof(query), "SELECT authid FROM \"%s\" WHERE expires >= now() AND toid = '%d' AND rid = '%s'", authtable, trigdata->tg_relation->rd_id, pk_id);
-
-#if PGIS_DEBUG > 1
-	elog(NOTICE,"about to execute :%s", query);
-#endif
-
-	SPIcode = SPI_exec(query,0);
-	if (SPIcode !=SPI_OK_SELECT )
-		elog(ERROR,"couldnt execute to test for lock :%s",query);
-
-	if (!SPI_processed )
-	{
-#if PGIS_DEBUG
-		elog(NOTICE,"there is NO lock on row '%s'", pk_id);
-#endif
-		SPI_finish();
-		return PointerGetDatum(rettuple_ok);
-	}
-
-	/* there is a lock - check to see if I have rights to it! */
-
-	tuptable = SPI_tuptable;
-	tupdesc = tuptable->tupdesc;
-	tuple = tuptable->vals[0];
-	lockcode = SPI_getvalue(tuple, tupdesc, 1);
-
-#if PGIS_DEBUG
-	elog(NOTICE, "there is a lock on row '%s' (auth: '%s').", pk_id, lockcode);
-#endif
-
-	/*
-	 * check to see if temp_lock_have_table table exists
-	 * (it might not exist if they own no locks)
-	 */
-	snprintf(query, sizeof(query), "SELECT * FROM pg_class WHERE relname = 'temp_lock_have_table'");
-	SPIcode = SPI_exec(query,0);
-	if (SPIcode != SPI_OK_SELECT )
-		elog(ERROR,"couldnt execute to test for lockkey temp table :%s",query);
-	if (SPI_processed==0)
-	{
-		goto fail;
-	}
-
-	snprintf(query, sizeof(query), "SELECT * FROM temp_lock_have_table WHERE xideq( transid, getTransactionID() ) AND lockcode ='%s'", lockcode);
-
-#if PGIS_DEBUG
-	elog(NOTICE,"about to execute :%s", query);
-#endif
-
-	SPIcode = SPI_exec(query,0);
-	if (SPIcode != SPI_OK_SELECT )
-		elog(ERROR, "couldnt execute to test for lock acquire: %s", query);
-
-	if (SPI_processed >0)
-	{
-#if PGIS_DEBUG
-		elog(NOTICE,"I own the lock - I can modify the row");
-#endif
-		SPI_finish();
-		return PointerGetDatum(rettuple_ok);
-	}
-
-fail:
-
-	snprintf(errmsg, sizeof(errmsg), "%s where \"%s\" = '%s' requires authorization '%s'",
-	         op, colname, pk_id, lockcode);
-	errmsg[ERRMSGLEN-1] = '\0';
-
-#ifdef ABORT_ON_AUTH_FAILURE
-	elog(ERROR, "%s", errmsg);
-#else
-	elog(NOTICE, "%s", errmsg);
-#endif
-
-	SPI_finish();
-	return PointerGetDatum(rettuple_fail);
-
-
-}
-
-PG_FUNCTION_INFO_V1(getTransactionID);
-Datum getTransactionID(PG_FUNCTION_ARGS)
-{
-	TransactionId xid = GetCurrentTransactionId();
-	PG_RETURN_DATUM( TransactionIdGetDatum(xid) );
-}
diff --git a/extras/WFS_locks/WFS_locks.sql.in b/extras/WFS_locks/WFS_locks.sql.in
deleted file mode 100644
index 7f2346c8b..000000000
--- a/extras/WFS_locks/WFS_locks.sql.in
+++ /dev/null
@@ -1,371 +0,0 @@
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
---
--- PostGIS - Spatial Types for PostgreSQL
--- http://postgis.net
--- Copyright 2001-2003 Refractions Research Inc.
---
--- This is free software; you can redistribute and/or modify it under
--- the terms of the GNU General Public Licence. See the COPYING file.
---
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-#define CREATEFUNCTION CREATE OR REPLACE FUNCTION
-
-#if USE_VERSION > 72
-# define _IMMUTABLE_STRICT IMMUTABLE STRICT
-# define _IMMUTABLE IMMUTABLE
-# define _STABLE_STRICT STABLE STRICT
-# define _STABLE STABLE
-# define _VOLATILE_STRICT VOLATILE STRICT
-# define _VOLATILE VOLATILE
-# define _STRICT STRICT
-#else
-# define _IMMUTABLE_STRICT  with(iscachable,isstrict)
-# define _IMMUTABLE with(iscachable)
-# define _STABLE_STRICT with(isstrict)
-# define _STABLE
-# define _VOLATILE_STRICT with(isstrict)
-# define _VOLATILE
-# define _STRICT with(isstrict)
-#endif
-
-#if USE_VERSION >= 73
-# define HAS_SCHEMAS 1
-#endif
-
------------------------------------------------------------------------
--- LONG TERM LOCKING
------------------------------------------------------------------------
-
--- UnlockRows(authid)
--- removes all locks held by the given auth
--- returns the number of locks released
-CREATEFUNCTION UnlockRows(text)
-	RETURNS int
-	AS '
-DECLARE
-	ret int;
-BEGIN
-
-	IF NOT LongTransactionsEnabled() THEN
-		RAISE EXCEPTION ''Long transaction support disabled, use EnableLongTransaction() to enable.'';
-	END IF;
-
-	EXECUTE ''DELETE FROM authorization_table where authid = '' ||
-		quote_literal($1);
-
-	GET DIAGNOSTICS ret = ROW_COUNT;
-
-	RETURN ret;
-END;
-'
-LANGUAGE 'plpgsql' _VOLATILE_STRICT;
-
--- LockRow([schema], table, rowid, auth, [expires])
--- Returns 1 if successfully obtained the lock, 0 otherwise
-CREATEFUNCTION LockRow(text, text, text, text, timestamp)
-	RETURNS int
-	AS '
-DECLARE
-	myschema alias for $1;
-	mytable alias for $2;
-	myrid   alias for $3;
-	authid alias for $4;
-	expires alias for $5;
-	ret int;
-	mytoid oid;
-	myrec RECORD;
-
-BEGIN
-
-	IF NOT LongTransactionsEnabled() THEN
-		RAISE EXCEPTION ''Long transaction support disabled, use EnableLongTransaction() to enable.'';
-	END IF;
-
-	EXECUTE ''DELETE FROM authorization_table WHERE expires < now()'';
-
-#ifdef HAS_SCHEMAS
-	SELECT c.oid INTO mytoid FROM pg_class c, pg_namespace n
-		WHERE c.relname = mytable
-		AND c.relnamespace = n.oid
-		AND n.nspname = myschema;
-#else
-	SELECT c.oid INTO mytoid FROM pg_class c
-		WHERE c.relname = mytable;
-#endif
-
-	-- RAISE NOTICE ''toid: %'', mytoid;
-
-	FOR myrec IN SELECT * FROM authorization_table WHERE
-		toid = mytoid AND rid = myrid
-	LOOP
-		IF myrec.authid != authid THEN
-			RETURN 0;
-		ELSE
-			RETURN 1;
-		END IF;
-	END LOOP;
-
-	EXECUTE ''INSERT INTO authorization_table VALUES (''||
-		quote_literal(mytoid)||'',''||quote_literal(myrid)||
-		'',''||quote_literal(expires)||
-		'',''||quote_literal(authid) ||'')'';
-
-	GET DIAGNOSTICS ret = ROW_COUNT;
-
-	RETURN ret;
-END;'
-LANGUAGE 'plpgsql' _VOLATILE_STRICT;
-
--- LockRow(schema, table, rid, authid);
-CREATEFUNCTION LockRow(text, text, text, text)
-	RETURNS int
-	AS
-'SELECT LockRow($1, $2, $3, $4, now()::timestamp+''1:00'');'
-	LANGUAGE 'sql' _VOLATILE_STRICT;
-
--- LockRow(table, rid, authid);
-CREATEFUNCTION LockRow(text, text, text)
-	RETURNS int
-	AS
-#ifdef HAS_SCHEMAS
-'SELECT LockRow(current_schema(), $1, $2, $3, now()::timestamp+''1:00'');'
-#else
-'SELECT LockRow('''', $1, $2, $3, now()::timestamp+''1:00'');'
-#endif
-	LANGUAGE 'sql' _VOLATILE_STRICT;
-
--- LockRow(schema, table, rid, expires);
-CREATEFUNCTION LockRow(text, text, text, timestamp)
-	RETURNS int
-	AS
-#ifdef HAS_SCHEMAS
-'SELECT LockRow(current_schema(), $1, $2, $3, $4);'
-#else
-'SELECT LockRow('''', $1, $2, $3, $4);'
-#endif
-	LANGUAGE 'sql' _VOLATILE_STRICT;
-
-CREATEFUNCTION AddAuth(text)
-	RETURNS BOOLEAN
-	AS '
-DECLARE
-	lockid alias for $1;
-	okay boolean;
-	myrec record;
-BEGIN
-	-- check to see if table exists
-	--  if not, CREATE TEMP TABLE mylock (transid xid, lockcode text)
-	okay := ''f'';
-	FOR myrec IN SELECT * FROM pg_class WHERE relname = ''temp_lock_have_table'' LOOP
-		okay := ''t'';
-	END LOOP;
-	IF (okay <> ''t'') THEN
-		CREATE TEMP TABLE temp_lock_have_table (transid xid, lockcode text);
-			-- this will only work from pgsql7.4 up
-			-- ON COMMIT DELETE ROWS;
-	END IF;
-
-	--  INSERT INTO mylock VALUES ( $1)
---	EXECUTE ''INSERT INTO temp_lock_have_table VALUES ( ''||
---		quote_literal(getTransactionID()) || '','' ||
---		quote_literal(lockid) ||'')'';
-
-	INSERT INTO temp_lock_have_table VALUES (getTransactionID(), lockid);
-
-	RETURN true::boolean;
-END;
-'
-LANGUAGE PLPGSQL;
-
--- CheckAuth( <schema>, <table>, <ridcolumn> )
---
--- Returns 0
---
-CREATEFUNCTION CheckAuth(text, text, text)
-	RETURNS INT
-	AS '
-DECLARE
-#ifdef HAS_SCHEMAS
-	schema text;
-#endif
-BEGIN
-	IF NOT LongTransactionsEnabled() THEN
-		RAISE EXCEPTION ''Long transaction support disabled, use EnableLongTransaction() to enable.'';
-	END IF;
-
-#ifdef HAS_SCHEMAS
-	if ( $1 != '''' ) THEN
-		schema = $1;
-	ELSE
-		SELECT current_schema() into schema;
-	END IF;
-#endif
-
-	-- TODO: check for an already existing trigger ?
-
-	EXECUTE ''CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON ''
-#ifdef HAS_SCHEMAS
-		|| quote_ident(schema) || ''.'' || quote_ident($2)
-#else
-		|| quote_ident($2)
-#endif
-		||'' FOR EACH ROW EXECUTE PROCEDURE CheckAuthTrigger(''
-		|| quote_literal($3) || '')'';
-
-	RETURN 0;
-END;
-'
-LANGUAGE 'plpgsql';
-
--- CheckAuth(<table>, <ridcolumn>)
-CREATEFUNCTION CheckAuth(text, text)
-	RETURNS INT
-	AS
-	'SELECT CheckAuth('''', $1, $2)'
-	LANGUAGE 'SQL';
-
-CREATEFUNCTION CheckAuthTrigger()
-	RETURNS trigger AS
-	'@MODULE_FILENAME@', 'check_authorization'
-	LANGUAGE C;
-
-CREATEFUNCTION GetTransactionID()
-	RETURNS xid AS
-	'@MODULE_FILENAME@', 'getTransactionID'
-	LANGUAGE C;
-
---
--- Enable Long transactions support
---
---  Creates the authorization_table if not already existing
---
-CREATEFUNCTION EnableLongTransactions()
-	RETURNS TEXT
-	AS '
-DECLARE
-	query text;
-	exists bool;
-	rec RECORD;
-
-BEGIN
-
-	exists = ''f'';
-	FOR rec IN SELECT * FROM pg_class WHERE relname = ''authorization_table''
-	LOOP
-		exists = ''t'';
-	END LOOP;
-
-	IF NOT exists
-	THEN
-		query = ''CREATE TABLE authorization_table (
-			toid oid, -- table oid
-			rid text, -- row id
-			expires timestamp,
-			authid text
-		)'';
-		EXECUTE query;
-	END IF;
-
-	exists = ''f'';
-	FOR rec IN SELECT * FROM pg_class WHERE relname = ''authorized_tables''
-	LOOP
-		exists = ''t'';
-	END LOOP;
-
-	IF NOT exists THEN
-		query = ''CREATE VIEW authorized_tables AS '' ||
-			''SELECT '' ||
-#ifdef HAS_SCHEMAS
-			''n.nspname as schema, '' ||
-#endif
-			''c.relname as table, trim('' ||
-			quote_literal(''\\\\000'') ||
-			'' from t.tgargs) as id_column '' ||
-			''FROM pg_trigger t, pg_class c, pg_proc p '' ||
-#ifdef HAS_SCHEMAS
-			'', pg_namespace n '' ||
-#endif
-			''WHERE p.proname = '' || quote_literal(''checkauthtrigger'') ||
-#ifdef HAS_SCHEMAS
-			'' AND c.relnamespace = n.oid'' ||
-#endif
-			'' AND t.tgfoid = p.oid and t.tgrelid = c.oid'';
-		EXECUTE query;
-	END IF;
-
-	RETURN ''Long transactions support enabled'';
-END;
-'
-LANGUAGE 'plpgsql';
-
---
--- Check if Long transactions support is enabled
---
-CREATEFUNCTION LongTransactionsEnabled()
-	RETURNS bool
-AS '
-DECLARE
-	rec RECORD;
-BEGIN
-	FOR rec IN SELECT oid FROM pg_class WHERE relname = ''authorized_tables''
-	LOOP
-		return ''t'';
-	END LOOP;
-	return ''f'';
-END;
-'
-LANGUAGE 'plpgsql';
-
---
--- Disable Long transactions support
---
---  (1) Drop any long_xact trigger
---  (2) Drop the authorization_table
---  (3) KEEP the authorized_tables view
---
-CREATEFUNCTION DisableLongTransactions()
-	RETURNS TEXT
-	AS '
-DECLARE
-	query text;
-	exists bool;
-	rec RECORD;
-
-BEGIN
-
-	--
-	-- Drop all triggers applied by CheckAuth()
-	--
-	FOR rec IN
-		SELECT c.relname, t.tgname, t.tgargs FROM pg_trigger t, pg_class c, pg_proc p
-		WHERE p.proname = ''checkauthtrigger'' and t.tgfoid = p.oid and t.tgrelid = c.oid
-	LOOP
-		EXECUTE ''DROP TRIGGER '' || quote_ident(rec.tgname) ||
-			'' ON '' || quote_ident(rec.relname);
-	END LOOP;
-
-	--
-	-- Drop the authorization_table table
-	--
-	FOR rec IN SELECT * FROM pg_class WHERE relname = ''authorization_table'' LOOP
-		DROP TABLE authorization_table;
-	END LOOP;
-
-	--
-	-- Drop the authorized_tables view
-	--
-	FOR rec IN SELECT * FROM pg_class WHERE relname = ''authorized_tables'' LOOP
-		DROP VIEW authorized_tables;
-	END LOOP;
-
-	RETURN ''Long transactions support disabled'';
-END;
-'
-LANGUAGE 'plpgsql';
-
----------------------------------------------------------------
--- END
----------------------------------------------------------------
-
diff --git a/extras/WFS_locks/test.sql b/extras/WFS_locks/test.sql
deleted file mode 100644
index 5da5a7656..000000000
--- a/extras/WFS_locks/test.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-
-CREATE TABLE test_locks (id serial, b char(16), c char(16) );
-INSERT INTO test_locks(b) VALUES ('one');
-INSERT INTO test_locks(b) VALUES ('two');
-INSERT INTO test_locks(b) VALUES ('three');
-
--- Enable locks checking on the table
-SELECT CheckAuth('test_locks', 'id');
-
--- this has no lock
-UPDATE test_locks SET c = 'nolocks';
-
--- place the lock
-SELECT LockRow('test_locks', '1', 'auth1', now()::timestamp+'00:01');
-SELECT LockRow('test_locks', '2', 'auth2', now()::timestamp+'00:01');
-
--- this should fail due to missing auth
-UPDATE test_locks SET c = 'unauthorized' where id = 1;
-
-BEGIN;
-
-	-- Add authorization for row 1
-	SELECT AddAuth('auth1');
-
-	-- we're authorized for row 1
-	UPDATE test_locks SET c = 'authorized' where id = 1;
-
-END;
-
--- Out of transaction we're no more authorized for row 1
-UPDATE test_locks SET c = 'unauthorized' where id = 1;
-
-BEGIN;
-
-	-- Add authorization for row 2
-	SELECT AddAuth('auth2');
-
-	-- we're authorized for row 2
-	UPDATE test_locks SET c = 'authorized' where id = 2;
-
-END;
-
-BEGIN;
-
-	-- Add authorization for row 2
-	SELECT AddAuth('auth2');
-
-	-- we're *not* authorized for row 1
-	UPDATE test_locks SET c = 'unauthorized' where id = 1;
-
-END;
-
-UPDATE test_locks SET c = 'unauthorized' where id = 2;
-UPDATE test_locks SET c = 'unauthorized' where id = 1;
-
-SELECT * from test_locks;
-DROP TABLE test_locks;
-

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

Summary of changes:
 README.postgis                    |   4 +-
 doc/Makefile.in                   |   1 -
 doc/postgis.xml                   |   1 -
 doc/reference.xml                 |   3 +-
 doc/reference_transaction.xml     | 349 -----------------------------------
 extras/WFS_locks/Makefile         |  33 ----
 extras/WFS_locks/README           |  46 -----
 extras/WFS_locks/WFS_locks.c      | 173 ------------------
 extras/WFS_locks/WFS_locks.sql.in | 371 --------------------------------------
 extras/WFS_locks/test.sql         |  58 ------
 10 files changed, 3 insertions(+), 1036 deletions(-)
 delete mode 100644 doc/reference_transaction.xml
 delete mode 100644 extras/WFS_locks/Makefile
 delete mode 100644 extras/WFS_locks/README
 delete mode 100644 extras/WFS_locks/WFS_locks.c
 delete mode 100644 extras/WFS_locks/WFS_locks.sql.in
 delete mode 100644 extras/WFS_locks/test.sql


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list