Skip to content

Commit cce0f8e

Browse files
yohgakijohannes
authored andcommitted
Implement Request #47570 libpq's PG_VERSION should be exported to userland
1 parent d55afe4 commit cce0f8e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/pgsql/pgsql.c

+6
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,11 @@ PHP_MINIT_FUNCTION(pgsql)
934934
le_result = zend_register_list_destructors_ex(_free_result, NULL, "pgsql result", module_number);
935935
le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql large object", module_number);
936936
le_string = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql string", module_number);
937+
#if HAVE_PG_CONFIG_H
938+
/* PG_VERSION - libpq version */
939+
REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION", PG_VERSION, CONST_CS | CONST_PERSISTENT);
940+
REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT);
941+
#endif
937942
/* For connection option */
938943
REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT);
939944
/* For pg_fetch_array() */
@@ -1048,6 +1053,7 @@ PHP_MINFO_FUNCTION(pgsql)
10481053
php_info_print_table_header(2, "PostgreSQL Support", "enabled");
10491054
#if HAVE_PG_CONFIG_H
10501055
php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
1056+
php_info_print_table_row(2, "PostgreSQL(libpq) ", PG_VERSION_STR);
10511057
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
10521058
php_info_print_table_row(2, "Multibyte character support", "enabled");
10531059
#else

0 commit comments

Comments
 (0)