Re: AllocSetContextCreate changes breake extensions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Christoph Berg <cb(at)df7cb(dot)de>
Subject: Re: AllocSetContextCreate changes breake extensions
Date: 2018-12-02 16:33:24
Message-ID: 28302.1543768404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> With this change, there is no reason for anybody to call
> AllocSetContextCreateExtended directly, so in HEAD I renamed it to

> except there IS such a reason: if you need (as I do in pl/lua) to wrap
> the call in a catch block, inside a function which takes the name and so
> on as a parameter, then you have no option but to do so (since using the
> macro errors out on the non-const parameter).

I'm kind of unimpressed by your example, because you're deliberately
breaking the safety check the macro sets out to provide. With code
structure like this, it's impossible to be sure that what was passed to
the wrapper function is actually a constant string. You'd be better
off using the workaround the comment suggests, which is to just pass ""
to AllocSetContextCreate and then use MemoryContextSetIdentifier to
copy the passed string.

> At least let's revert the pointless name change.

I don't think it's entirely pointless: it's keeping the "Extended"
name available for possible future use. If I revert, what name
are we going to use when we really do need an API-incompatible
version of AllocSetContextCreate?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-12-02 17:09:57 Re: [PATCH] Log CSV by default
Previous Message Pavel Stehule 2018-12-02 16:04:58 Re: [proposal] Add an option for returning SQLSTATE in psql error message