<!-- Converted by db4-upgrade version 1.1 -->
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Version_Functions">
    <title>Version Functions</title><info>
    <abstract>
    <para>These functions report and upgrade PostGIS versions.
    </para>
    </abstract>
    </info>



<refentry xml:id="PostGIS_Extensions_Upgrade">
	  <refnamediv>
		<refname>PostGIS_Extensions_Upgrade</refname>

		<refpurpose>
Packages and upgrades PostGIS extensions (e.g. postgis_raster,
postgis_topology, postgis_sfcgal) to given or latest version.
    </refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Extensions_Upgrade</function></funcdef>
			<paramdef choice="opt"><type>text</type> <parameter>target_version=null</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Packages and upgrades PostGIS extensions
		to given or latest version. Only extensions you have installed in the
    database will be packaged and upgraded if needed.
		Reports full PostGIS version and build configuration infos after.
    This is short-hand for doing multiple CREATE EXTENSION .. FROM
    unpackaged and ALTER EXTENSION .. UPDATE for each PostGIS extension.
		Currently only tries to upgrade extensions postgis,
    postgis_raster, postgis_sfcgal, postgis_topology, and postgis_tiger_geocoder.</para>

		<para role="availability" conformance="2.5.0">Availability: 2.5.0</para>
		<note>
			<para role="changed" conformance="3.4.0">Changed: 3.4.0 to add target_version argument.</para>
            <para role="changed" conformance="3.3.0">Changed: 3.3.0 support for upgrades from any PostGIS version. Does not work on all systems.</para>
			<para role="changed" conformance="3.0.0">Changed: 3.0.0 to repackage loose extensions and support postgis_raster.</para>
		</note>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Extensions_Upgrade();</programlisting>
<screen>
NOTICE:  Packaging extension postgis
NOTICE:  Packaging extension postgis_raster
NOTICE:  Packaging extension postgis_sfcgal
NOTICE:  Extension postgis_topology is not available or not packagable for some reason
NOTICE:  Extension postgis_tiger_geocoder is not available or not packagable for some reason

                    postgis_extensions_upgrade
-------------------------------------------------------------------
 Upgrade completed, run SELECT postgis_full_version(); for details
(1 row)</screen>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para>
		<xref linkend="upgrading"/>,
		<xref linkend="PostGIS_GEOS_Version"/>,
		<xref linkend="PostGIS_Lib_Version"/>,
		<xref linkend="PostGIS_LibXML_Version"/>,
		<xref linkend="PostGIS_PROJ_Version"/>,
		<xref linkend="PostGIS_Version"/>
		</para>
	  </refsection>
	</refentry>



	<refentry xml:id="PostGIS_Full_Version">
	  <refnamediv>
		<refname>PostGIS_Full_Version</refname>

		<refpurpose>Reports full PostGIS version and build configuration
		infos.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Full_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Reports full PostGIS version and build configuration
		infos. Also informs about synchronization between
		libraries and scripts suggesting upgrades as needed.</para>
        <para role="enhanced" conformance="3.4.0">Enhanced: 3.4.0 now includes extra PROJ configurations NETWORK_ENABLED, URL_ENDPOINT and DATABASE_PATH of proj.db location </para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Full_Version();
							   postgis_full_version
----------------------------------------------------------------------------------
POSTGIS="3.4.0dev 3.3.0rc2-993-g61bdf43a7" [EXTENSION] PGSQL="160" GEOS="3.12.0dev-CAPI-1.18.0" SFCGAL="1.3.8" PROJ="7.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db" GDAL="GDAL 3.2.2, released 2021/03/05" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
(1 row)
</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para>
		<xref linkend="upgrading"/>,
		<xref linkend="PostGIS_GEOS_Version"/>,
		<xref linkend="PostGIS_Lib_Version"/>,
		<xref linkend="PostGIS_LibXML_Version"/>,
		<xref linkend="PostGIS_PROJ_Version"/>,
		<xref linkend="PostGIS_Wagyu_Version"/>,
		<xref linkend="PostGIS_Version"/>
		</para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_GEOS_Version">
	  <refnamediv>
		<refname>PostGIS_GEOS_Version</refname>

		<refpurpose>Returns the version number of the GEOS
		library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_GEOS_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the GEOS library, or
		<varname>NULL</varname> if GEOS support is not enabled.</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_GEOS_Version();
 postgis_geos_version
