MCPcopy Create free account
hub / github.com/apache/cloudberry / bind_param_error_callback

Function bind_param_error_callback

src/backend/tcop/postgres.c:3356–3398  ·  view source on GitHub ↗

* bind_param_error_callback * * Error context callback used while parsing parameters in a Bind message */

Source from the content-addressed store, hash-verified

3354 * Error context callback used while parsing parameters in a Bind message
3355 */
3356static void
3357bind_param_error_callback(void *arg)
3358{
3359 BindParamCbData *data = (BindParamCbData *) arg;
3360 StringInfoData buf;
3361 char *quotedval;
3362
3363 if (data->paramno < 0)
3364 return;
3365
3366 /* If we have a textual value, quote it, and trim if necessary */
3367 if (data->paramval)
3368 {
3369 initStringInfo(&buf);
3370 appendStringInfoStringQuoted(&buf, data->paramval,
3371 log_parameter_max_length_on_error);
3372 quotedval = buf.data;
3373 }
3374 else
3375 quotedval = NULL;
3376
3377 if (data->portalName && data->portalName[0] != '\0')
3378 {
3379 if (quotedval)
3380 errcontext("portal \"%s\" parameter $%d = %s",
3381 data->portalName, data->paramno + 1, quotedval);
3382 else
3383 errcontext("portal \"%s\" parameter $%d",
3384 data->portalName, data->paramno + 1);
3385 }
3386 else
3387 {
3388 if (quotedval)
3389 errcontext("unnamed portal parameter $%d = %s",
3390 data->paramno + 1, quotedval);
3391 else
3392 errcontext("unnamed portal parameter $%d",
3393 data->paramno + 1);
3394 }
3395
3396 if (quotedval)
3397 pfree(quotedval);
3398}
3399
3400/*
3401 * exec_describe_statement_message

Callers

nothing calls this directly

Calls 3

initStringInfoFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected