Commit e0dc7d02 authored by Tom Lane's avatar Tom Lane

Rename several aliases for PLpgSQL_datum.dno to also be called dno.

Hopefully this will forestall future confusion about their roles.

Jonah Harris
parent e33e0c43
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.115 2008/09/10 01:09:45 tgl Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.116 2008/11/05 00:07:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -430,7 +430,7 @@ decl_statement : decl_varname decl_const decl_datatype decl_notnull decl_defval ...@@ -430,7 +430,7 @@ decl_statement : decl_varname decl_const decl_datatype decl_notnull decl_defval
if ($5 == NULL) if ($5 == NULL)
new->cursor_explicit_argrow = -1; new->cursor_explicit_argrow = -1;
else else
new->cursor_explicit_argrow = $5->rowno; new->cursor_explicit_argrow = $5->dno;
new->cursor_options = CURSOR_OPT_FAST_PLAN | $2; new->cursor_options = CURSOR_OPT_FAST_PLAN | $2;
} }
; ;
...@@ -764,12 +764,12 @@ assign_var : T_SCALAR ...@@ -764,12 +764,12 @@ assign_var : T_SCALAR
| T_ROW | T_ROW
{ {
check_assignable((PLpgSQL_datum *) yylval.row); check_assignable((PLpgSQL_datum *) yylval.row);
$$ = yylval.row->rowno; $$ = yylval.row->dno;
} }
| T_RECORD | T_RECORD
{ {
check_assignable((PLpgSQL_datum *) yylval.rec); check_assignable((PLpgSQL_datum *) yylval.rec);
$$ = yylval.rec->recno; $$ = yylval.rec->dno;
} }
| assign_var '[' expr_until_rightbracket | assign_var '[' expr_until_rightbracket
{ {
...@@ -1036,7 +1036,7 @@ for_control : ...@@ -1036,7 +1036,7 @@ for_control :
new->cmd_type = PLPGSQL_STMT_FORC; new->cmd_type = PLPGSQL_STMT_FORC;
new->lineno = $1; new->lineno = $1;
new->curvar = cursor->varno; new->curvar = cursor->dno;
/* Should have had a single variable name */ /* Should have had a single variable name */
plpgsql_error_lineno = $2.lineno; plpgsql_error_lineno = $2.lineno;
...@@ -1557,7 +1557,7 @@ stmt_open : K_OPEN lno cursor_variable ...@@ -1557,7 +1557,7 @@ stmt_open : K_OPEN lno cursor_variable
new = palloc0(sizeof(PLpgSQL_stmt_open)); new = palloc0(sizeof(PLpgSQL_stmt_open));
new->cmd_type = PLPGSQL_STMT_OPEN; new->cmd_type = PLPGSQL_STMT_OPEN;
new->lineno = $2; new->lineno = $2;
new->curvar = $3->varno; new->curvar = $3->dno;
new->cursor_options = CURSOR_OPT_FAST_PLAN; new->cursor_options = CURSOR_OPT_FAST_PLAN;
if ($3->cursor_explicit_expr == NULL) if ($3->cursor_explicit_expr == NULL)
...@@ -1621,7 +1621,7 @@ stmt_fetch : K_FETCH lno opt_fetch_direction cursor_variable K_INTO ...@@ -1621,7 +1621,7 @@ stmt_fetch : K_FETCH lno opt_fetch_direction cursor_variable K_INTO
fetch->lineno = $2; fetch->lineno = $2;
fetch->rec = rec; fetch->rec = rec;
fetch->row = row; fetch->row = row;
fetch->curvar = $4->varno; fetch->curvar = $4->dno;
fetch->is_move = false; fetch->is_move = false;
$$ = (PLpgSQL_stmt *)fetch; $$ = (PLpgSQL_stmt *)fetch;
...@@ -1633,7 +1633,7 @@ stmt_move : K_MOVE lno opt_fetch_direction cursor_variable ';' ...@@ -1633,7 +1633,7 @@ stmt_move : K_MOVE lno opt_fetch_direction cursor_variable ';'
PLpgSQL_stmt_fetch *fetch = $3; PLpgSQL_stmt_fetch *fetch = $3;
fetch->lineno = $2; fetch->lineno = $2;
fetch->curvar = $4->varno; fetch->curvar = $4->dno;
fetch->is_move = true; fetch->is_move = true;
$$ = (PLpgSQL_stmt *)fetch; $$ = (PLpgSQL_stmt *)fetch;
...@@ -1653,7 +1653,7 @@ stmt_close : K_CLOSE lno cursor_variable ';' ...@@ -1653,7 +1653,7 @@ stmt_close : K_CLOSE lno cursor_variable ';'
new = palloc(sizeof(PLpgSQL_stmt_close)); new = palloc(sizeof(PLpgSQL_stmt_close));
new->cmd_type = PLPGSQL_STMT_CLOSE; new->cmd_type = PLPGSQL_STMT_CLOSE;
new->lineno = $2; new->lineno = $2;
new->curvar = $3->varno; new->curvar = $3->dno;
$$ = (PLpgSQL_stmt *)new; $$ = (PLpgSQL_stmt *)new;
} }
...@@ -2039,14 +2039,14 @@ read_sql_construct(int until, ...@@ -2039,14 +2039,14 @@ read_sql_construct(int until,
case T_ROW: case T_ROW:
snprintf(buf, sizeof(buf), " $%d ", snprintf(buf, sizeof(buf), " $%d ",
assign_expr_param(yylval.row->rowno, assign_expr_param(yylval.row->dno,
params, &nparams)); params, &nparams));
plpgsql_dstring_append(&ds, buf); plpgsql_dstring_append(&ds, buf);
break; break;
case T_RECORD: case T_RECORD:
snprintf(buf, sizeof(buf), " $%d ", snprintf(buf, sizeof(buf), " $%d ",
assign_expr_param(yylval.rec->recno, assign_expr_param(yylval.rec->dno,
params, &nparams)); params, &nparams));
plpgsql_dstring_append(&ds, buf); plpgsql_dstring_append(&ds, buf);
break; break;
...@@ -2190,14 +2190,14 @@ make_execsql_stmt(const char *sqlstart, int lineno) ...@@ -2190,14 +2190,14 @@ make_execsql_stmt(const char *sqlstart, int lineno)
case T_ROW: case T_ROW:
snprintf(buf, sizeof(buf), " $%d ", snprintf(buf, sizeof(buf), " $%d ",
assign_expr_param(yylval.row->rowno, assign_expr_param(yylval.row->dno,
params, &nparams)); params, &nparams));
plpgsql_dstring_append(&ds, buf); plpgsql_dstring_append(&ds, buf);
break; break;
case T_RECORD: case T_RECORD:
snprintf(buf, sizeof(buf), " $%d ", snprintf(buf, sizeof(buf), " $%d ",
assign_expr_param(yylval.rec->recno, assign_expr_param(yylval.rec->dno,
params, &nparams)); params, &nparams));
plpgsql_dstring_append(&ds, buf); plpgsql_dstring_append(&ds, buf);
break; break;
...@@ -2363,11 +2363,11 @@ make_return_stmt(int lineno) ...@@ -2363,11 +2363,11 @@ make_return_stmt(int lineno)
break; break;
case T_ROW: case T_ROW:
new->retvarno = yylval.row->rowno; new->retvarno = yylval.row->dno;
break; break;
case T_RECORD: case T_RECORD:
new->retvarno = yylval.rec->recno; new->retvarno = yylval.rec->dno;
break; break;
default: default:
...@@ -2416,11 +2416,11 @@ make_return_next_stmt(int lineno) ...@@ -2416,11 +2416,11 @@ make_return_next_stmt(int lineno)
switch (yylex()) switch (yylex())
{ {
case T_ROW: case T_ROW:
new->retvarno = yylval.row->rowno; new->retvarno = yylval.row->dno;
break; break;
case T_RECORD: case T_RECORD:
new->retvarno = yylval.rec->recno; new->retvarno = yylval.rec->dno;
break; break;
default: default:
...@@ -2953,7 +2953,7 @@ make_case(int lineno, PLpgSQL_expr *t_expr, ...@@ -2953,7 +2953,7 @@ make_case(int lineno, PLpgSQL_expr *t_expr,
plpgsql_build_variable("*case*", lineno, plpgsql_build_variable("*case*", lineno,
plpgsql_build_datatype(INT4OID, -1), plpgsql_build_datatype(INT4OID, -1),
false); false);
t_varno = t_var->varno; t_varno = t_var->dno;
new->t_varno = t_varno; new->t_varno = t_varno;
foreach(l, case_when_list) foreach(l, case_when_list)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.131 2008/10/09 16:35:07 tgl Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.132 2008/11/05 00:07:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -468,7 +468,7 @@ do_compile(FunctionCallInfo fcinfo, ...@@ -468,7 +468,7 @@ do_compile(FunctionCallInfo fcinfo,
num_out_args); num_out_args);
plpgsql_adddatum((PLpgSQL_datum *) row); plpgsql_adddatum((PLpgSQL_datum *) row);
function->out_param_varno = row->rowno; function->out_param_varno = row->dno;
} }
/* /*
...@@ -580,11 +580,11 @@ do_compile(FunctionCallInfo fcinfo, ...@@ -580,11 +580,11 @@ do_compile(FunctionCallInfo fcinfo,
/* Add the record for referencing NEW */ /* Add the record for referencing NEW */
rec = plpgsql_build_record("new", 0, true); rec = plpgsql_build_record("new", 0, true);
function->new_varno = rec->recno; function->new_varno = rec->dno;
/* Add the record for referencing OLD */ /* Add the record for referencing OLD */
rec = plpgsql_build_record("old", 0, true); rec = plpgsql_build_record("old", 0, true);
function->old_varno = rec->recno; function->old_varno = rec->dno;
/* Add the variable tg_name */ /* Add the variable tg_name */
var = plpgsql_build_variable("tg_name", 0, var = plpgsql_build_variable("tg_name", 0,
...@@ -1445,7 +1445,7 @@ plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype, ...@@ -1445,7 +1445,7 @@ plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype,
plpgsql_adddatum((PLpgSQL_datum *) var); plpgsql_adddatum((PLpgSQL_datum *) var);
if (add2namespace) if (add2namespace)
plpgsql_ns_additem(PLPGSQL_NSTYPE_VAR, plpgsql_ns_additem(PLPGSQL_NSTYPE_VAR,
var->varno, var->dno,
refname); refname);
result = (PLpgSQL_variable *) var; result = (PLpgSQL_variable *) var;
break; break;
...@@ -1464,7 +1464,7 @@ plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype, ...@@ -1464,7 +1464,7 @@ plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype,
plpgsql_adddatum((PLpgSQL_datum *) row); plpgsql_adddatum((PLpgSQL_datum *) row);
if (add2namespace) if (add2namespace)
plpgsql_ns_additem(PLPGSQL_NSTYPE_ROW, plpgsql_ns_additem(PLPGSQL_NSTYPE_ROW,
row->rowno, row->dno,
refname); refname);
result = (PLpgSQL_variable *) row; result = (PLpgSQL_variable *) row;
break; break;
...@@ -1511,7 +1511,7 @@ plpgsql_build_record(const char *refname, int lineno, bool add2namespace) ...@@ -1511,7 +1511,7 @@ plpgsql_build_record(const char *refname, int lineno, bool add2namespace)
rec->freetup = false; rec->freetup = false;
plpgsql_adddatum((PLpgSQL_datum *) rec); plpgsql_adddatum((PLpgSQL_datum *) rec);
if (add2namespace) if (add2namespace)
plpgsql_ns_additem(PLPGSQL_NSTYPE_REC, rec->recno, rec->refname); plpgsql_ns_additem(PLPGSQL_NSTYPE_REC, rec->dno, rec->refname);
return rec; return rec;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.223 2008/11/02 01:45:28 tgl Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.224 2008/11/05 00:07:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1665,7 +1665,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt) ...@@ -1665,7 +1665,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
bool found = false; bool found = false;
int rc = PLPGSQL_RC_OK; int rc = PLPGSQL_RC_OK;
var = (PLpgSQL_var *) (estate->datums[stmt->var->varno]); var = (PLpgSQL_var *) (estate->datums[stmt->var->dno]);
/* /*
* Get the value of the lower bound * Get the value of the lower bound
...@@ -2831,9 +2831,9 @@ exec_stmt_execsql(PLpgSQL_execstate *estate, ...@@ -2831,9 +2831,9 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
/* Determine if we assign to a record or a row */ /* Determine if we assign to a record or a row */
if (stmt->rec != NULL) if (stmt->rec != NULL)
rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->recno]); rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->dno]);
else if (stmt->row != NULL) else if (stmt->row != NULL)
row = (PLpgSQL_row *) (estate->datums[stmt->row->rowno]); row = (PLpgSQL_row *) (estate->datums[stmt->row->dno]);
else else
elog(ERROR, "unsupported target"); elog(ERROR, "unsupported target");
...@@ -3009,9 +3009,9 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, ...@@ -3009,9 +3009,9 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
/* Determine if we assign to a record or a row */ /* Determine if we assign to a record or a row */
if (stmt->rec != NULL) if (stmt->rec != NULL)
rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->recno]); rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->dno]);
else if (stmt->row != NULL) else if (stmt->row != NULL)
row = (PLpgSQL_row *) (estate->datums[stmt->row->rowno]); row = (PLpgSQL_row *) (estate->datums[stmt->row->dno]);
else else
elog(ERROR, "unsupported target"); elog(ERROR, "unsupported target");
...@@ -3320,9 +3320,9 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt) ...@@ -3320,9 +3320,9 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
* ---------- * ----------
*/ */
if (stmt->rec != NULL) if (stmt->rec != NULL)
rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->recno]); rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->dno]);
else if (stmt->row != NULL) else if (stmt->row != NULL)
row = (PLpgSQL_row *) (estate->datums[stmt->row->rowno]); row = (PLpgSQL_row *) (estate->datums[stmt->row->dno]);
else else
elog(ERROR, "unsupported target"); elog(ERROR, "unsupported target");
...@@ -4174,9 +4174,9 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, ...@@ -4174,9 +4174,9 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
* Determine if we assign to a record or a row * Determine if we assign to a record or a row
*/ */
if (stmt->rec != NULL) if (stmt->rec != NULL)
rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->recno]); rec = (PLpgSQL_rec *) (estate->datums[stmt->rec->dno]);
else if (stmt->row != NULL) else if (stmt->row != NULL)
row = (PLpgSQL_row *) (estate->datums[stmt->row->rowno]); row = (PLpgSQL_row *) (estate->datums[stmt->row->dno]);
else else
elog(ERROR, "unsupported target"); elog(ERROR, "unsupported target");
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.73 2008/08/29 13:02:33 petere Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.74 2008/11/05 00:07:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -893,12 +893,12 @@ dump_fetch(PLpgSQL_stmt_fetch *stmt) ...@@ -893,12 +893,12 @@ dump_fetch(PLpgSQL_stmt_fetch *stmt)
if (stmt->rec != NULL) if (stmt->rec != NULL)
{ {
dump_ind(); dump_ind();
printf(" target = %d %s\n", stmt->rec->recno, stmt->rec->refname); printf(" target = %d %s\n", stmt->rec->dno, stmt->rec->refname);
} }
if (stmt->row != NULL) if (stmt->row != NULL)
{ {
dump_ind(); dump_ind();
printf(" target = %d %s\n", stmt->row->rowno, stmt->row->refname); printf(" target = %d %s\n", stmt->row->dno, stmt->row->refname);
} }
dump_indent -= 2; dump_indent -= 2;
} }
...@@ -1107,14 +1107,14 @@ dump_execsql(PLpgSQL_stmt_execsql *stmt) ...@@ -1107,14 +1107,14 @@ dump_execsql(PLpgSQL_stmt_execsql *stmt)
dump_ind(); dump_ind();
printf(" INTO%s target = %d %s\n", printf(" INTO%s target = %d %s\n",
stmt->strict ? " STRICT" : "", stmt->strict ? " STRICT" : "",
stmt->rec->recno, stmt->rec->refname); stmt->rec->dno, stmt->rec->refname);
} }
if (stmt->row != NULL) if (stmt->row != NULL)
{ {
dump_ind(); dump_ind();
printf(" INTO%s target = %d %s\n", printf(" INTO%s target = %d %s\n",
stmt->strict ? " STRICT" : "", stmt->strict ? " STRICT" : "",
stmt->row->rowno, stmt->row->refname); stmt->row->dno, stmt->row->refname);
} }
dump_indent -= 2; dump_indent -= 2;
} }
...@@ -1133,14 +1133,14 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt) ...@@ -1133,14 +1133,14 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
dump_ind(); dump_ind();
printf(" INTO%s target = %d %s\n", printf(" INTO%s target = %d %s\n",
stmt->strict ? " STRICT" : "", stmt->strict ? " STRICT" : "",
stmt->rec->recno, stmt->rec->refname); stmt->rec->dno, stmt->rec->refname);
} }
if (stmt->row != NULL) if (stmt->row != NULL)
{ {
dump_ind(); dump_ind();
printf(" INTO%s target = %d %s\n", printf(" INTO%s target = %d %s\n",
stmt->strict ? " STRICT" : "", stmt->strict ? " STRICT" : "",
stmt->row->rowno, stmt->row->refname); stmt->row->dno, stmt->row->refname);
} }
if (stmt->params != NIL) if (stmt->params != NIL)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.104 2008/11/04 21:00:15 alvherre Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.105 2008/11/05 00:07:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -191,7 +191,7 @@ typedef struct ...@@ -191,7 +191,7 @@ typedef struct
typedef struct PLpgSQL_expr typedef struct PLpgSQL_expr
{ /* SQL Query to plan and execute */ { /* SQL Query to plan and execute */
int dtype; int dtype;
int exprno; int dno;
char *query; char *query;
SPIPlanPtr plan; SPIPlanPtr plan;
Oid *plan_argtypes; Oid *plan_argtypes;
...@@ -217,7 +217,7 @@ typedef struct PLpgSQL_expr ...@@ -217,7 +217,7 @@ typedef struct PLpgSQL_expr
typedef struct typedef struct
{ /* Scalar variable */ { /* Scalar variable */
int dtype; int dtype;
int varno; int dno;
char *refname; char *refname;
int lineno; int lineno;
...@@ -238,7 +238,7 @@ typedef struct ...@@ -238,7 +238,7 @@ typedef struct
typedef struct typedef struct
{ /* Row variable */ { /* Row variable */
int dtype; int dtype;
int rowno; int dno;
char *refname; char *refname;
int lineno; int lineno;
...@@ -260,7 +260,7 @@ typedef struct ...@@ -260,7 +260,7 @@ typedef struct
typedef struct typedef struct
{ /* Record variable (non-fixed structure) */ { /* Record variable (non-fixed structure) */
int dtype; int dtype;
int recno; int dno;
char *refname; char *refname;
int lineno; int lineno;
...@@ -274,7 +274,7 @@ typedef struct ...@@ -274,7 +274,7 @@ typedef struct
typedef struct typedef struct
{ /* Field in record */ { /* Field in record */
int dtype; int dtype;
int rfno; int dno;
char *fieldname; char *fieldname;
int recparentno; /* dno of parent record */ int recparentno; /* dno of parent record */
} PLpgSQL_recfield; } PLpgSQL_recfield;
......
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