/*-------------------------------------------------------------------------
*
* version.c
- * Returns the version string
+ * Returns the PostgreSQL version string
+ *
+ * Copyright (c) 1998-2019, PostgreSQL Global Development Group
*
* IDENTIFICATION
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.10 2000/07/02 15:20:51 petere Exp $
+ * src/backend/utils/adt/version.c
*
*-------------------------------------------------------------------------
*/
-
#include "postgres.h"
+#include "utils/builtins.h"
-text *version(void);
-text *
-version(void)
+Datum
+pgsql_version(PG_FUNCTION_ARGS)
{
- int n = strlen(PG_VERSION_STR) + VARHDRSZ;
- text *ret = (text *) palloc(n);
-
- VARSIZE(ret) = n;
- memcpy(VARDATA(ret), PG_VERSION_STR, strlen(PG_VERSION_STR));
-
- return ret;
+ PG_RETURN_TEXT_P(cstring_to_text(PG_VERSION_STR));
}