@@ -4481,19 +4481,22 @@ getFuncs(Archive *fout, int *numFuncs)
4481
4481
selectSourceSchema (fout ,"pg_catalog" );
4482
4482
4483
4483
/*
4484
- * Find all user-defined functions. Normally we can exclude functions in
4485
- * pg_catalog, which is worth doing since there are several thousand of
4486
- * 'em. However, there are some extensions that create functions in
4487
- * pg_catalog. In normal dumps we can still ignore those --- but in
4488
- * binary-upgrade mode, we must dump the member objects of the extension,
4489
- * so be sure to fetch any such functions.
4484
+ * Find all interesting functions. This is a bit complicated:
4490
4485
*
4491
- * Also, in 9.2 and up, exclude functions that are internally dependent on
4492
- * something else, since presumably those will be created as a result of
4493
- * creating the something else. This currently only acts to suppress
4494
- * constructor functions for range types. Note that this is OK only
4495
- * because the constructors don't have any dependencies the range type
4496
- * doesn't have; otherwise we might not get creation ordering correct.
4486
+ * 1. Always exclude aggregates; those are handled elsewhere.
4487
+ *
4488
+ * 2. Always exclude functions that are internally dependent on something
4489
+ * else, since presumably those will be created as a result of creating
4490
+ * the something else. This currently acts only to suppress constructor
4491
+ * functions for range types (so we only need it in 9.2 and up). Note
4492
+ * this is OK only because the constructors don't have any dependencies
4493
+ * the range type doesn't have; otherwise we might not get creation
4494
+ * ordering correct.
4495
+ *
4496
+ * 3. Otherwise, we normally exclude functions in pg_catalog. However, if
4497
+ * they're members of extensions and we are in binary-upgrade mode then
4498
+ * include them, since we want to dump extension members individually in
4499
+ * that mode.
4497
4500
*/
4498
4501
4499
4502
if (fout -> remoteVersion >=70300 )
@@ -4504,16 +4507,18 @@ getFuncs(Archive *fout, int *numFuncs)
4504
4507
"pronamespace, "
4505
4508
"(%s proowner) AS rolname "
4506
4509
"FROM pg_proc p "
4507
- "WHERE NOT proisagg AND ("
4508
- "pronamespace != "
4509
- "(SELECT oid FROM pg_namespace "
4510
- "WHERE nspname = 'pg_catalog')" ,
4510
+ "WHERE NOT proisagg" ,
4511
4511
username_subquery );
4512
4512
if (fout -> remoteVersion >=90200 )
4513
4513
appendPQExpBufferStr (query ,
4514
4514
"\n AND NOT EXISTS (SELECT 1 FROM pg_depend "
4515
4515
"WHERE classid = 'pg_proc'::regclass AND "
4516
4516
"objid = p.oid AND deptype = 'i')" );
4517
+ appendPQExpBufferStr (query ,
4518
+ "\n AND ("
4519
+ "\n pronamespace != "
4520
+ "(SELECT oid FROM pg_namespace "
4521
+ "WHERE nspname = 'pg_catalog')" );
4517
4522
if (dopt -> binary_upgrade && fout -> remoteVersion >=90100 )
4518
4523
appendPQExpBufferStr (query ,
4519
4524
"\n OR EXISTS(SELECT 1 FROM pg_depend WHERE "