Skip to content

Commit bca96dd

Browse files
committed
Fix crash of pg_stat_statements_info() without library loaded
Other code paths are already protected against this case, and _PG_init() warns about that in pg_stat_statements.c. While on it, I have checked the other extensions of the tree but did not notice any holes. Oversight in 9fbc3f3. Author: Jaime Casanova Reviewed-by: Julien Rouhaud Discussion: https://postgr.es/m/CAJKUy5gF4=_=qhJ1VX_tSGFfjKHb9BvzhRYWSApJD=Bfwp2SBw@mail.gmail.com
1 parent f854c69 commit bca96dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,11 @@ pg_stat_statements_info(PG_FUNCTION_ARGS)
18981898
Datum values[PG_STAT_STATEMENTS_INFO_COLS];
18991899
bool nulls[PG_STAT_STATEMENTS_INFO_COLS];
19001900

1901+
if (!pgss || !pgss_hash)
1902+
ereport(ERROR,
1903+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1904+
errmsg("pg_stat_statements must be loaded via shared_preload_libraries")));
1905+
19011906
/* Build a tuple descriptor for our result type */
19021907
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
19031908
elog(ERROR, "return type must be a row type");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy