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
sql: make TG_ARGV use 0-based indexing for PostgreSQL compatibility
Previously, TG_ARGV used 1-based indexing (standard SQL array behavior),
which was incompatible with PostgreSQL's 0-based indexing for TG_ARGV.
A session setting `allow_create_trigger_function_with_argv_references`
was required to use TG_ARGV at all, since it was blocked by default due
to this incompatibility.
This change makes TG_ARGV use 0-based indexing to match PostgreSQL
behavior. To implement this, we add a `zeroIndexed` field to the DArray
struct that controls the FirstIndex() return value. When constructing
TG_ARGV for trigger functions, we now call SetZeroIndexed() to mark the
array as 0-indexed.
The `allow_create_trigger_function_with_argv_references` session setting
is no longer needed and has been converted to a backwards-compatibility
no-op variable.
Fixes: #135311
Release note (backward-incompatible change): The TG_ARGV trigger
function parameter now uses 0-based indexing to match PostgreSQL
behavior. Previously, TG_ARGV[1] returned the first argument; now
TG_ARGV[0] returns the first argument and TG_ARGV[1] returns the second
argument. Additionally, usage of TG_ARGV no longer requires setting the
`allow_create_trigger_function_with_argv_references` session variable.
0 commit comments