----------------------
3.12.0dev-CAPI-1.18.0
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_GEOS_Compiled_Version">
	  <refnamediv>
		<refname>PostGIS_GEOS_Compiled_Version</refname>

		<refpurpose>Returns the version number of the GEOS
		library against which PostGIS was built.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_GEOS_Compiled_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the GEOS library, or
		against which PostGIS was built.</para>

		<para role="availability" conformance="3.4.0">Availability: 3.4.0</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_GEOS_Compiled_Version();
 postgis_geos_compiled_version
-------------------------------
 3.12.0
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para>
<xref linkend="PostGIS_GEOS_Version"/>,
<xref linkend="PostGIS_Full_Version"/>
        </para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Liblwgeom_Version">
	  <refnamediv>
		<refname>PostGIS_Liblwgeom_Version</refname>

		<refpurpose>Returns the version number of the liblwgeom
		library.  This should match the version of PostGIS.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Liblwgeom_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the liblwgeom library/</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Liblwgeom_Version();
postgis_liblwgeom_version
--------------------------
3.4.0dev 3.3.0rc2-993-g61bdf43a7
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_LibXML_Version">
	  <refnamediv>
		<refname>PostGIS_LibXML_Version</refname>

		<refpurpose>Returns the version number of the libxml2
		library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_LibXML_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the LibXML2 library.</para>
		<para role="availability" conformance="1.5">Availability: 1.5</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_LibXML_Version();
 postgis_libxml_version
----------------------
 2.9.10
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

    <refentry xml:id="PostGIS_LibJSON_Version">
      <refnamediv>
        <refname>PostGIS_LibJSON_Version</refname>

        <refpurpose>Returns the version number of the libjson-c library.</refpurpose>
      </refnamediv>

      <refsynopsisdiv>
        <funcsynopsis>
          <funcprototype>
            <funcdef>text <function>PostGIS_LibJSON_Version</function></funcdef>

            <paramdef></paramdef>
          </funcprototype>
        </funcsynopsis>
      </refsynopsisdiv>

      <refsection>
        <title>Description</title>

        <para>Returns the version number of the LibJSON-C library.</para>
      </refsection>

      <refsection>
        <title>Examples</title>

        <programlisting>SELECT PostGIS_LibJSON_Version();
 postgis_libjson_version
-------------------------
 0.17</programlisting>
      </refsection>

      <refsection>
        <title>See Also</title>

        <para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>, <xref linkend="PostGIS_Version"/></para>
      </refsection>
    </refentry>

	<refentry xml:id="PostGIS_Lib_Build_Date">
	  <refnamediv>
		<refname>PostGIS_Lib_Build_Date</refname>

		<refpurpose>Returns build date of the PostGIS library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Lib_Build_Date</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns build date of the PostGIS library.</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Lib_Build_Date();
 postgis_lib_build_date
------------------------
 2023-06-22 03:56:11
(1 row)</programlisting>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Lib_Version">
	  <refnamediv>
		<refname>PostGIS_Lib_Version</refname>

		<refpurpose>Returns the version number of the PostGIS
		library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Lib_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the PostGIS library.</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Lib_Version();
 postgis_lib_version
---------------------
 3.4.0dev
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>,  <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_PROJ_Version">
	  <refnamediv>
		<refname>PostGIS_PROJ_Version</refname>

		<refpurpose>Returns the version number of the PROJ4
		library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_PROJ_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the PROJ library and some configuration options of proj.</para>

        <para role="enhanced" conformance="3.4.0">Enhanced: 3.4.0 now includes NETWORK_ENABLED, URL_ENDPOINT and DATABASE_PATH of proj.db location </para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_PROJ_Version();
  postgis_proj_version
