Unanswered: Creating a View results In a Temporary View... Why?
Dear Sirs et Madames,
Am trying to create a view that will provide me the data to create a population pyramid. However when I run the Create View script, it concludes successfully but tells me "NOTICE: view 'population_pyramid_1' will be a temporary view
Query returned successfully with no result in 42 ms."
But why is it a temporary view? The sql is as below:
create or replace view population_pyramid_1 AS
extract('year' from jun30) as year,
on(rufiji_individual.uuid = rufiji_mortal."individualUUID")
(select distinct date_trunc('year', "entryDate") + interval '5 months' + interval '29 days' as jun30 from rufiji_individual where extract('year' from "entryDate") >= 1997 order by jun30) as distinct_years
-- person was born before date
dob < distinct_years.jun30
-- and died after date
-- or is still alive
and ("deathDate" > distinct_years.jun30
or "deathDate" is null)
-- and is currently living in the survey area
-- they entered before date
and "entryDate" < distinct_years.jun30
-- and left after date or are still living here
and ("exitDate" > distinct_years.jun30
or "exitDate" is null)
-- and within age range
and age(distinct_years.jun30, dob) > age_ranges.min
and age(distinct_years.jun30, dob) <= age_ranges.max
group by age_ranges.min, sex, year
order by age_ranges.min, sex, year
BTW, age_ranges is another view (not temporary) in the database.
Could anyone please assist me in finding out why this only creates a temporary view?