From a8f8eb1015ff27f75710eefc4d402e61688ff76d Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Sun, 12 Oct 2008 22:58:41 +0000 Subject: [PATCH] Cleanup. --- pgtap.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pgtap.c b/pgtap.c index 0fcc6dba4..141c47ad1 100644 --- a/pgtap.c +++ b/pgtap.c @@ -27,10 +27,17 @@ pg_typeof(PG_FUNCTION_ARGS) PG_RETURN_OID( get_fn_expr_argtype(fcinfo->flinfo, 0) ); } +/* + * pg_version() + * Returns the version number as output by version(), but without all the + * other crap. Code borrowed from version.c. + */ + +PG_FUNCTION_INFO_V1(pg_version); + Datum pg_version(PG_FUNCTION_ARGS) { - /* Code borrowed from version.c. */ int n = strlen(PG_VERSION); text *ret = (text *) palloc(n + VARHDRSZ); @@ -44,13 +51,20 @@ pg_version(PG_FUNCTION_ARGS) PG_RETURN_TEXT_P(ret); } +/* + * pg_version_num() + * Returns the version number as an integer. Support for pre-8.2 borrowed from + * dumputils.c. + */ + +PG_FUNCTION_INFO_V1(pg_version_num); + Datum pg_version_num(PG_FUNCTION_ARGS) { #ifdef PG_VERSION_NUM PG_RETURN_INT32(PG_VERSION_NUM); #else - /* Code borrowed from dumputils.c. */ int cnt; int vmaj, vmin,