-------------------------
7.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para>
<xref linkend="PostGIS_PROJ_Compiled_Version"/>,
<xref linkend="PostGIS_Full_Version"/>,
<xref linkend="PostGIS_GEOS_Version"/>,
<xref linkend="PostGIS_Lib_Version"/>,
<xref linkend="PostGIS_LibXML_Version"/>,
<xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_PROJ_Compiled_Version">
	  <refnamediv>
		<refname>PostGIS_PROJ_Compiled_Version</refname>

		<refpurpose>Returns the version number of the PROJ
		library against which PostGIS was built.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_PROJ_Compiled_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the PROJ library, or
		against which PostGIS was built.</para>

		<para role="availability" conformance="3.4.0">Availability: 3.5.0</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_PROJ_Compiled_Version();
 postgis_proj_compiled_version
-------------------------------
 9.1.1
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para>
<xref linkend="PostGIS_PROJ_Version"/>,
<xref linkend="PostGIS_Full_Version"/>
        </para>
	  </refsection>
	</refentry>


	<refentry xml:id="PostGIS_Wagyu_Version">
	  <refnamediv>
		<refname>PostGIS_Wagyu_Version</refname>

		<refpurpose>Returns the version number of the internal Wagyu library.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Wagyu_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the internal Wagyu library, or
		<varname>NULL</varname> if Wagyu support is not enabled.</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Wagyu_Version();
 postgis_wagyu_version
-----------------------
 0.5.0 (Internal)
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>,  <xref linkend="PostGIS_PROJ_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Scripts_Build_Date">
	  <refnamediv>
		<refname>PostGIS_Scripts_Build_Date</refname>

		<refpurpose>Returns build date of the PostGIS scripts.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Scripts_Build_Date</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns build date of the PostGIS scripts.</para>

		<para role="availability" conformance="1.0.0">Availability: 1.0.0RC1</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Scripts_Build_Date();
  postgis_scripts_build_date
-------------------------
 2023-06-22 03:56:11
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Scripts_Installed">
	  <refnamediv>
		<refname>PostGIS_Scripts_Installed</refname>

		<refpurpose>Returns version of the PostGIS scripts installed in this
			database.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Scripts_Installed</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns version of the PostGIS scripts installed in this
			database.</para>

		<note>
			  <para>If the output of this function doesn't match the output of
			  <xref linkend="PostGIS_Scripts_Released"/>
			  you probably missed to properly upgrade an existing database.
			  See the <link linkend="upgrading">Upgrading</link> section for
			  more info.</para>
		</note>

		<para role="availability" conformance="0.9.0">Availability: 0.9.0</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Scripts_Installed();
  postgis_scripts_installed
-------------------------
 3.4.0dev 3.3.0rc2-993-g61bdf43a7
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Scripts_Released"/>, <xref linkend="PostGIS_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Scripts_Released">
	  <refnamediv>
		<refname>PostGIS_Scripts_Released</refname>

		<refpurpose>Returns the version number of the postgis.sql script
		released with the installed PostGIS lib.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Scripts_Released</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the version number of the postgis.sql script
		released with the installed PostGIS lib.</para>

		<note>
		  <para>Starting with version 1.1.0 this function returns the same
		  value of <xref linkend="PostGIS_Lib_Version"/>. Kept
		  for backward compatibility.</para>
		</note>

		<para role="availability" conformance="0.9.0">Availability: 0.9.0</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Scripts_Released();
  postgis_scripts_released
-------------------------
 3.4.0dev 3.3.0rc2-993-g61bdf43a7
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_Scripts_Installed"/>, <xref linkend="PostGIS_Lib_Version"/></para>
	  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_Version">
	  <refnamediv>
		<refname>PostGIS_Version</refname>

		<refpurpose>Returns PostGIS version number and compile-time
		options.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>PostGIS_Version</function></funcdef>

			<paramdef></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns PostGIS version number and compile-time options.</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT PostGIS_Version();
			postgis_version
---------------------------------------
 3.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_Full_Version"/>, <xref linkend="PostGIS_GEOS_Version"/>, <xref linkend="PostGIS_Lib_Version"/>, <xref linkend="PostGIS_LibXML_Version"/>, <xref linkend="PostGIS_PROJ_Version"/></para>
	  </refsection>
	</refentry>

  </section>
