when I execute the following UNION ALL code to combine several tables into one materialized view I get the error: column >>?column?<< specified several times. As you can see above the code, i strictly hold on to the sequence from the original tables.
- name
- info1 AS hoehe
- info1 AS art
- info1 AS name_alternative
- info2 AS region
- info3 AS text_hoehe
- kn AS name_lang
- geoloc
- symbolnummer
DROP MATERIALIZED VIEW vt_views.poi_test;
CREATE MATERIALIZED VIEW vt_views.poi_test
TABLESPACE pg_default
AS
SELECT tim_bergname.name,
tim_bergname.info1 AS hoehe,
NULL,
NULL,
tim_bergname.info2 AS region,
NULL,
NULL,
tim_bergname.geoloc,
tim_bergname.symbolnummer
FROM tim_bergname
UNION ALL
SELECT tim_flurname.name,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
tim_flurname.geoloc,
tim_flurname.symbolnummer
FROM tim_flurname
UNION ALL
SELECT tim_haus_huette.name,
NULL,
tim_haus_huette.info1 AS art,
NULL,
tim_haus_huette.info2 AS region,
NULL,
NULL,
tim_haus_huette.geoloc,
tim_haus_huette.symbolnummer
FROM tim_haus_huette
UNION ALL
SELECT tim_museum.name,
NULL,
tim_museum.info1 AS art,
NULL,
NULL,
NULL,
tim_museum.kn AS name_lang,
tim_museum.geoloc,
tim_museum.symbolnummer
FROM tim_museum
UNION ALL
... several other SELECTS (shortened because of stackoverflow restrictions)
UNION ALL
SELECT tim_wohnmobilstellplatz.name,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
tim_wohnmobilstellplatz.geoloc,
tim_wohnmobilstellplatz.symbolnummer
FROM tim_wohnmobilstellplatz
WITH DATA;
ALTER TABLE vt_views.poi_test
OWNER TO postgres;
GRANT ALL ON TABLE vt_views.poi TO postgres;
GRANT ALL ON TABLE vt_views.poi TO PUBLIC;
Any Idea why that is? Is it because for example info1 is used three times? I can't edit the origin tables because we have a batch which is filling the tables. Thanks for you help!