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
* Correct SQLSTATE for ENOMEM in file access @ 2024-02-02 19:02 Alexander Kuzmenkov <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Alexander Kuzmenkov @ 2024-02-02 19:02 UTC (permalink / raw) To: pgsql-hackers Looking through the logs of some server that were experiencing out of memory errors, I noticed that errcode_for_file_access() reports ERRCODE_INTERNAL_ERROR for ENOMEM, while the correct SQLSTATE for this should probably be ERRCODE_OUT_OF_MEMORY. Attached is a small patch to fix this. --- Alexander Kuzmenkov Timescale Attachments: [text/x-patch] enomem-sqlstate-v1.patch (542B, ../../CALzhyqzgQph0BY8-hFRRGdHhF8CoqmmDHW9S=hMZ-HMzLxRqDQ@mail.gmail.com/2-enomem-sqlstate-v1.patch) download | inline diff: diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 2c7a20e3d3..9860bf079a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -922,6 +922,10 @@ errcode_for_file_access(void) edata->sqlerrcode = ERRCODE_DISK_FULL; break; + case ENOMEM: /* Out of memory */ + edata->sqlerrcode = ERRCODE_OUT_OF_MEMORY; + break; + case ENFILE: /* File table overflow */ case EMFILE: /* Too many open files */ edata->sqlerrcode = ERRCODE_INSUFFICIENT_RESOURCES; ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Correct SQLSTATE for ENOMEM in file access @ 2024-02-02 19:12 Tom Lane <[email protected]> parent: Alexander Kuzmenkov <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2024-02-02 19:12 UTC (permalink / raw) To: Alexander Kuzmenkov <[email protected]>; +Cc: pgsql-hackers Alexander Kuzmenkov <[email protected]> writes: > Looking through the logs of some server that were experiencing out of > memory errors, I noticed that errcode_for_file_access() reports > ERRCODE_INTERNAL_ERROR for ENOMEM, while the correct SQLSTATE for this > should probably be ERRCODE_OUT_OF_MEMORY. Attached is a small patch to > fix this. Hmm, do you think this is actually reachable? AFAIK we should only be calling errcode_for_file_access() after functions that are unlikely to report ENOMEM. regards, tom lane ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-02-02 19:12 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-02-02 19:02 Correct SQLSTATE for ENOMEM in file access Alexander Kuzmenkov <[email protected]> 2024-02-02 19:12 ` Re: Correct SQLSTATE for ENOMEM in file access Tom Lane <[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