diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-14 22:48:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-14 22:48:25 +0000 |
commit | 20ab467d76d78271006818d2baf4c9c8658d1f38 (patch) | |
tree | 7a536111b5cc4e494ac75558aad5655dfc8ab964 /src/pl/plpython/plpython.c | |
parent | 48fb696753e267447f99914c7968d0b4ffb5c5dc (diff) |
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/pl/plpython/plpython.c')
-rw-r--r-- | src/pl/plpython/plpython.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index b8a516731f3..d20a5f72f13 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1,7 +1,7 @@ /********************************************************************** * plpython.c - python as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.75 2006/03/11 16:43:22 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.76 2006/03/14 22:48:24 tgl Exp $ * ********************************************************************* */ @@ -23,6 +23,7 @@ #include "nodes/makefuncs.h" #include "parser/parse_type.h" #include "tcop/tcopprot.h" +#include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/syscache.h" @@ -1873,6 +1874,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args) for (i = 0; i < nargs; i++) { char *sptr; + List *names; HeapTuple typeTup; Form_pg_type typeStruct; @@ -1882,9 +1884,13 @@ PLy_spi_prepare(PyObject * self, PyObject * args) sptr = PyString_AsString(optr); /* - * XXX should extend this to allow qualified type names + * Parse possibly-qualified type name and look it up in + * pg_type */ - typeTup = typenameType(makeTypeName(sptr)); + names = stringToQualifiedNameList(sptr, + "PLy_spi_prepare"); + typeTup = typenameType(NULL, + makeTypeNameFromNameList(names)); Py_DECREF(optr); optr = NULL; /* this is important */ |