Where the primary use of either a building or complex within which the building is situated, operated by an official or board of a city, city and county or county, is for purposes other than educational, such as, but not limited to, correctional, forestry, or hospital purposes, the building shall not be considered to be a “school building” within the meaning of Section 17283 notwithstanding any educational use thereof incidental to the primary purpose.