summaryrefslogtreecommitdiff
path: root/src/backend/bootstrap
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2021-03-24 00:47:50 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2021-03-24 00:47:52 +0100
commit79f6a942bdb958fbd7ef6870d5bf2e3cefb65da5 (patch)
tree8a7e1fe86ebf0f6df85f7de1b7475d989e31c95e /src/backend/bootstrap
parente1a5e65703ce884529340819f6268d24f43ef8f7 (diff)
downloadpostgresql-79f6a942bdb958fbd7ef6870d5bf2e3cefb65da5.tar.gz
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
Diffstat (limited to 'src/backend/bootstrap')
-rw-r--r--src/backend/bootstrap/bootstrap.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 52d36ae1a2..dce7088e6b 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -934,6 +934,29 @@ gettype(char *type)
return app->am_oid;
}
}
+
+ /*
+ * The type wasn't known; reload the pg_type contents and check again
+ * to handle composite types, added since last populating the list.
+ */
+
+ list_free_deep(Typ);
+ Typ = NIL;
+ populate_typ_list();
+
+ /*
+ * Calling gettype would result in infinite recursion for types missing
+ * in pg_type, so just repeat the lookup.
+ */
+ foreach (lc, Typ)
+ {
+ struct typmap *app = lfirst(lc);
+ if (strncmp(NameStr(app->am_typ.typname), type, NAMEDATALEN) == 0)
+ {
+ Ap = app;
+ return app->am_oid;
+ }
+ }
}
else
{