Switch opclass option functions to be STRICT (currently non-STRICT)
Switch opclass option functions to be STRICT (currently non-STRICT)
Hi all, During a recent review of 911e70207703 for a different issue, it has come up to me (and also Tom, in CC) that the following functions are marked as not strict (core backend or contrib/): brin_bloom_options brin_minmax_multi_options gtsvector_options ghstore_options gtrgm_options g_int_options g_intbig_options _ltree_gist_options ltree_gist_options However, if one looks at the internals of any of these functions, it is easy to note that they are not able to handle NULL inputs at all, leading to a crash (aka 8f7e35b08ad5). It looks like a mistake to me to declare them as not STRICT, while their internals are written to not be able to handle NULL. Most of these functions are in contrib/, and it feels overengineered to bump the modules just to mark these functions as STRICT, so I propose to have them do nothing if given a NULL input instead. The three opclass option functions in core can be flipped more easily in pg_proc.dat. Comments or opinions? -- Michael
Re: Switch opclass option functions to be STRICT (currently non-STRICT)
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Michael Paquier writes: > However, if one looks at the internals of any of these functions, it > is easy to note that they are not able to handle NULL inputs at all, > leading to a crash (aka 8f7e35b08ad5). It looks like a mistake to me > to declare them as not STRICT, while their internals are written to > not be able to handle NULL. Probably a mistake, but it's of no consequence. These all take type internal so they can't be called from SQL; if they could be, the hazards from passing a not-NULL pointer would be far worse than what happens with a NULL. I can't get excited about doing work to change it. regards, tom lane