Hi, submitting a patch for bug #19516 (held in moderation queue atm).
Looks like the root cause is that the shortcut taken in ParseComplexProjection
loses the `varreturningtype` flag, causing it to default to `VAR_RETURNING_DEFAULT`.
Consequently, the default RETURNING behavior is applied, which is strictly wrong
when a user typed (old).col on INSERT/UPDATE or (new).col on DELETE.
To fix this simply skip the shortcut when varreturningtype is set to VAR_RETURNING_OLD/VAR_RETURNING_NEW.
Also added tests that exercise this.
Thanks,
Marko