aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/operatorcmds.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/commands/operatorcmds.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/commands/operatorcmds.c')
-rw-r--r--src/backend/commands/operatorcmds.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index e835aa94c1b..c40dbf9d821 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.28 2006/03/05 15:58:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.29 2006/03/14 22:48:18 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -152,9 +152,9 @@ DefineOperator(List *names, List *parameters)
/* Transform type names to type OIDs */
if (typeName1)
- typeId1 = typenameTypeId(typeName1);
+ typeId1 = typenameTypeId(NULL, typeName1);
if (typeName2)
- typeId2 = typenameTypeId(typeName2);
+ typeId2 = typenameTypeId(NULL, typeName2);
/*
* If any of the mergejoin support operators were given, then canMerge is
@@ -210,8 +210,9 @@ RemoveOperator(RemoveOperStmt *stmt)
HeapTuple tup;
ObjectAddress object;
- operOid = LookupOperNameTypeNames(operatorName, typeName1, typeName2,
- false);
+ operOid = LookupOperNameTypeNames(NULL, operatorName,
+ typeName1, typeName2,
+ false, -1);
tup = SearchSysCache(OPEROID,
ObjectIdGetDatum(operOid),
@@ -286,8 +287,9 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2,
rel = heap_open(OperatorRelationId, RowExclusiveLock);
- operOid = LookupOperNameTypeNames(name, typeName1, typeName2,
- false);
+ operOid = LookupOperNameTypeNames(NULL, name,
+ typeName1, typeName2,
+ false, -1);
AlterOperatorOwner_internal(rel, operOid, newOwnerId);