Michael Paquier <michael.paqu...@gmail.com> writes: > On Tue, Aug 30, 2016 at 10:18 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> I think what we ought to do is make ShmemAlloc act like palloc >> (ie throw error not return NULL), and remove the duplicated error >> checks.
> The only reason why I did not propose that for ShmemAlloc is because > of extensions potentially using this routine and having some special > handling when it returns NULL. And changing it to behave like palloc > would break such extensions. The evidence from the callers in core suggests that this change would be much more likely to fix extensions than break them, ie it's more likely that they are missing error checks than that they have something useful to do if the alloc fails. An extension that actually does need that could do something like #if CATALOG_VERSION_NO < whatever-v10-is #define ShmemAllocNoError(x) ShmemAlloc(x) #endif ... ptr = ShmemAllocNoError(size); if (ptr == NULL) // same as before from here on regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers