diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-01-13 17:49:26 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-01-13 17:49:26 -0500 |
commit | 4aee39ddb8fa748a6beea2bc1b48882990c226a7 (patch) | |
tree | d03d454fa1f5ae70557d5bd865c74b6d0b1cfddd /src/test | |
parent | 3c1ffd02dd058666ddf27d7e621ab5bbc4b769bb (diff) |
Fix ruleutils.c's dumping of whole-row Vars in more contexts.
Commit 7745bc352 intended to ensure that whole-row Vars would be
printed with "::type" decoration in all contexts where plain
"var.*" notation would result in star-expansion, notably in
ROW() and VALUES() constructs. However, it missed the case of
INSERT with a single-row VALUES, as reported by Timur Khanjanov.
Nosing around ruleutils.c, I found a second oversight: the
code for RowCompareExpr generates ROW() notation without benefit
of an actual RowExpr, and naturally it wasn't in sync :-(.
(The code for FieldStore also does this, but we don't expect that
to generate strictly parsable SQL anyway, so I left it alone.)
Back-patch to all supported branches.
Discussion: https://postgr.es/m/efaba6f9-4190-56be-8ff2-7a1674f9194f@intrans.baku.az
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/create_view.out | 19 | ||||
-rw-r--r-- | src/test/regress/sql/create_view.sql | 5 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out index f50ef766857..509e930fc77 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -1681,6 +1681,22 @@ select * from int8_tbl i where i.* in (values(i.*::int8_tbl)); 4567890123456789 | -4567890123456789 (5 rows) +create table tt15v_log(o tt15v, n tt15v, incr bool); +create rule updlog as on update to tt15v do also + insert into tt15v_log values(old, new, row(old,old) < row(new,new)); +\d+ tt15v + View "testviewschm2.tt15v" + Column | Type | Collation | Nullable | Default | Storage | Description +--------+-----------------+-----------+----------+---------+----------+------------- + row | nestedcomposite | | | | extended | +View definition: + SELECT ROW(i.*::int8_tbl)::nestedcomposite AS "row" + FROM int8_tbl i; +Rules: + updlog AS + ON UPDATE TO tt15v DO INSERT INTO tt15v_log (o, n, incr) + VALUES (old.*::tt15v, new.*::tt15v, (ROW(old.*::tt15v, old.*::tt15v) < ROW(new.*::tt15v, new.*::tt15v))) + -- check unique-ification of overlength names create view tt18v as select * from int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy @@ -1994,7 +2010,7 @@ drop cascades to view aliased_view_2 drop cascades to view aliased_view_3 drop cascades to view aliased_view_4 DROP SCHEMA testviewschm2 CASCADE; -NOTICE: drop cascades to 73 other objects +NOTICE: drop cascades to 74 other objects DETAIL: drop cascades to table t1 drop cascades to view temporal1 drop cascades to view temporal2 @@ -2058,6 +2074,7 @@ drop cascades to type nestedcomposite drop cascades to view tt15v drop cascades to view tt16v drop cascades to view tt17v +drop cascades to table tt15v_log drop cascades to view tt18v drop cascades to view tt19v drop cascades to view tt20v diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sql index bdda56e8de7..82df4b7caca 100644 --- a/src/test/regress/sql/create_view.sql +++ b/src/test/regress/sql/create_view.sql @@ -565,6 +565,11 @@ select * from tt17v; select pg_get_viewdef('tt17v', true); select * from int8_tbl i where i.* in (values(i.*::int8_tbl)); +create table tt15v_log(o tt15v, n tt15v, incr bool); +create rule updlog as on update to tt15v do also + insert into tt15v_log values(old, new, row(old,old) < row(new,new)); +\d+ tt15v + -- check unique-ification of overlength names create view tt18v as |