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
146250: sql: improve routine dependency tracking r=yuzefovich,michae2 a=DrewKimball
#### sql: track routine dependencies on columns in RETURNING clause
Previously, while building a routine, we did not explicitly add dependencies
to columns referenced in the RETURNING clause of mutations within the body
statements. This was not a problem for INSERT or UPSERT due to #145098, but
could cause a routine with UPDATE or DELETE statements to be broken after
a referenced column was dropped. This commit fixes the bug by tracking
column references in the RETURNING clause.
Fixes#146414
Release note (bug fix): Fixed a bug that allowed a column to be dropped
from a table even if it was referenced in the RETURNING clause of an UPDATE
or DELETE statement in a routine. In releases prior to v25.3, the fix will
be off by default, and can be enabled by setting the session variable
`use_improved_routine_dependency_tracking`.
#### opt: do not add unnecessary columns to routine deps
Previously, computed columns would be added to the depended-on columns
list for a routine that performs an INSERT. This is unnecessary, since
values for computed columns are automatically generated when the routine
is invoked depending on the table schema at the time of invocation.
Because of this behavior, a routine with an INSERT statement previously
prevented dropping computed columns from the target table, including the
implicit column used for hash-sharded indexes.
This commit skips computed columns when adding insert target columns to
the routine's dependency list. Note that there was already logic to do
this for columns with default values. This commit also adds a session
variable `use_improved_routine_dependency_tracking` to control the new
behavior, default off for backports. The follow-up will flip the variable
on for master.
Fixes#145098
Release note (sql change): Fixed a bug that caused a routine with an
INSERT statement to unnecessarily block dropping a hash-sharded index
or computed column on the target table. Note that the fix applies only
to newly-created routines. In releases prior to v25.3, the fix will
be off by default, and can be enabled by setting the session variable
`use_improved_routine_dependency_tracking`.
#### sql: add session setting for routine dependency improvements
This commit adds a session var `use_improved_routine_dependency_tracking`
which enables the improvements in the previous two commits (do not add
dependencies on unnecessary columns, and track dependencies in the
RETURNING clause). The var is off by default in this commit for backports.
Informs #145098
Informs #146414
Release note: None
#### opt: enable improved routine dependency tracking
This commit flips `use_improved_routine_dependency_tracking` to on by
default. This means that newly-created routines will not add unnecessary
implicit insert columns to the list of dependencies, and will correctly
track dependencies in the RETURNING clause of UPDATE and DELETE statements.
Informs #145098
Informs #146414
Release note: None
146430: sql: report unit for some session variables r=yuzefovich,drewkimball a=Guilherme1Rocha
Previously, we never populated the `unit` column of `pg_settings`
virtual table deviating from PostgreSQL. We now report the unit for
time-based and memory-based settings.
AFAIU the unit defines the default unit of the value which allows these
settings take in integer numbers with the unit providing the necessary
measurement dimension.
Fixes: #30717
Release note: None
Co-authored-by: Drew Kimball <[email protected]>
Co-authored-by: Guilherme1Rocha <[email protected]>
0 commit comments