From c60f70b53f26dafe50a3814086d0ff37b40ee71c Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 11 Dec 1997 17:36:58 +0000
Subject: [PATCH] Rename pg_plan and pg_eval to be more meaningful.

---
 src/backend/catalog/heap.c               |  6 +++---
 src/backend/catalog/pg_proc.c            |  4 ++--
 src/backend/commands/_deadcode/version.c |  6 +++---
 src/backend/commands/dbcommands.c        |  6 +++---
 src/backend/commands/user.c              | 12 +++++------
 src/backend/executor/functions.c         |  4 ++--
 src/backend/executor/spi.c               |  2 +-
 src/backend/optimizer/path/xfunc.c       |  4 ++--
 src/backend/rewrite/rewriteDefine.c      |  4 ++--
 src/backend/tcop/postgres.c              | 27 +++++++++++++-----------
 src/include/tcop/tcopprot.h              |  8 +++----
 11 files changed, 43 insertions(+), 40 deletions(-)

diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 215ebebdea7..4384aa34a5b 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.40 1997/12/01 21:00:35 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.41 1997/12/11 17:35:59 momjian Exp $
  *
  * INTERFACE ROUTINES
  *		heap_create()			- Create an uncataloged heap relation
@@ -1510,7 +1510,7 @@ start:;
 	sprintf(str, "select %s%s from %.*s", attrdef->adsrc, cast,
 			NAMEDATALEN, rel->rd_rel->relname.data);
 	setheapoverride(true);
-	planTree_list = (List *) pg_plan(str, NULL, 0, &queryTree_list, None);
+	planTree_list = (List *) pg_parse_and_plan(str, NULL, 0, &queryTree_list, None);
 	setheapoverride(false);
 	query = (Query *) (queryTree_list->qtrees[0]);
 
@@ -1580,7 +1580,7 @@ StoreRelCheck(Relation rel, ConstrCheck *check)
 	sprintf(str, "select 1 from %.*s where %s",
 			NAMEDATALEN, rel->rd_rel->relname.data, check->ccsrc);
 	setheapoverride(true);
