public inbox for [email protected]
help / color / mirror / Atom feed[PATCH 2/3] Allow composite types in bootstrap
2+ messages / 2 participants
[nested] [flat]
* [PATCH 2/3] Allow composite types in bootstrap
@ 2020-11-17 15:28 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
* Re: [RFC] building postgres with meson - autogenerated headers
@ 2022-02-08 13:19 Peter Eisentraut <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2022-02-08 13:19 UTC (permalink / raw)
To: Andres Freund <[email protected]>; pgsql-hackers; Tom Lane <[email protected]>
On 07.02.22 20:24, Andres Freund wrote:
> To be honest, I do not really understand the logic behind when autoconf ends
> up with #defines that define a macro to 0/1 and when a macro ends defined/or
> not and when we end up with a macro defined to 1 or not defined at all.
The default is to define to 1 or not at all. The reason for this is
presumably that originally, autoconf (or its predecessor practices) just
populated the command line with a few -DHAVE_THIS options. Creating a
header file came later. And -DFOO is equivalent to #define FOO 1.
Also, this behavior allows code to use both the #ifdef HAVE_THIS and the
#if HAVE_THIS style.
The cases that deviate from this have a special reason for this. One
issue to consider is that depending on how the configure script is set
up or structured, a test might not run at all. But for example, if you
have a check for a declaration of a function, and the test doesn't run
in a particular configuration, the fallback in your own code would
normally be to then manually declare the function yourself. But if you
didn't even run the test, then adding a declaration of a function you
didn't want in the first place might be bad. In that case, you can
check with #ifdef whether the test was run, and then check the value of
the macro for the test outcome.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-02-08 13:19 UTC | newest]
Thread overview: 2+ 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]>
2022-02-08 13:19 Re: [RFC] building postgres with meson - autogenerated headers Peter Eisentraut <[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