Hi Henson,
I tested v1 on master and REL_17 for JSON_TABLE, and on master and
REL_15 (with the REL_16 files) for XMLTABLE. I checked views with
nested paths, ordinality, PASSING, LATERAL, quoted names and two
renamed RTEs, by reading back pg_get_viewdef() and by a pg_dump and
restore. I also checked a rule and a BEGIN ATOMIC function through
the dump and restore. On master 20 of the 25 views fail to restore or
come back with columns swapped; with v1 those 20 round-trip with the
same rows. make check passes on all three branches, and the
pg_upgrade test on master.
One gap in the tests: none has a column renamed by the deparser without
an alias list, the USING case you mention. This fails to restore on
master and works with v1:
create view v4 as
select j1.b, j3.a as a3
from json_table(jsonb '[{"a": 1, "b": 2}]', '$[*]'
columns (a int path '$.a', b int path '$.b')) j1
full join json_table(jsonb '[{"a": 1, "b": 5}]', '$[*]'
columns (a int path '$.a', b int path '$.b')) j2 using (a),
json_table(jsonb '[{"a": 9}]', '$[*]'
columns (a int path '$.a')) j3;
master: ... j3.a_1 AS a3 ... ) j3;
ERROR: column j3.a_1 does not exist
v1: ... ) j3(a_1);
It goes through changed_any rather than a user alias list, so it seems
worth a test.
On the exception: it came in with the XMLTABLE commit, fcec6caafa2,
whose message says nothing about aliases, and 94edb85d253 later added
the "too many column aliases" check for these functions, so alias lists
on them were treated as valid. That's as far as I got.
Otherwise it looks good to me, and I agree with back-patching to 15.
Regards,
Ishjaap Singh