You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, variable assignment in PL/pgSQL routines did not update
the `paramOrd` field. As a result, referencing a variable via the
`$1` ordinal syntax did not always reflect updates to the variable.
In addition, it was possible to reference variables declared in blocks
within the routine body, rather than just the original routine parameters.
This commit fixes both issues by always setting `paramOrd` and setting
a `maxParamOrd` while building SQL expressions and statements, which
prevents the user from referencing block variables via ordinal syntax.
We use a `maxParamOrd` instead of simply not setting `paramOrd` for
block variables to allow the builder to internally reference any
variable with ordinal syntax.
Fixes#143887
Release note (bug fix): Fixed a bug existing since v24.1 that prevented
variable references using ordinal syntax (like `$1`) from reflecting
updates to the variable. Referencing variables declared in PL/pgSQL
blocks (instead of parameters) via ordinal syntax is now disallowed.
0 commit comments