aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-07-01 01:28:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-07-01 01:28:32 +0000
commitf973b74583c24e28ff8977d0fdd455474705604a (patch)
tree127c630d1554b05c1b27874dcdff3299448af59f /src
parentc5faf2cf3ca92483ab0e71f5d0bdc2255b01df0a (diff)
downloadpostgresql-f973b74583c24e28ff8977d0fdd455474705604a.tar.gz
postgresql-f973b74583c24e28ff8977d0fdd455474705604a.zip
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 raw parser to catch silly syntactic errors.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/pg_proc.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 4ec4c44bd40..897ae682a34 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.98 2003/07/01 00:04:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.99 2003/07/01 01:28:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -639,24 +639,32 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
}
}
+ tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
+ if (isnull)
+ elog(ERROR, "null prosrc");
+
+ prosrc = DatumGetCString(DirectFunctionCall1(textout, tmp));
+
/*
- * We can't precheck the function definition if there are any polymorphic
- * input types, because actual datatypes of expression results will be
- * unresolvable. The check will be done at runtime instead.
+ * We can't do full prechecking of the function definition if there are
+ * any polymorphic input types, because actual datatypes of expression
+ * results will be unresolvable. The check will be done at runtime
+ * instead.
+ *
+ * We can run the text through the raw parser though; this will at
+ * least catch silly syntactic errors.
*/
if (!haspolyarg)
{
- tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
- if (isnull)
- elog(ERROR, "null prosrc");
-
- prosrc = DatumGetCString(DirectFunctionCall1(textout, tmp));
-
querytree_list = pg_parse_and_rewrite(prosrc,
proc->proargtypes,
proc->pronargs);
check_sql_fn_retval(proc->prorettype, functyptype, querytree_list);
}
+ else
+ {
+ querytree_list = pg_parse_query(prosrc);
+ }
ReleaseSysCache(tuple);