On Mon, Apr 4, 2011 at 3:14 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Robert Haas <robertmh...@gmail.com> writes: >> On Mon, Apr 4, 2011 at 2:58 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >>> Another variant would be to allow the check_hook to pass back a separate >>> "void *" value that could be passed on to the assign_hook, containing >>> any necessary derived data. This is logically a bit cleaner, and would >>> work for all types of GUC variables; but it would make things messier in >>> guc.c since there would be an additional value to pass around. I'm not >>> convinced it's worth that, but could be talked into it if anyone feels >>> strongly about it. > >> I haven't really got the mental energy to think through all of this >> right now in detail, but I think that might be better. I think >> there's more kludgery here than we're going to fix in one pass, so as >> long as we're making improvements, I'm happy. Is there any case for >> using a Datum rather than a void * so people can pack a short quantity >> in directly without allocating memory, or are we expecting this to >> always be (say) a struct pointer? > > Well, I was intending to insist that the void* parameter point to a > single malloc'd block, so that guc.c could release it when the value was > no longer of interest by doing free(). If we don't say that, then we > are going to need a "free" hook for those objects, which is surely way > more notational overhead than is likely to be repaid for the occasional > cases where a single OID or whatever would be sufficient info.
OK. Please comment the crap out of whatever you do, or maybe even add a README. This stuff is just a bit arcane, and guideposts help a lot. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers