Commit dfbd5d65 authored by Tom Lane's avatar Tom Lane

plpgsql's private copy of xlateSqlType was out of sync. Again. This

is clearly not maintainable, so dike it out in favor of calling the real
version in the backend's gram.y.
parent 467f43d2
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -81,8 +81,6 @@ static int pfunc_num_args; ...@@ -81,8 +81,6 @@ static int pfunc_num_args;
*/ */
/*#define __YYSCLASS*/ /*#define __YYSCLASS*/
static char *xlateSqlFunc(char *);
static char *xlateSqlType(char *);
static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr); static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
static Node *makeTypeCast(Node *arg, TypeName *typename); static Node *makeTypeCast(Node *arg, TypeName *typename);
static Node *makeRowExpr(char *opr, List *largs, List *rargs); static Node *makeRowExpr(char *opr, List *largs, List *rargs);
...@@ -5879,7 +5877,7 @@ makeSetOp(SetOperation op, bool all, Node *larg, Node *rarg) ...@@ -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; * is a temporary expedient for pre-7.0 to 7.0 compatibility;
* these should go away for v7.1. * these should go away for v7.1.
*/ */
static char * char *
xlateSqlFunc(char *name) xlateSqlFunc(char *name)
{ {
if (strcmp(name,"character_length") == 0) if (strcmp(name,"character_length") == 0)
...@@ -5906,7 +5904,7 @@ xlateSqlFunc(char *name) ...@@ -5906,7 +5904,7 @@ xlateSqlFunc(char *name)
* the undocumented "lztext" type in 7.0. This can go away in 7.2 or later * the undocumented "lztext" type in 7.0. This can go away in 7.2 or later
* - tgl 2000-07-30 * - tgl 2000-07-30
*/ */
static char * char *
xlateSqlType(char *name) xlateSqlType(char *name)
{ {
if ((strcmp(name,"int") == 0) if ((strcmp(name,"int") == 0)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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); ...@@ -27,5 +27,7 @@ extern void yyerror(const char *message);
extern void parser_init(Oid *typev, int nargs); extern void parser_init(Oid *typev, int nargs);
extern Oid param_type(int t); extern Oid param_type(int t);
extern int yyparse(void); extern int yyparse(void);
extern char *xlateSqlFunc(char *name);
extern char *xlateSqlType(char *name);
#endif /* GRAMPARSE_H */ #endif /* GRAMPARSE_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * 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. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -46,19 +46,19 @@ ...@@ -46,19 +46,19 @@
#include "plpgsql.h" #include "plpgsql.h"
#include "pl.tab.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 "access/heapam.h"
#include "utils/syscache.h"
#include "catalog/catname.h" #include "catalog/catname.h"
#include "catalog/pg_proc.h" #include "catalog/pg_proc.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "catalog/pg_class.h" #include "catalog/pg_class.h"
#include "catalog/pg_attribute.h" #include "catalog/pg_attribute.h"
#include "catalog/pg_attrdef.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; ...@@ -85,13 +85,6 @@ int plpgsql_DumpExecTree = 0;
PLpgSQL_function *plpgsql_curr_compile; PLpgSQL_function *plpgsql_curr_compile;
/* ----------
* Local function declarations
* ----------
*/
static char *xlateSqlType(char *name);
/* ---------- /* ----------
* plpgsql_compile Given a pg_proc's oid, make * plpgsql_compile Given a pg_proc's oid, make
* an execution tree for it. * an execution tree for it.
...@@ -1386,34 +1379,3 @@ plpgsql_yyerror(const char *s) ...@@ -1386,34 +1379,3 @@ plpgsql_yyerror(const char *s)
plpgsql_comperrinfo(); plpgsql_comperrinfo();
elog(ERROR, "%s at or near \"%s\"", s, plpgsql_yytext); 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() */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment