summaryrefslogtreecommitdiff
path: root/src/include/nodes/primnodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-04-22 01:26:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-04-22 01:26:01 +0000
commit2206b498d8240447a9353ce4e994ba41a8e307ac (patch)
treeeb60585d0dae556ae45aae35a7d50f83be715ab4 /src/include/nodes/primnodes.h
parent0606860a20511c41d5c9074831e6328547722537 (diff)
downloadpostgresql-2206b498d8240447a9353ce4e994ba41a8e307ac.tar.gz
Simplify ParamListInfo data structure to support only numbered parameters,
not named ones, and replace linear searches of the list with array indexing. The named-parameter support has been dead code for many years anyway, and recent profiling suggests that the searching was costing a noticeable amount of performance for complex queries.
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r--src/include/nodes/primnodes.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 65d5d8ff0c..9c1f580fc9 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.112 2006/03/05 15:58:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.113 2006/04/22 01:26:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -146,18 +146,15 @@ typedef struct Const
/* ----------------
* Param
* paramkind - specifies the kind of parameter. The possible values
- * for this field are specified in "params.h", and they are:
+ * for this field are:
*
- * PARAM_NAMED: The parameter has a name, i.e. something
- * like `$.salary' or `$.foobar'.
- * In this case field `paramname' must be a valid name.
+ * PARAM_EXTERN: The parameter value is supplied from outside the plan.
+ * Such parameters are numbered from 1 to n.
*
- * PARAM_NUM: The parameter has only a numeric identifier,
- * i.e. something like `$1', `$2' etc.
- * The number is contained in the `paramid' field.
- *
- * PARAM_EXEC: The parameter is an internal executor parameter.
- * It has a number contained in the `paramid' field.
+ * PARAM_EXEC: The parameter is an internal executor parameter, used
+ * for passing values into and out of sub-queries.
+ * For historical reasons, such parameters are numbered from 0.
+ * These numbers are independent of PARAM_EXTERN numbers.
*
* PARAM_SUBLINK: The parameter represents an output column of a SubLink
* node's sub-select. The column number is contained in the
@@ -165,12 +162,18 @@ typedef struct Const
* PARAM_EXEC during planning.)
* ----------------
*/
+typedef enum ParamKind
+{
+ PARAM_EXTERN,
+ PARAM_EXEC,
+ PARAM_SUBLINK
+} ParamKind;
+
typedef struct Param
{
Expr xpr;
- int paramkind; /* kind of parameter. See above */
- AttrNumber paramid; /* numeric ID for parameter ("$1") */
- char *paramname; /* name for parameter ("$.foo") */
+ ParamKind paramkind; /* kind of parameter. See above */
+ int paramid; /* numeric ID for parameter */
Oid paramtype; /* PG_TYPE OID of parameter's datatype */
} Param;