aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-03-14 22:48:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-03-14 22:48:25 +0000
commit20ab467d76d78271006818d2baf4c9c8658d1f38 (patch)
tree7a536111b5cc4e494ac75558aad5655dfc8ab964 /src/backend/utils/adt/ruleutils.c
parent48fb696753e267447f99914c7968d0b4ffb5c5dc (diff)
downloadpostgresql-20ab467d76d78271006818d2baf4c9c8658d1f38.tar.gz
postgresql-20ab467d76d78271006818d2baf4c9c8658d1f38.zip
Improve parser so that we can show an error cursor position for errors
during parse analysis, not only errors detected in the flex/bison stages. This is per my earlier proposal. This commit includes all the basic infrastructure, but locations are only tracked and reported for errors involving column references, function calls, and operators. More could be done later but this seems like a good set to start with. I've also moved the ReportSyntaxErrorPosition logic out of psql and into libpq, which should make it available to more people --- even within psql this is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 030f8c52b2f..9942bcc291b 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2,7 +2,7 @@
* ruleutils.c - Functions to convert stored expressions/querytrees
* back to source text
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.215 2006/03/11 16:43:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.216 2006/03/14 22:48:22 tgl Exp $
**********************************************************************/
#include "postgres.h"
@@ -4479,7 +4479,7 @@ get_from_clause_coldeflist(List *coldeflist, deparse_context *context)
int32 atttypmod;
attname = n->colname;
- atttypeid = typenameTypeId(n->typename);
+ atttypeid = typenameTypeId(NULL, n->typename);
atttypmod = n->typename->typmod;
if (i > 0)
@@ -4868,13 +4868,16 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
switch (operform->oprkind)
{
case 'b':
- p_result = oper(list_make1(makeString(oprname)), arg1, arg2, true);
+ p_result = oper(NULL, list_make1(makeString(oprname)), arg1, arg2,
+ true, -1);
break;
case 'l':
- p_result = left_oper(list_make1(makeString(oprname)), arg2, true);
+ p_result = left_oper(NULL, list_make1(makeString(oprname)), arg2,
+ true, -1);
break;
case 'r':
- p_result = right_oper(list_make1(makeString(oprname)), arg1, true);
+ p_result = right_oper(NULL, list_make1(makeString(oprname)), arg1,
+ true, -1);
break;
default:
elog(ERROR, "unrecognized oprkind: %d", operform->oprkind);