mirror of
https://github.com/pgpointcloud/pointcloud.git
synced 2025-12-08 20:36:04 +00:00
Add a PC_Full_Version function
This commit adds a PC_Full_Version function whose output is as follows: # select pc_full_version(); pc_full_version ------------------------------------------------------------------------------------------ POINTCLOUD="1.1.0" PGSQL="96" LIBXML2="2.9.4" LIBGHT enabled=false LAZPERF enabled=false (1 row)
This commit is contained in:
parent
b5a205c8f2
commit
0670d95d4b
@ -41,6 +41,10 @@ Datum pcpatch_size(PG_FUNCTION_ARGS);
|
||||
Datum pcpoint_size(PG_FUNCTION_ARGS);
|
||||
Datum pcpoint_pcid(PG_FUNCTION_ARGS);
|
||||
Datum pc_version(PG_FUNCTION_ARGS);
|
||||
Datum pc_pgsql_version(PG_FUNCTION_ARGS);
|
||||
Datum pc_libxml2_version(PG_FUNCTION_ARGS);
|
||||
Datum pc_libght_enable(PG_FUNCTION_ARGS);
|
||||
Datum pc_lazperf_enable(PG_FUNCTION_ARGS);
|
||||
|
||||
/* Generic aggregation functions */
|
||||
Datum pointcloud_agg_transfn(PG_FUNCTION_ARGS);
|
||||
@ -860,6 +864,46 @@ Datum pc_version(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_TEXT_P(version_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(pc_pgsql_version);
|
||||
Datum pc_pgsql_version(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *version_text;
|
||||
char version[12];
|
||||
snprintf(version, 12, "%d", PGSQL_VERSION);
|
||||
version_text = cstring_to_text(version);
|
||||
PG_RETURN_TEXT_P(version_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(pc_libxml2_version);
|
||||
Datum pc_libxml2_version(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *version_text;
|
||||
char version[64];
|
||||
snprintf(version, 64, "%s", LIBXML2_VERSION);
|
||||
version_text = cstring_to_text(version);
|
||||
PG_RETURN_TEXT_P(version_text);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(pc_libght_enabled);
|
||||
Datum pc_libght_enabled(PG_FUNCTION_ARGS)
|
||||
{
|
||||
#ifdef HAVE_LIBGHT
|
||||
PG_RETURN_BOOL(TRUE);
|
||||
#else
|
||||
PG_RETURN_BOOL(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(pc_lazperf_enabled);
|
||||
Datum pc_lazperf_enabled(PG_FUNCTION_ARGS)
|
||||
{
|
||||
#ifdef HAVE_LAZPERF
|
||||
PG_RETURN_BOOL(TRUE);
|
||||
#else
|
||||
PG_RETURN_BOOL(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a named dimension statistic from a PCPATCH
|
||||
* PC_PatchMax(patch pcpatch, dimname text) returns Numeric
|
||||
|
||||
@ -56,6 +56,26 @@ CREATE OR REPLACE FUNCTION pc_lib_version()
|
||||
RETURNS text AS 'MODULE_PATHNAME', 'pc_version'
|
||||
LANGUAGE 'c' IMMUTABLE STRICT;
|
||||
|
||||
-- Return the pgsql version number
|
||||
CREATE OR REPLACE FUNCTION pc_pgsql_version()
|
||||
RETURNS text AS 'MODULE_PATHNAME', 'pc_pgsql_version'
|
||||
LANGUAGE 'c' IMMUTABLE STRICT;
|
||||
|
||||
-- Return the libxml2 version number
|
||||
CREATE OR REPLACE FUNCTION pc_libxml2_version()
|
||||
RETURNS text AS 'MODULE_PATHNAME', 'pc_libxml2_version'
|
||||
LANGUAGE 'c' IMMUTABLE STRICT;
|
||||
|
||||
-- Return whether libght is enabled
|
||||
CREATE OR REPLACE FUNCTION pc_libght_enabled()
|
||||
RETURNS boolean AS 'MODULE_PATHNAME', 'pc_libght_enabled'
|
||||
LANGUAGE 'c' IMMUTABLE STRICT;
|
||||
|
||||
-- Return whether lazperf is enabled
|
||||
CREATE OR REPLACE FUNCTION pc_lazperf_enabled()
|
||||
RETURNS boolean AS 'MODULE_PATHNAME', 'pc_lazperf_enabled'
|
||||
LANGUAGE 'c' IMMUTABLE STRICT;
|
||||
|
||||
-- Return the extension version number and check sanity
|
||||
CREATE OR REPLACE FUNCTION pc_version()
|
||||
RETURNS text AS
|
||||
@ -75,6 +95,27 @@ END;
|
||||
$$
|
||||
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pc_full_version()
|
||||
RETURNS text AS
|
||||
$$
|
||||
DECLARE
|
||||
pcver TEXT;
|
||||
pgsqlver TEXT;
|
||||
libxml2ver TEXT;
|
||||
libghtenabled BOOLEAN;
|
||||
lazperfenabled BOOLEAN;
|
||||
BEGIN
|
||||
pcver := pc_version();
|
||||
pgsqlver := pc_pgsql_version();
|
||||
libxml2ver := pc_libxml2_version();
|
||||
libghtenabled := pc_libght_enabled();
|
||||
lazperfenabled := pc_lazperf_enabled();
|
||||
RETURN 'POINTCLOUD="' || pcver || '" PGSQL="' || pgsqlver || '" LIBXML2="' || libxml2ver ||
|
||||
'" LIBGHT enabled=' || libghtenabled || ' LAZPERF enabled=' || lazperfenabled;
|
||||
END;
|
||||
$$
|
||||
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
|
||||
|
||||
-- Upgrade pointcloud extension to latest (or specified) version.
|
||||
-- Takes care of in-development upgrades
|
||||
CREATE OR REPLACE FUNCTION pc_upgrade(to_version text DEFAULT NULL)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user