plpgsql's private copy of xlateSqlType was out of sync. Again. This
authorTom Lane
Fri, 9 Feb 2001 03:26:28 +0000 (03:26 +0000)
committerTom Lane
Fri, 9 Feb 2001 03:26:28 +0000 (03:26 +0000)
is clearly not maintainable, so dike it out in favor of calling the real
version in the backend's gram.y.

src/backend/parser/gram.y
src/include/parser/gramparse.h
src/pl/plpgsql/src/pl_comp.c

index de0a7ace2fc92b75b639927a9ec88559c3b4826f..4066bff9b2e9efe8f2714f978a5510e7f3fa5d5f 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.219 2001/01/24 19:43:01 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.220 2001/02/09 03:26:28 tgl Exp $
  *
  * HISTORY
  *   AUTHOR            DATE            MAJOR EVENT
@@ -81,8 +81,6 @@ static int    pfunc_num_args;
  */
 /*#define __YYSCLASS*/
 
-static char *xlateSqlFunc(char *);
-static char *xlateSqlType(char *);
 static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
 static Node *makeTypeCast(Node *arg, TypeName *typename);
 static Node *makeRowExpr(char *opr, List *largs, List *rargs);
@@ -5879,7 +5877,7 @@ makeSetOp(SetOperation op, bool all, Node *larg, Node *rarg)
  * is a temporary expedient for pre-7.0 to 7.0 compatibility;
  * these should go away for v7.1.
  */
-static char *
+char *
 xlateSqlFunc(char *name)
 {
    if (strcmp(name,"character_length") == 0)
@@ -5906,7 +5904,7 @@ xlateSqlFunc(char *name)
  * the undocumented "lztext" type in 7.0.  This can go away in 7.2 or later
  * - tgl 2000-07-30
  */
-static char *
+char *
 xlateSqlType(char *name)
 {
    if ((strcmp(name,"int") == 0)
index bd9a4574183fca547480e4bdfbb454092efcdfb5..88c00ce9f370eb7cfde0996dd1cadc6fe06b5952 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: gramparse.h,v 1.14 2001/01/24 19:43:27 momjian Exp $
+ * $Id: gramparse.h,v 1.15 2001/02/09 03:26:27 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,5 +27,7 @@ extern void yyerror(const char *message);
 extern void parser_init(Oid *typev, int nargs);
 extern Oid param_type(int t);
 extern int yyparse(void);
+extern char *xlateSqlFunc(char *name);
+extern char *xlateSqlType(char *name);
 
 #endif  /* GRAMPARSE_H */
index 299a31da09d748b5e466556562171288b16fd1f1..ffcb7d72d6fd70f19b1372a0408513a7838d8050 100644 (file)
@@ -3,7 +3,7 @@
  *           procedural language
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.25 2000/12/08 00:03:02 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.26 2001/02/09 03:26:28 tgl Exp $
  *
  *   This software is copyrighted by Jan Wieck - Hamburg.
  *
 #include "plpgsql.h"
 #include "pl.tab.h"
 
-#include "executor/spi.h"
-#include "commands/trigger.h"
-#include "utils/builtins.h"
-#include "fmgr.h"
 #include "access/heapam.h"
-
-#include "utils/syscache.h"
 #include "catalog/catname.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_type.h"
 #include "catalog/pg_class.h"
 #include "catalog/pg_attribute.h"
 #include "catalog/pg_attrdef.h"
+#include "commands/trigger.h"
+#include "executor/spi.h"
+#include "fmgr.h"
+#include "parser/gramparse.h"
+#include "utils/builtins.h"
+#include "utils/syscache.h"
 
 
 /* ----------
@@ -85,13 +85,6 @@ int          plpgsql_DumpExecTree = 0;
 PLpgSQL_function *plpgsql_curr_compile;
 
 
-/* ----------
- * Local function declarations
- * ----------
- */
-static char *xlateSqlType(char *name);
-
-
 /* ----------
  * plpgsql_compile     Given a pg_proc's oid, make
  *                     an execution tree for it.
@@ -1386,34 +1379,3 @@ plpgsql_yyerror(const char *s)
    plpgsql_comperrinfo();
    elog(ERROR, "%s at or near \"%s\"", s, plpgsql_yytext);
 }
-
-
-/* ----------
- * xlateSqlType()
- * Convert alternate type names to internal Postgres types.
- *
- * Stolen from backend's main parser
- * ----------
- */
-static char *
-xlateSqlType(char *name)
-{
-   if ((strcmp(name,"int") == 0)
-       || (strcmp(name,"integer") == 0))
-       return "int4";
-   else if (strcmp(name, "smallint") == 0)
-       return "int2";
-   else if ((strcmp(name, "real") == 0)
-            || (strcmp(name, "float") == 0))
-       return "float8";
-   else if (strcmp(name, "decimal") == 0)
-       return "numeric";
-   else if (strcmp(name, "datetime") == 0)
-       return "timestamp";
-   else if (strcmp(name, "timespan") == 0)
-       return "interval";
-   else if (strcmp(name, "boolean") == 0)
-       return "bool";
-   else
-       return name;
-} /* xlateSqlType() */