Commit 3f61b320 authored by Tom Lane's avatar Tom Lane

Fix C++ incompatibilities in plpgsql's header files.

Rename some exposed parameters so that they don't conflict with
C++ reserved words.

Back-patch to all supported versions.

George Tarasov

Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru
parent 7640f931
...@@ -2212,7 +2212,7 @@ plpgsql_start_datums(void) ...@@ -2212,7 +2212,7 @@ plpgsql_start_datums(void)
* ---------- * ----------
*/ */
void void
plpgsql_adddatum(PLpgSQL_datum *new) plpgsql_adddatum(PLpgSQL_datum *newdatum)
{ {
if (plpgsql_nDatums == datums_alloc) if (plpgsql_nDatums == datums_alloc)
{ {
...@@ -2220,8 +2220,8 @@ plpgsql_adddatum(PLpgSQL_datum *new) ...@@ -2220,8 +2220,8 @@ plpgsql_adddatum(PLpgSQL_datum *new)
plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc); plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
} }
new->dno = plpgsql_nDatums; newdatum->dno = plpgsql_nDatums;
plpgsql_Datums[plpgsql_nDatums++] = new; plpgsql_Datums[plpgsql_nDatums++] = newdatum;
} }
/* ---------- /* ----------
......
...@@ -5583,7 +5583,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, ...@@ -5583,7 +5583,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
void void
plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum, PLpgSQL_datum *datum,
Oid *typeid, int32 *typmod, Oid *collation) Oid *typeId, int32 *typMod, Oid *collation)
{ {
switch (datum->dtype) switch (datum->dtype)
{ {
...@@ -5592,8 +5592,8 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, ...@@ -5592,8 +5592,8 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
{ {
PLpgSQL_var *var = (PLpgSQL_var *) datum; PLpgSQL_var *var = (PLpgSQL_var *) datum;
*typeid = var->datatype->typoid; *typeId = var->datatype->typoid;
*typmod = var->datatype->atttypmod; *typMod = var->datatype->atttypmod;
*collation = var->datatype->collation; *collation = var->datatype->collation;
break; break;
} }
...@@ -5605,15 +5605,15 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, ...@@ -5605,15 +5605,15 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
if (rec->erh == NULL || rec->rectypeid != RECORDOID) if (rec->erh == NULL || rec->rectypeid != RECORDOID)
{ {
/* Report variable's declared type */ /* Report variable's declared type */
*typeid = rec->rectypeid; *typeId = rec->rectypeid;
*typmod = -1; *typMod = -1;
} }
else else
{ {
/* Report record's actual type if declared RECORD */ /* Report record's actual type if declared RECORD */
*typeid = rec->erh->er_typeid; *typeId = rec->erh->er_typeid;
/* do NOT return the mutable typmod of a RECORD variable */ /* do NOT return the mutable typmod of a RECORD variable */
*typmod = -1; *typMod = -1;
} }
/* composite types are never collatable */ /* composite types are never collatable */
*collation = InvalidOid; *collation = InvalidOid;
...@@ -5651,16 +5651,16 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, ...@@ -5651,16 +5651,16 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
recfield->rectupledescid = rec->erh->er_tupdesc_id; recfield->rectupledescid = rec->erh->er_tupdesc_id;
} }
*typeid = recfield->finfo.ftypeid; *typeId = recfield->finfo.ftypeid;
*typmod = recfield->finfo.ftypmod; *typMod = recfield->finfo.ftypmod;
*collation = recfield->finfo.fcollation; *collation = recfield->finfo.fcollation;
break; break;
} }
default: default:
elog(ERROR, "unrecognized dtype: %d", datum->dtype); elog(ERROR, "unrecognized dtype: %d", datum->dtype);
*typeid = InvalidOid; /* keep compiler quiet */ *typeId = InvalidOid; /* keep compiler quiet */
*typmod = -1; *typMod = -1;
*collation = InvalidOid; *collation = InvalidOid;
break; break;
} }
......
...@@ -1239,7 +1239,7 @@ extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec, ...@@ -1239,7 +1239,7 @@ extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec,
extern int plpgsql_recognize_err_condition(const char *condname, extern int plpgsql_recognize_err_condition(const char *condname,
bool allow_sqlstate); bool allow_sqlstate);
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
extern void plpgsql_adddatum(PLpgSQL_datum *new); extern void plpgsql_adddatum(PLpgSQL_datum *newdatum);
extern int plpgsql_add_initdatums(int **varnos); extern int plpgsql_add_initdatums(int **varnos);
extern void plpgsql_HashTableInit(void); extern void plpgsql_HashTableInit(void);
...@@ -1266,7 +1266,8 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, ...@@ -1266,7 +1266,8 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum); PLpgSQL_datum *datum);
extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum, PLpgSQL_datum *datum,
Oid *typeid, int32 *typmod, Oid *collation); Oid *typeId, int32 *typMod,
Oid *collation);
/* /*
* Functions for namespace handling in pl_funcs.c * Functions for namespace handling in pl_funcs.c
......
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