Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f2cfd2

Browse files
committed
Fix dumping of casts and transforms using built-in functions
In pg_dump.c dumpCast() and dumpTransform(), we would happily ignore thecast or transform if it happened to use a built-in function because weweren't including the information about built-in functions when queryingpg_proc from getFuncs().Modify the query in getFuncs() to also gather information aboutfunctions which are used by user-defined casts and transforms (where"user-defined" means "has an OID >= FirstNormalObjectId"). This alsoadds to the TAP regression tests for 9.6 and master to cover thesetypes of objects.Back-patch all the way for casts, back to 9.5 for transforms.Discussion:https://www.postgresql.org/message-id/flat/20160504183952.GE10850%40tamriel.snowman.net
1 parentfc03f7d commit1f2cfd2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4204,7 +4204,9 @@ getFuncs(Archive *fout, int *numFuncs)
42044204
* 3. Otherwise, we normally exclude functions in pg_catalog. However, if
42054205
* they're members of extensions and we are in binary-upgrade mode then
42064206
* include them, since we want to dump extension members individually in
4207-
* that mode.
4207+
* that mode. Also, if they are used by casts then we need to gather the
4208+
* information about them, though they won't be dumped if they are
4209+
* built-in.
42084210
*/
42094211

42104212
if (fout->remoteVersion >=70300)
@@ -4226,7 +4228,11 @@ getFuncs(Archive *fout, int *numFuncs)
42264228
"\n AND ("
42274229
"\n pronamespace != "
42284230
"(SELECT oid FROM pg_namespace "
4229-
"WHERE nspname = 'pg_catalog')");
4231+
"WHERE nspname = 'pg_catalog')"
4232+
"\n OR EXISTS (SELECT 1 FROM pg_cast"
4233+
"\n WHERE pg_cast.oid > '%u'::oid"
4234+
"\n AND p.oid = pg_cast.castfunc)",
4235+
g_last_builtin_oid);
42304236
if (binary_upgrade&&fout->remoteVersion >=90100)
42314237
appendPQExpBuffer(query,
42324238
"\n OR EXISTS(SELECT 1 FROM pg_depend WHERE "
@@ -10170,7 +10176,8 @@ dumpCast(Archive *fout, CastInfo *cast)
1017010176
{
1017110177
funcInfo=findFuncByOid(cast->castfunc);
1017210178
if (funcInfo==NULL)
10173-
return;
10179+
exit_horribly(NULL,"unable to find function definition for OID %u",
10180+
cast->castfunc);
1017410181
}
1017510182

1017610183
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp