Add ATAlterConstraint struct for ALTER .. CONSTRAINT
authorÁlvaro Herrera
Wed, 19 Feb 2025 12:06:13 +0000 (13:06 +0100)
committerÁlvaro Herrera
Wed, 19 Feb 2025 12:06:13 +0000 (13:06 +0100)
commit80d7f990496b1c7be61d9a00a2635b7d96b96197
treeace700922e3f2e172d45cbb240740948cc4eb800
parente983ee9380fcac746f9b6b7c360d255d9fcd0907
Add ATAlterConstraint struct for ALTER .. CONSTRAINT

Replace the use of Constraint with a new ATAlterConstraint struct, which
allows us to pass additional information.  No functionality is added by
this commit.  This is necessary for future work that allows altering
constraints in other ways.

I (Álvaro) took the liberty of restructuring the code for ALTER
CONSTRAINT beyond what Amul did.  The original coding before Amul's
patch was unnecessarily baroque, and this change makes things simpler
by removing one level of subroutine.  Also, partly remove the assumption
that only partitioned tables are relevant (by passing sensible 'recurse'
arguments) and no longer ignore whether ONLY was specified.  I say
'partly' because the current coding only walks down via the 'conparentid'
relationship, which is only used for partitioned tables; but future
patches could handle ONLY or not for other types of constraint changes
for legacy inheritance trees too.

Author: Amul Sul 
Author: Álvaro Herrera 
Discussion: https://postgr.es/m/CAAJ_b94bfgPV-8Mw_HwSBeheVwaK9=5s+7+KbBj_NpwXQFgDGg@mail.gmail.com
src/backend/commands/tablecmds.c
src/backend/parser/gram.y
src/include/nodes/parsenodes.h
src/tools/pgindent/typedefs.list