Alias 'i' is never used in SELECT statement
14 a+(b*c), (a+b)*c -- ditto
15
16
17INSERT INTO mnop (m, n) SELECT i, (1e9 + i/2e4)::float FROM generate_series(1, 2e4) AS i(i) RETURNING NOTHING18
19CREATE TABLE midprimarykeyswapcleanup AS SELECT * FROM generate_series(1,3) AS a;
20-- This schema change is used to enable the primary key swap. The backup is not taken during this schema change.
Alias 'window' is never used in SELECT statement
1select sum(a) over w, avg(b) over (partition by c order by d rows e preceding), min(f) over (order by g range between unbounded preceding and h following exclude ties) from t window w as (partition by i groups between j preceding and current row exclude no others)
Description
Tables should not be aliased if that alias is not used. An usused alias makes code harder to read without changing any functionality.
Bad practice
SELECT
a
FROM foo AS zoo
Recommended
Use the alias or remove it.
SELECT
zoo.a
FROM foo AS zoo
-- Alternatively...
SELECT
a
FROM foo