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

* [PATCH 2/3] 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 18eb62ca47..e4fc75ab84 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 the array.
+		 */
+
+		/*
+		 * 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 = NULL;
+		populate_typ_array();
+
+		/* 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.26.2


--------------9399ACFA5093E21681352885
Content-Type: text/x-patch; charset=UTF-8;
 name="0003-Extended-statistics-on-expressions-20210117.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-Extended-statistics-on-expressions-20210117.patch"



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

* Re: GUC names in messages
@ 2023-12-10 23:14 Peter Smith <[email protected]>
  2023-12-11 10:00 ` Re: GUC names in messages Michael Paquier <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Smith @ 2023-12-10 23:14 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Michael Paquier <[email protected]>; Nathan Bossart <[email protected]>; Laurenz Albe <[email protected]>; Tom Lane <[email protected]>; Daniel Gustafsson <[email protected]>; PostgreSQL Hackers <[email protected]>

This v5* looks good to me, except it will need some further
modification if PeterE's suggestion [1] to keep quotes for the
MixedCase GUCs is adopted.

======
[1] https://www.postgresql.org/message-id/9e7802b2-2cf2-4c2d-b680-b2ccb9db1d2f%40eisentraut.org

Kind Regards,
Peter Smith.
Futjisu Australia.






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

* Re: GUC names in messages
  2023-12-10 23:14 Re: GUC names in messages Peter Smith <[email protected]>
@ 2023-12-11 10:00 ` Michael Paquier <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-12-11 10:00 UTC (permalink / raw)
  To: Peter Smith <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Peter Eisentraut <[email protected]>; Nathan Bossart <[email protected]>; Laurenz Albe <[email protected]>; Tom Lane <[email protected]>; Daniel Gustafsson <[email protected]>; PostgreSQL Hackers <[email protected]>

On Mon, Dec 11, 2023 at 10:14:11AM +1100, Peter Smith wrote:
> This v5* looks good to me, except it will need some further
> modification if PeterE's suggestion [1] to keep quotes for the
> MixedCase GUCs is adopted.

-                errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-                          " but the server was compiled with CATALOG_VERSION_NO %d.",
-                          ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+                /*- translator: %s is a variable name and %d is its value */
+                errdetail("The database cluster was initialized with %s %d,"
+                          " but the server was compiled with %s %d.",
+                          "CATALOG_VERSION_NO",

Good point.  There are a lot of strings that can be shaved from the
translations here.

src/backend/access/transam/xlog.c:               errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x),"
src/backend/access/transam/xlog.c:               errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d,"
src/backend/access/transam/xlog.c:               errdetail("The database cluster was initialized without USE_FLOAT8_BYVAL"
src/backend/access/transam/xlog.c:               errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL"

I think that you should apply the same conversion for these ones.
There is no gain with the 1st and 3rd ones, but the 2nd and 4th one
can be grouped together.

FWIW, if we don't convert MixedCase GUCs to become mixedcase, I don't
think that there is any need to apply quotes to them because they
don't really look like natural English words.  That's as far as my
opinion goes, so feel free to ignore me if the consensus is different.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
  download

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


end of thread, other threads:[~2023-12-11 10:00 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/3] Allow composite types in bootstrap Justin Pryzby <[email protected]>
2023-12-10 23:14 Re: GUC names in messages Peter Smith <[email protected]>
2023-12-11 10:00 ` Re: GUC names in messages Michael Paquier <[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