Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 79f6a94

Browse files
committed
Allow composite types in catalog bootstrap
When resolving types during catalog bootstrap, try to reload the pg_type contents if a type is not found. That allows catalogs to contain composite types, e.g. row types for other catalogs. Author: Justin Pryzby Reviewed-by: Dean Rasheed, Tomas Vondra Discussion: https://postgr.es/m/ad7891d2-e90c-b446-9fe2-7419143847d7%40enterprisedb.com
1 parent e1a5e65 commit 79f6a94

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/backend/bootstrap/bootstrap.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,29 @@ gettype(char *type)
934934
return app->am_oid;
935935
}
936936
}
937+
938+
/*
939+
* The type wasn't known; reload the pg_type contents and check again
940+
* to handle composite types, added since last populating the list.
941+
*/
942+
943+
list_free_deep(Typ);
944+
Typ = NIL;
945+
populate_typ_list();
946+
947+
/*
948+
* Calling gettype would result in infinite recursion for types missing
949+
* in pg_type, so just repeat the lookup.
950+
*/
951+
foreach (lc, Typ)
952+
{
953+
struct typmap *app = lfirst(lc);
954+
if (strncmp(NameStr(app->am_typ.typname), type, NAMEDATALEN) == 0)
955+
{
956+
Ap = app;
957+
return app->am_oid;
958+
}
959+
}
937960
}
938961
else
939962
{

0 commit comments

Comments
 (0)