-	planTree_list = (List *) pg_plan(str, NULL, 0, &queryTree_list, None);
+	planTree_list = (List *) pg_parse_and_plan(str, NULL, 0, &queryTree_list, None);
 	setheapoverride(false);
 	query = (Query *) (queryTree_list->qtrees[0]);
 
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index e08bb549c61..464c8f68c6f 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.10 1997/11/25 21:58:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.11 1997/12/11 17:36:01 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -215,7 +215,7 @@ ProcedureCreate(char *procedureName,
 
 	if (strcmp(languageName, "sql") == 0)
 	{
-		plan_list = pg_plan(prosrc, typev, parameterCount,
+		plan_list = pg_parse_and_plan(prosrc, typev, parameterCount,
 							&querytree_list, dest);
 
 		/* typecheck return value */
diff --git a/src/backend/commands/_deadcode/version.c b/src/backend/commands/_deadcode/version.c
index 829f9241ee8..a9e88692b1e 100644
--- a/src/backend/commands/_deadcode/version.c
+++ b/src/backend/commands/_deadcode/version.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.8 1997/11/25 21:59:11 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.9 1997/12/11 17:36:08 momjian Exp $
  *
  * NOTES
  *	  At the point the version is defined, 2 physical relations are created
@@ -95,7 +95,7 @@ eval_as_new_xact(char *query)
 	 * CommitTransactionCommand(); StartTransactionCommand();
 	 */
 	CommandCounterIncrement();
-	pg_eval(query, (char **) NULL, (Oid *) NULL, 0);
+	pg_exec_query(query, (char **) NULL, (Oid *) NULL, 0);
 }
 
 #endif
@@ -157,7 +157,7 @@ VersionCreate(char *vname, char *bname)
 	sprintf(query_buf, "SELECT * INTO TABLE %s from %s where 1 =2",
 			vname, bname);
 
-	pg_eval(query_buf, (char **) NULL, (Oid *) NULL, 0);
+	pg_exec_query(query_buf, (char **) NULL, (Oid *) NULL, 0);
 
 	/*
 	 * Creating the ``v_added'' relation
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 861ce8db810..dc685022b20 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.2 1997/11/24 05:32:18 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.3 1997/12/11 17:36:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -95,7 +95,7 @@ createdb(char *dbname, char *dbpath)
 	sprintf(buf, "insert into pg_database (datname, datdba, datpath)"
 		" values (\'%s\', \'%d\', \'%s\');", dbname, user_id, loc);
 
-	pg_eval(buf, (char **) NULL, (Oid *) NULL, 0);
+	pg_exec_query(buf, (char **) NULL, (Oid *) NULL, 0);
 }
 
 void
@@ -133,7 +133,7 @@ destroydb(char *dbname)
 	 */
 	sprintf(buf, "delete from pg_database where pg_database.oid = \'%d\'::oid",
 			db_id);
-	pg_eval(buf, (char **) NULL, (Oid *) NULL, 0);
+	pg_exec_query(buf, (char **) NULL, (Oid *) NULL, 0);
 
 	/*
 	 * remove the data directory. If the DELETE above failed, this will
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 8f71fec451a..1a21a07598b 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -1,7 +1,7 @@
 /*-------------------------------------------------------------------------
  *
  * user.c--
- *	  use pg_eval to create a new user in the catalog
+ *	  use pg_exec_query to create a new user in the catalog
  *
  * Copyright (c) 1994, Regents of the University of California
  *
@@ -43,7 +43,7 @@ void UpdatePgPwdFile(char* sql) {
 
   filename = crypt_getpwdfilename();
   sprintf(sql, "copy %s to '%s' using delimiters '#'", UserRelationName, filename);
-  pg_eval(sql, (char**)NULL, (Oid*)NULL, 0);
+  pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
 }
 
 /*---------------------------------------------------------------------
@@ -147,7 +147,7 @@ void DefineUser(CreateUserStmt *stmt) {
   }
   strcat(sql_end, ")");
 
-  pg_eval(sql, (char**)NULL, (Oid*)NULL, 0);
+  pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
 
   /* Add the stuff here for groups.
    */
@@ -250,7 +250,7 @@ extern void AlterUser(AlterUserStmt *stmt) {
   if (sql_end != sql) {
     sql_end += strlen(sql_end);
     sprintf(sql_end, " where usename = '%s'", stmt->user);
-    pg_eval(sql, (char**)NULL, (Oid*)NULL, 0);
+    pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
   }
 
   /* do the pg_group stuff here */
@@ -346,7 +346,7 @@ extern void RemoveUser(char* user) {
     elog(NOTICE, "Dropping database %s", dbase[ndbase]);
     sprintf(sql, "drop database %s", dbase[ndbase]);
     pfree((void*)dbase[ndbase]);
-    pg_eval(sql, (char**)NULL, (Oid*)NULL, 0);
+    pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
   }
   if (dbase)
     pfree((void*)dbase);
@@ -369,7 +369,7 @@ extern void RemoveUser(char* user) {
   /* Remove the user from the pg_user table
    */
   sprintf(sql, "delete from %s where usename = '%s'", UserRelationName, user);
-  pg_eval(sql, (char**)NULL, (Oid*)NULL, 0);
+  pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
 
   UpdatePgPwdFile(sql);
 
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 2f0e0b91e20..f19c3d361cd 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.13 1997/11/25 21:59:19 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.14 1997/12/11 17:36:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -113,7 +113,7 @@ init_execution_state(FunctionCachePtr fcache,
 
 
 	planTree_list = (List *)
-		pg_plan(fcache->src, fcache->argOidVect, nargs, &queryTree_list, None);
+		pg_parse_and_plan(fcache->src, fcache->argOidVect, nargs, &queryTree_list, None);
 
 	for (i = 0; i < queryTree_list->len; i++)
 	{
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f954dbe432e..696f77e1ec4 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -640,7 +640,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
 		argtypes = plan->argtypes;
 	}
 	ptlist = planTree_list = (List *)
-		pg_plan(src, argtypes, nargs, &queryTree_list, None);
+		pg_parse_and_plan(src, argtypes, nargs, &queryTree_list, None);
 
 	_SPI_current->qtlist = queryTree_list;
 
diff --git a/src/backend/optimizer/path/xfunc.c b/src/backend/optimizer/path/xfunc.c
index 0f6894eec48..c0213df36ac 100644
--- a/src/backend/optimizer/path/xfunc.c
+++ b/src/backend/optimizer/path/xfunc.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.7 1997/11/25 21:59:50 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.8 1997/12/11 17:36:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -534,7 +534,7 @@ xfunc_func_expense(LispValue node, LispValue args)
 			nargs = proc->pronargs;
 			if (nargs > 0)
 				argOidVect = proc->proargtypes;
-			planlist = (List) pg_plan(pq_src, argOidVect, nargs,
+			planlist = (List) pg_parse_and_plan(pq_src, argOidVect, nargs,
 									  &parseTree_list, None);
 			if (IsA(node, Func))
 				set_func_planlist((Func) node, planlist);
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index c6f471915c3..92562142556 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.8 1997/11/25 22:06:04 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.9 1997/12/11 17:36:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,7 +136,7 @@ InsertRule(char *rulname,
 			rulname, evtype, eventrel_oid, evslot_index, actionbuf,
 			qualbuf, is_instead);
 
-	pg_eval(rulebuf, (char **) NULL, (Oid *) NULL, 0);
+	pg_exec_query(rulebuf, (char **) NULL, (Oid *) NULL, 0);
 
 	return (LastOidProcessed);
 }
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index d0d134e331a..b48c7482b12 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.55 1997/11/25 22:06:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.56 1997/12/11 17:36:42 momjian Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -395,7 +395,7 @@ ReadCommand(char *inBuf, bool multiplexedBackend)
 }
 
 List	   *
-pg_plan(char *query_string,		/* string to execute */
+pg_parse_and_plan(char *query_string,		/* string to execute */
 		Oid *typev,				/* argument types */
 		int nargs,				/* number of arguments */
 		QueryTreeList **queryListP,		/* pointer to the parse trees */
@@ -537,7 +537,10 @@ pg_plan(char *query_string,		/* string to execute */
 
 			if (ShowPlannerStats)
 				ResetUsage();
+
+			/* call that optimizer */
 			plan = planner(querytree);
+
 			if (ShowPlannerStats)
 			{
 				fprintf(stderr, "! Planner Stats:\n");
@@ -580,7 +583,7 @@ pg_plan(char *query_string,		/* string to execute */
 }
 
 /* ----------------------------------------------------------------
- *		pg_eval()
+ *		pg_exec_query()
  *
  *		Takes a querystring, runs the parser/utilities or
  *		parser/planner/executor over it as necessary
@@ -597,13 +600,13 @@ pg_plan(char *query_string,		/* string to execute */
  */
 
 void
-pg_eval(char *query_string, char **argv, Oid *typev, int nargs)
+pg_exec_query(char *query_string, char **argv, Oid *typev, int nargs)
 {
-	pg_eval_dest(query_string, argv, typev, nargs, whereToSendOutput);
+	pg_exec_query_dest(query_string, argv, typev, nargs, whereToSendOutput);
 }
 
 void
-pg_eval_dest(char *query_string,/* string to execute */
+pg_exec_query_dest(char *query_string,/* string to execute */
 			 char **argv,		/* arguments */
 			 Oid *typev,		/* argument types */
 			 int nargs,			/* number of arguments */
@@ -617,9 +620,9 @@ pg_eval_dest(char *query_string,/* string to execute */
 	QueryTreeList *querytree_list;
 
 	/* plan the queries */
-	plan_list = pg_plan(query_string, typev, nargs, &querytree_list, dest);
+	plan_list = pg_parse_and_plan(query_string, typev, nargs, &querytree_list, dest);
 
-	/* pg_plan could have failed */
+	/* pg_parse_and_plan could have failed */
 	if (querytree_list == NULL)
 		return;
 
@@ -668,7 +671,7 @@ pg_eval_dest(char *query_string,/* string to execute */
 #ifdef INDEXSCAN_PATCH
 
 			/*
-			 * Print moved in pg_plan.	DZ - 27-8-1996
+			 * Print moved in pg_parse_and_plan.	DZ - 27-8-1996
 			 */
 #else
 			/* ----------------
@@ -1340,7 +1343,7 @@ PostgresMain(int argc, char *argv[])
 	if (IsUnderPostmaster == false)
 	{
 		puts("\nPOSTGRES backend interactive interface");
-		puts("$Revision: 1.55 $ $Date: 1997/11/25 22:06:14 $");
+		puts("$Revision: 1.56 $ $Date: 1997/12/11 17:36:42 $");
 	}
 
 	/* ----------------
@@ -1510,7 +1513,7 @@ PostgresMain(int argc, char *argv[])
 					}
 					StartTransactionCommand();
 
-					pg_eval(parser_input, (char **) NULL, (Oid *) NULL, 0);
+					pg_exec_query(parser_input, (char **) NULL, (Oid *) NULL, 0);
 
 					if (ShowStats)
 						ShowUsage();
@@ -1540,7 +1543,7 @@ PostgresMain(int argc, char *argv[])
 		 *	 (3) commit the current transaction
 		 *
 		 *	 Note: if we had an empty input buffer, then we didn't
-		 *	 call pg_eval, so we don't bother to commit this transaction.
+		 *	 call pg_exec_query, so we don't bother to commit this transaction.
 		 * ----------------
 		 */
 		if (!IsEmptyQuery)
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index eeb21b91bed..de754ff20d5 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tcopprot.h,v 1.8 1997/11/25 22:07:10 momjian Exp $
+ * $Id: tcopprot.h,v 1.9 1997/12/11 17:36:58 momjian Exp $
  *
  * OLD COMMENTS
  *	  This file was created so that other c files could get the two
@@ -23,11 +23,11 @@
 
 #ifndef BOOTSTRAP_INCLUDE
 extern List *
-pg_plan(char *query_string, Oid *typev, int nargs,
+pg_parse_and_plan(char *query_string, Oid *typev, int nargs,
 		QueryTreeList **queryListP, CommandDest dest);
-extern void pg_eval(char *query_string, char **argv, Oid *typev, int nargs);
+extern void pg_exec_query(char *query_string, char **argv, Oid *typev, int nargs);
 extern void
-pg_eval_dest(char *query_string, char **argv, Oid *typev,
+pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
 			 int nargs, CommandDest dest);
 
 #endif							/* BOOTSTRAP_HEADER */
-- 
GitLab