postgresql/src/backend/commands
Tom Lane a35c5b7c1f Fix handling of inherited check constraints in ALTER COLUMN TYPE (again).
The previous way of reconstructing check constraints was to do a separate
"ALTER TABLE ONLY tab ADD CONSTRAINT" for each table in an inheritance
hierarchy.  However, that way has no hope of reconstructing the check
constraints' own inheritance properties correctly, as pointed out in
bug #13779 from Jan Dirk Zijlstra.  What we should do instead is to do
a regular "ALTER TABLE", allowing recursion, at the topmost table that
has a particular constraint, and then suppress the work queue entries
for inherited instances of the constraint.

Annoyingly, we'd tried to fix this behavior before, in commit 5ed6546cf,
but we failed to notice that it wasn't reconstructing the pg_constraint
field values correctly.

As long as I'm touching pg_get_constraintdef_worker anyway, tweak it to
always schema-qualify the target table name; this seems like useful backup
to the protections installed by commit 5f173040.

In HEAD/9.5, get rid of get_constraint_relation_oids, which is now unused.
(I could alternatively have modified it to also return conislocal, but that
seemed like a pretty single-purpose API, so let's not pretend it has some
other use.)  It's unused in the back branches as well, but I left it in
place just in case some third-party code has decided to use it.

In HEAD/9.5, also rename pg_get_constraintdef_string to
pg_get_constraintdef_command, as the previous name did nothing to explain
what that entry point did differently from others (and its comment was
equally useless).  Again, that change doesn't seem like material for
back-patching.

I did a bit of re-pgindenting in tablecmds.c in HEAD/9.5, as well.

Otherwise, back-patch to all supported branches.
2015-11-20 14:55:28 -05:00
..
aggregatecmds.c Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
alter.c Remove variable shadowing 2015-04-07 17:14:00 -03:00
analyze.c Make ANALYZE compute basic statistics even for types with no "=" operator. 2015-09-23 18:26:58 -04:00
async.c Improve LISTEN startup time when there are many unread notifications. 2015-09-30 23:32:23 -04:00
cluster.c Support VERBOSE option in REINDEX command. 2015-05-15 20:09:57 +09:00
collationcmds.c Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
comment.c Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
constraint.c Fix incorrect checking of deferred exclusion constraint after a HOT update. 2015-05-11 12:25:43 -04:00
conversioncmds.c Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
copy.c Message style fix 2015-11-17 06:53:38 -05:00
createas.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
dbcommands.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
define.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
discard.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
dropcmds.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
event_trigger.c Fix omission of OCLASS_TRANSFORM in object_classes[] 2015-07-21 13:20:53 +02:00
explain.c Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
extension.c Message improvements 2015-11-16 21:16:42 -05:00
foreigncmds.c Avoid passing NULL to memcmp() in lookups of zero-argument functions. 2015-06-27 17:47:39 -04:00
functioncmds.c Fix DDL command collection for TRANSFORM 2015-06-26 18:17:54 -03:00
indexcmds.c Don't warn about creating temporary or unlogged hash indexes. 2015-06-26 11:37:32 -04:00
lockcmds.c Allow LOCK TABLE .. ROW EXCLUSIVE MODE with INSERT 2015-05-11 15:44:12 -04:00
Makefile Row-Level Security Policies (RLS) 2014-09-19 11:18:35 -04:00
matview.c Message style improvements 2015-10-28 20:23:53 -04:00
opclasscmds.c Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
operatorcmds.c Allow named parameters to be specified using => in addition to := 2015-03-10 11:09:41 -04:00
policy.c RLS refactoring 2015-09-15 15:49:40 -04:00
portalcmds.c Fix subtransaction cleanup after an outer-subtransaction portal fails. 2015-09-04 13:37:16 -04:00
prepare.c Use FLEXIBLE_ARRAY_MEMBER in a bunch more places. 2015-02-20 00:11:42 -05:00
proclang.c Add transforms feature 2015-04-26 10:33:14 -04:00
schemacmds.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
seclabel.c Revert "Change pg_seclabel.provider and pg_shseclabel.provider to type "name"." 2015-05-19 10:40:04 -04:00
sequence.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
tablecmds.c Fix handling of inherited check constraints in ALTER COLUMN TYPE (again). 2015-11-20 14:55:28 -05:00
tablespace.c Message improvements 2015-11-16 21:16:42 -05:00
trigger.c Fix typo in C comment. 2015-08-23 10:41:08 -05:00
tsearchcmds.c Allow on-the-fly capture of DDL event details 2015-05-11 19:14:31 -03:00
typecmds.c pgindent run for 9.5 2015-05-23 21:35:49 -04:00
user.c In AlterRole, make bypassrls an int 2015-08-21 08:22:29 -04:00
vacuum.c Cleanup commit timestamp module activaction, again 2015-10-27 15:06:50 -03:00
vacuumlazy.c Message style improvements 2015-10-28 20:23:53 -04:00
variable.c Fix a problem with parallel workers being unable to restore role. 2015-10-16 11:40:03 -04:00
view.c Require non-NULL pstate for all addRangeTableEntryFor* functions. 2015-03-11 15:26:43 -04:00