summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 2f1ef6cb1b4..466a3739857 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4204,7 +4204,9 @@ getFuncs(Archive *fout, int *numFuncs)
* 3. Otherwise, we normally exclude functions in pg_catalog. However, if
* they're members of extensions and we are in binary-upgrade mode then
* include them, since we want to dump extension members individually in
- * that mode.
+ * that mode. Also, if they are used by casts then we need to gather the
+ * information about them, though they won't be dumped if they are
+ * built-in.
*/
if (fout->remoteVersion >= 70300)
@@ -4226,7 +4228,11 @@ getFuncs(Archive *fout, int *numFuncs)
"\n AND ("
"\n pronamespace != "
"(SELECT oid FROM pg_namespace "
- "WHERE nspname = 'pg_catalog')");
+ "WHERE nspname = 'pg_catalog')"
+ "\n OR EXISTS (SELECT 1 FROM pg_cast"
+ "\n WHERE pg_cast.oid > '%u'::oid"
+ "\n AND p.oid = pg_cast.castfunc)",
+ g_last_builtin_oid);
if (binary_upgrade && fout->remoteVersion >= 90100)
appendPQExpBuffer(query,
"\n OR EXISTS(SELECT 1 FROM pg_depend WHERE "
@@ -10170,7 +10176,8 @@ dumpCast(Archive *fout, CastInfo *cast)
{
funcInfo = findFuncByOid(cast->castfunc);
if (funcInfo == NULL)
- return;
+ exit_horribly(NULL, "unable to find function definition for OID %u",
+ cast->castfunc);
}
/*