|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.98 2003/07/01 00:04:37 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.99 2003/07/01 01:28:32 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -639,24 +639,32 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
|
639 | 639 | }
|
640 | 640 | }
|
641 | 641 |
|
| 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 | + |
642 | 648 | /*
|
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. |
646 | 656 | */
|
647 | 657 | if (!haspolyarg)
|
648 | 658 | {
|
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 |
| - |
655 | 659 | querytree_list = pg_parse_and_rewrite(prosrc,
|
656 | 660 | proc->proargtypes,
|
657 | 661 | proc->pronargs);
|
658 | 662 | check_sql_fn_retval(proc->prorettype, functyptype, querytree_list);
|
659 | 663 | }
|
| 664 | + else |
| 665 | + { |
| 666 | + querytree_list = pg_parse_query(prosrc); |
| 667 | + } |
660 | 668 |
|
661 | 669 | ReleaseSysCache(tuple);
|
662 | 670 |
|
|
0 commit comments