public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 2/2] Allow composite types in bootstrap
3+ messages / 3 participants
[nested] [flat]

* [PATCH 2/2] Allow composite types in bootstrap
@ 2020-11-17 15:28 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Justin Pryzby @ 2020-11-17 15:28 UTC (permalink / raw)

---
 src/backend/bootstrap/bootstrap.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 1b940d9d27..a0fcbb3d83 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -916,6 +916,7 @@ gettype(char *type)
 {
 	if (Typ != NIL)
 	{
+		static bool did_reread PG_USED_FOR_ASSERTS_ONLY = false; /* Already reread pg_types? */
 		ListCell *lc;
 
 		foreach (lc, Typ)
@@ -927,6 +928,33 @@ gettype(char *type)
 				return app->am_oid;
 			}
 		}
+
+		/*
+		 * The type wasn't known; check again to handle composite
+		 * types, added since first populating Typ.
+		 */
+
+		/*
+		 * Once all the types are populated and we handled composite
+		 * types, shouldn't need to do that again.
+		 */
+		Assert(!did_reread);
+		did_reread = true;
+
+		list_free_deep(Typ);
+		Typ = NIL;
+		populate_typ();
+
+		/* Need to avoid infinite recursion... */
+		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
 	{
-- 
2.17.0


--yQbNiKLmgenwUfTN--





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Crash: invalid DSA memory alloc request
@ 2024-12-17 21:32 Nathan Bossart <[email protected]>
  2024-12-18 01:42 ` Re: Crash: invalid DSA memory alloc request Andreas 'ads' Scherbaum <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Nathan Bossart @ 2024-12-17 21:32 UTC (permalink / raw)
  To: Andres Freund <[email protected]>; +Cc: Michael Paquier <[email protected]>; Andreas 'ads' Scherbaum <[email protected]>; Matthias van de Meent <[email protected]>; PostgreSQL Hackers <[email protected]>

Committed.

-- 
nathan






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Crash: invalid DSA memory alloc request
  2024-12-17 21:32 Re: Crash: invalid DSA memory alloc request Nathan Bossart <[email protected]>
@ 2024-12-18 01:42 ` Andreas 'ads' Scherbaum <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Andreas 'ads' Scherbaum @ 2024-12-18 01:42 UTC (permalink / raw)
  To: Nathan Bossart <[email protected]>; Andres Freund <[email protected]>; +Cc: Michael Paquier <[email protected]>; Matthias van de Meent <[email protected]>; PostgreSQL Hackers <[email protected]>

On 17/12/2024 22:32, Nathan Bossart wrote:
> Committed.
>

Thanks, I see you backpatched it all the way to 13.
Will see how far back I can test this, will take a while.


Regards,

-- 
				Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project







^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-12-18 01:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 15:28 [PATCH 2/2] Allow composite types in bootstrap Justin Pryzby <[email protected]>
2024-12-17 21:32 Re: Crash: invalid DSA memory alloc request Nathan Bossart <[email protected]>
2024-12-18 01:42 ` Re: Crash: invalid DSA memory alloc request Andreas 'ads' Scherbaum <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox