On Wed, 2006-01-11 at 23:31 -0500, Tom Lane wrote:
> This is a good catch, but the patch's added check on targetTyptype is a
> waste of code and cycles.  coerce_to_domain is perfectly capable of
> doing nothing when nothing is called for.

Ah, right. Attached is a corrected patch.

> I wonder whether there is any reasonably simple way to audit the whole
> backend for missing domain processing...

Yeah, I've been thinking along the same lines -- the recent spate of
issues doesn't give me a lot of confidence in the correctness or
completeness of the current implementation. I don't really see a way to
check the code that doesn't require a fair amount of manual auditing,
though...

-Neil

============================================================
*** src/backend/parser/parse_coerce.c	8b4850b0ee25092c7c6166233049c4b48f05d443
--- src/backend/parser/parse_coerce.c	53b570c1de15dce8755d904b3a1643d85015c5d4
***************
*** 243,249 ****
  		}
  
  		param->paramtype = targetTypeId;
! 		return (Node *) param;
  	}
  	if (find_coercion_pathway(targetTypeId, inputTypeId, ccontext,
  							  &funcId))
--- 243,252 ----
  		}
  
  		param->paramtype = targetTypeId;
! 
! 		/* Apply domain constraints, if necessary */
! 		return coerce_to_domain((Node *) param, InvalidOid, targetTypeId,
! 								cformat, false, false);
  	}
  	if (find_coercion_pathway(targetTypeId, inputTypeId, ccontext,
  							  &funcId))
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to