'How/When do views generate columns

Consider the following setup:

CREATE TABLE person (
  first_name varchar,
  last_name varchar,
  age INT
 );
 
INSERT INTO person (first_name, last_name, age)
VALUES ('pete', 'peterson', 16),
        ('john', 'johnson', 20),
        ('dick', 'dickson', 42),
        ('rob', 'robson', 30);
 
Create OR REPLACE VIEW adult_view AS
SELECT 
  first_name || ' ' || last_name as full_name, 
  age
FROM person;

If I run:

SELECT * 
FROM adult_view
WHERE age > 18;

Will the view generate the full_name column for pete even though he gets filtered out?

Similarly, if I run:

SELECT age
FROM adult_view;

Will the view generate any full_name columns at all?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source