Skip to content

Commit 417e9cf

Browse files
committed
Implement Request #47570 libpq's PG_VERSION should be exported to userland
1 parent 65062b4 commit 417e9cf

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
@@ -947,6 +947,11 @@ PHP_MINIT_FUNCTION(pgsql)
947947
le_result = zend_register_list_destructors_ex(_free_result, NULL, "pgsql result", module_number);
948948
le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql large object", module_number);
949949
le_string = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql string", module_number);
950+
#if HAVE_PG_CONFIG_H
951+
/* PG_VERSION - libpq version */
952+
REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION", PG_VERSION, CONST_CS | CONST_PERSISTENT);
953+
REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT);
954+
#endif
950955
/* For connection option */
951956
REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT);
952957
/* For pg_fetch_array() */
@@ -1061,6 +1066,7 @@ PHP_MINFO_FUNCTION(pgsql)
10611066
php_info_print_table_header(2, "PostgreSQL Support", "enabled");
10621067
#if HAVE_PG_CONFIG_H
10631068
php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
1069+
php_info_print_table_row(2, "PostgreSQL(libpq) ", PG_VERSION_STR);
10641070
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
10651071
php_info_print_table_row(2, "Multibyte character support", "enabled");
10661072
#else

0 commit comments

Comments
 (0)