Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf973b74

Browse files
committed
Department of second thoughts: even if we can't run the full parser on
a SQL function with polymorphic inputs, we can at least run the rawparser to catch silly syntactic errors.
1 parentc5faf2c commitf973b74

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

‎src/backend/catalog/pg_proc.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.98 2003/07/0100:04:37 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.99 2003/07/0101:28:32 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -639,24 +639,32 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
639639
}
640640
}
641641

642+
tmp=SysCacheGetAttr(PROCOID,tuple,Anum_pg_proc_prosrc,&isnull);
643+
if (isnull)
644+
elog(ERROR,"null prosrc");
645+
646+
prosrc=DatumGetCString(DirectFunctionCall1(textout,tmp));
647+
642648
/*
643-
* We can't precheck the function definition if there are any polymorphic
644-
* input types, because actual datatypes of expression results will be
645-
* unresolvable. The check will be done at runtime instead.
649+
* We can't do full prechecking of the function definition if there are
650+
* any polymorphic input types, because actual datatypes of expression
651+
* results will be unresolvable. The check will be done at runtime
652+
* instead.
653+
*
654+
* We can run the text through the raw parser though; this will at
655+
* least catch silly syntactic errors.
646656
*/
647657
if (!haspolyarg)
648658
{
649-
tmp=SysCacheGetAttr(PROCOID,tuple,Anum_pg_proc_prosrc,&isnull);
650-
if (isnull)
651-
elog(ERROR,"null prosrc");
652-
653-
prosrc=DatumGetCString(DirectFunctionCall1(textout,tmp));
654-
655659
querytree_list=pg_parse_and_rewrite(prosrc,
656660
proc->proargtypes,
657661
proc->pronargs);
658662
check_sql_fn_retval(proc->prorettype,functyptype,querytree_list);
659663
}
664+
else
665+
{
666+
querytree_list=pg_parse_query(prosrc);
667+
}
660668

661669
ReleaseSysCache(tuple);
662670

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp