Skip to content

Commit 36755d3

Browse files
committed
Added sql function pgpro_edition and correspoinding C-language define
1 parent 4fd9207 commit 36755d3

File tree

10 files changed

+39
-0
lines changed

10 files changed

+39
-0
lines changed

configure

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ build_os
756756
build_vendor
757757
build_cpu
758758
build
759+
PGPRO_EDITION
759760
PGPRO_PACKAGE_NAME
760761
PG_MAJORVERSION
761762
configure_args
@@ -2752,6 +2753,8 @@ fi
27522753

27532754
PGPRO_VERSION="$PACKAGE_VERSION.1"
27542755
PGPRO_PACKAGE_NAME="PostgresPro"
2756+
PGPRO_EDITION="standard"
2757+
27552758

27562759

27572760
cat >>confdefs.h <<_ACEOF
@@ -2764,6 +2767,11 @@ cat >>confdefs.h <<_ACEOF
27642767
_ACEOF
27652768

27662769

2770+
cat >>confdefs.h <<_ACEOF
2771+
#define PGPRO_EDITION "$PGPRO_EDITION"
2772+
_ACEOF
2773+
2774+
27672775
cat >>confdefs.h <<_ACEOF
27682776
#define PGPRO_VERSION "$PGPRO_VERSION"
27692777
_ACEOF

configure.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
4040
[PG_VERSION="$PACKAGE_VERSION"])
4141
PGPRO_VERSION="$PACKAGE_VERSION.1"
4242
PGPRO_PACKAGE_NAME="PostgresPro"
43+
PGPRO_EDITION="standard"
4344
AC_SUBST(PGPRO_PACKAGE_NAME)
45+
AC_SUBST(PGPRO_EDITION)
4446
AC_DEFINE_UNQUOTED(PG_VERSION, "$PG_VERSION", [PostgreSQL version as a string])
4547
AC_DEFINE_UNQUOTED(PGPRO_PACKAGE_NAME, "$PGPRO_PACKAGE_NAME", [PostgresPro name as a string])
48+
AC_DEFINE_UNQUOTED(PGPRO_EDITION,"$PGPRO_EDITION",[PostgresPro edition])
4649
AC_DEFINE_UNQUOTED(PGPRO_VERSION, "$PGPRO_VERSION", [PostgresPro version as a string])
4750

4851
AC_CANONICAL_HOST

doc/src/sgml/func.sgml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15427,6 +15427,11 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
1542715427
<entry><type>text</type></entry>
1542815428
<entry><productname>Postgres Pro</> version information.</entry>
1542915429
</row>
15430+
<row>
15431+
<entry><literal><function>pgpro_edition()</function></literal></entry>
15432+
<entry><type>text</type></entry>
15433+
<entry>Name of <productname>Postgres Pro</> edition.</entry>
15434+
</row>
1543015435
</tbody>
1543115436
</tgroup>
1543215437
</table>
@@ -15652,6 +15657,13 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
1565215657
of parsing the text version.
1565315658
</para>
1565415659
<indexterm>
15660+
<primary>pgpro_edition</primary>
15661+
</indexterm>
15662+
<para>
15663+
<literal><function>pgpro_edutuib()</function></literal>
15664+
returns a string, describing <productname>Postgres Pro</> edition
15665+
i.e. <literal>standard</literal> or <literal>enterprise</literal> </para>
15666+
<indexterm>
1565515667
<primary>pgpro_version</primary>
1565615668
</indexterm>
1565715669
<para>

src/backend/utils/adt/version.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ pgpro_version(PG_FUNCTION_ARGS)
2828
{
2929
PG_RETURN_TEXT_P(cstring_to_text(PGPRO_VERSION_STR));
3030
}
31+
32+
Datum
33+
pgpro_edition(PG_FUNCTION_ARGS)
34+
{
35+
PG_RETURN_TEXT_P(cstring_to_text(PGPRO_EDITION));
36+
}

src/include/catalog/pg_proc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5313,6 +5313,8 @@ DESCR("get progress for all replication origins");
53135313
DATA(insert OID = 6015 ( pgpro_version PGNSP PGUID 12 1 0 0 0 f f f f t f s s 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pgpro_version _null_ _null_ _null_ ));
53145314
DESCR("PostgresPro version string");
53155315

5316+
DATA(insert OID = 6019 ( pgpro_edition PGNSP PGUID 12 1 0 0 0 f f f f t f s s 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pgpro_edition _null_ _null_ _null_ ));
5317+
DESCR("PostgresPro edition");
53165318

53175319
/* rls */
53185320
DATA(insert OID = 3298 ( row_security_active PGNSP PGUID 12 1 0 0 0 f f f f t f s s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ row_security_active _null_ _null_ _null_ ));

src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@
775775
/* A string containing the version number of Postgres Pro */
776776
#undef PGPRO_VERSION_STR
777777

778+
/* PostgresPro edition */
779+
#undef PGPRO_EDITION
780+
778781
/* Define to 1 to allow profiling output to be saved separately for each
779782
process. */
780783
#undef PROFILE_PID_DIR

src/include/pg_config.h.win32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@
572572
#define PG_VERSION_NUM 90601
573573
#define PGPRO_PACKAGE_NAME "PostgresPro"
574574

575+
#define PGPRO_EDITION "standard"
576+
575577
#define PGPRO_PACKAGE_VERSION "9.6.1.1"
576578

577579
#define PGPRO_PACKAGE_STR "PostgresPro 9.6.1.1"

src/include/utils/builtins.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ extern Datum text_format_nv(PG_FUNCTION_ARGS);
892892
/* version.c */
893893
extern Datum pgsql_version(PG_FUNCTION_ARGS);
894894
extern Datum pgpro_version(PG_FUNCTION_ARGS);
895+
extern Datum pgpro_edition(PG_FUNCTION_ARGS);
895896

896897
/* xid.c */
897898
extern Datum xidin(PG_FUNCTION_ARGS);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE FUNCTION pg_catalog.pgpro_edition() RETURNS TEXT AS 'pgpro_edition' LANGUAGE internal STRICT IMMUTABLE;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT COUNT(*) > 0 AS pgpro_edition FROM pg_proc WHERE proname = 'pgpro_edition' AND pronamespace = 11;

0 commit comments

Comments
 (0)