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.
REL7_1_STABLE
Tom Lane 25 years ago
parent 467f43d2fa
commit dfbd5d6532
  1. 8
      src/backend/parser/gram.y
  2. 4
      src/include/parser/gramparse.h
  3. 52
      src/pl/plpgsql/src/pl_comp.c

@ -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)

@ -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 */

@ -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.
*
@ -46,19 +46,19 @@
#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() */

Loading…
Cancel
Save