how set GUC_check_errhint_string in call_string_check_hook()

Started by amul sulalmost 12 years ago3 messages
#1amul sul
sul_amul@yahoo.co.in

Dear all,

I need help to send hint message to erreport()  in  call_string_check_hook function [src/backend/utils/misc/guc.c:8092]

In   call_string_check_hook(), following parameter are resets

  /* Reset variables that might be set by hook */
8100         GUC_check_errcode_value = ERRCODE_INVALID_PARAMETER_VALUE;
8101         GUC_check_errmsg_string = NULL;
8102         GUC_check_errdetail_string = NULL;
8103         GUC_check_errhint_string = NULL;

at line 8107 in ereport() it has conditional operation as

8113GUC_check_errdetail_string ?

8114                                  errdetail_internal("%s", GUC_check_errdetail_string) : 0,

I have basic questions,
 
1. Condition testing of  GUC_check_errdetail_string or other GUC_*  is needed, even if we resting it?
2. Can I pass hint message in above ereport(), how?

Thanks in advance !

Regards,
Amul Sul

#2Amit Langote
amitlangote09@gmail.com
In reply to: amul sul (#1)
Re: how set GUC_check_errhint_string in call_string_check_hook()

Amul,

On Thu, Feb 13, 2014 at 5:59 PM, amul sul <sul_amul@yahoo.co.in> wrote:

I have basic questions,

1. Condition testing of GUC_check_errdetail_string or other GUC_* is
needed, even if we resting it?

A few lines before this conditional test, there is a call to the hook
function (using the check_hook function pointer) as follows which
might set these variables:

if (!(*conf->check_hook) (newval, extra, source))

2. Can I pass hint message in above ereport(), how?

It could be done by setting the check hook related global variable
"GUC_check_errhint_string" inside your hook function.

--
Amit

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Amit Langote (#2)
Re: how set GUC_check_errhint_string in call_string_check_hook()

Amit Langote <amitlangote09@gmail.com> writes:

On Thu, Feb 13, 2014 at 5:59 PM, amul sul <sul_amul@yahoo.co.in> wrote:

2. Can I pass hint message in above ereport(), how?

It could be done by setting the check hook related global variable
"GUC_check_errhint_string" inside your hook function.

You should use the macro GUC_check_errhint() to set up a hint inside
a GUC variable's check function. See check_XactIsoLevel() in
src/backend/commands/variable.c for examples.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers