Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case when NULL is passed as argument of special functions #415

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/backend/parser/parse_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
}

if (sql_dialect == SQL_DIALECT_TSQL && report_proc_not_found_error_hook)
report_proc_not_found_error_hook(funcname, argnames, actual_arg_types, nargs, pstate, location, proc_call);
report_proc_not_found_error_hook(funcname, fargs, argnames, actual_arg_types, nargs, pstate, location, proc_call);

/*
* No function, and no column either. Since we're dealing with
Expand Down Expand Up @@ -1085,7 +1085,7 @@ func_select_candidate(int nargs,
(dump_restore && strcmp(dump_restore, "on") == 0)) && /* execute hook if dialect is T-SQL or while restoring babelfish database */
func_select_candidate_hook != NULL)
{
last_candidate = func_select_candidate_hook(NULL, nargs, input_typeids, candidates, false, false);
last_candidate = func_select_candidate_hook(NULL, NIL, nargs, input_typeids, candidates, false, false);
if (last_candidate)
return last_candidate; /* last_candiate->next should be already NULL */
}
Expand Down Expand Up @@ -1277,7 +1277,7 @@ func_select_candidate(int nargs,
(dump_restore && strcmp(dump_restore, "on") == 0)) && /* execute hook if dialect is T-SQL or while restoring babelfish database */
func_select_candidate_hook != NULL)
{
last_candidate = func_select_candidate_hook(NULL, nargs, input_typeids, candidates, true, false);
last_candidate = func_select_candidate_hook(NULL, NIL, nargs, input_typeids, candidates, true, false);
if (last_candidate)
return last_candidate; /* last_candiate->next should be already NULL */
}
Expand Down Expand Up @@ -1608,6 +1608,7 @@ func_get_detail(List *funcname,
func_select_candidate_hook != NULL)
{
best_candidate = func_select_candidate_hook(funcname,
fargs,
nargs,
argtypes,
current_candidates,
Expand Down
4 changes: 2 additions & 2 deletions src/include/parser/parse_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ extern void check_srf_call_placement(ParseState *pstate, Node *last_srf,
/*
* Hook interface to select a function from candidates
*/
typedef FuncCandidateList (*func_select_candidate_hook_type) (List *names, int nargs, Oid *input_typeids, FuncCandidateList candidates, bool unknowns_resolved, bool is_special);
typedef FuncCandidateList (*func_select_candidate_hook_type) (List *names, List *fargs, int nargs, Oid *input_typeids, FuncCandidateList candidates, bool unknowns_resolved, bool is_special);
/* Hook interface to process function arguments using probin */
typedef void (*make_fn_arguments_from_stored_proc_probin_hook_type)(ParseState *pstate,List *fargs,Oid *actual_arg_types,Oid *declared_arg_types,Oid funcid);
extern PGDLLIMPORT make_fn_arguments_from_stored_proc_probin_hook_type make_fn_arguments_from_stored_proc_probin_hook;
typedef void (*report_proc_not_found_error_hook_type) (List *names, List *argnames, Oid *input_typeids, int nargs, ParseState *pstate, int location, bool proc_call);
typedef void (*report_proc_not_found_error_hook_type) (List *names, List *fargs, List *argnames, Oid *input_typeids, int nargs, ParseState *pstate, int location, bool proc_call);
extern PGDLLIMPORT report_proc_not_found_error_hook_type report_proc_not_found_error_hook;

#endif /* PARSE_FUNC_H */
Loading