@ -1479,7 +1479,8 @@ create table gtest32 (
a int primary key,
a int primary key,
b int generated always as (a * 2),
b int generated always as (a * 2),
c int generated always as (10 + 10),
c int generated always as (10 + 10),
d int generated always as (coalesce(a, 100))
d int generated always as (coalesce(a, 100)),
e int
);
);
insert into gtest32 values (1), (2);
insert into gtest32 values (1), (2);
analyze gtest32;
analyze gtest32;
@ -1563,41 +1564,44 @@ select t2.* from gtest32 t1 left join gtest32 t2 on false;
QUERY PLAN
QUERY PLAN
------------------------------------------------------
------------------------------------------------------
Nested Loop Left Join
Nested Loop Left Join
Output: a, (a * 2), (20), (COALESCE(a, 100))
Output: a, (a * 2), (20), (COALESCE(a, 100)), e
Join Filter: false
Join Filter: false
-> Seq Scan on generated_virtual_tests.gtest32 t1
-> Seq Scan on generated_virtual_tests.gtest32 t1
Output: t1.a, t1.b, t1.c, t1.d
Output: t1.a, t1.b, t1.c, t1.d, t1.e
-> Result
-> Result
Output: a, 20, COALESCE(a, 100)
Output: a, e, 20, COALESCE(a, 100)
One-Time Filter: false
One-Time Filter: false
(8 rows)
(8 rows)
select t2.* from gtest32 t1 left join gtest32 t2 on false;
select t2.* from gtest32 t1 left join gtest32 t2 on false;
a | b | c | d
a | b | c | d | e
---+---+---+---
---+---+---+---+---
| | |
| | | |
| | |
| | | |
(2 rows)
(2 rows)
explain (verbose, costs off)
explain (verbose, costs off)
select * from gtest32 t group by grouping sets (a, b, c, d) having c = 20;
select * from gtest32 t group by grouping sets (a, b, c, d, e ) having c = 20;
QUERY PLAN
QUERY PLAN
-----------------------------------------------------
-----------------------------------------------------
HashAggregate
HashAggregate
Output: a, ((a * 2)), (20), (COALESCE(a, 100))
Output: a, ((a * 2)), (20), (COALESCE(a, 100)), e
Hash Key: t.a
Hash Key: t.a
Hash Key: (t.a * 2)
Hash Key: (t.a * 2)
Hash Key: 20
Hash Key: 20
Hash Key: COALESCE(t.a, 100)
Hash Key: COALESCE(t.a, 100)
Hash Key: t.e
Filter: ((20) = 20)
Filter: ((20) = 20)
-> Seq Scan on generated_virtual_tests.gtest32 t
-> Seq Scan on generated_virtual_tests.gtest32 t
Output: a, (a * 2), 20, COALESCE(a, 100)
Output: a, (a * 2), 20, COALESCE(a, 100), e
(9 rows)
(10 rows)
select * from gtest32 t group by grouping sets (a, b, c, d) having c = 20;
select * from gtest32 t group by grouping sets (a, b, c, d, e ) having c = 20;
a | b | c | d
a | b | c | d | e
---+---+----+---
---+---+----+---+---
| | 20 |
| | 20 | |
(1 row)
(1 row)
-- Ensure that the virtual generated columns in ALTER COLUMN TYPE USING expression are expanded
alter table gtest32 alter column e type bigint using b;
drop table gtest32;
drop table gtest32;