Add _vovw_count columnt to tables for which overviews are created
Initially we planned to add this column to the queries sent to the tiler only, but that makes the column hard to access from the editor.
This commit is contained in:
parent
f785e71d3b
commit
c595e45c11
@ -718,6 +718,7 @@ DECLARE
|
||||
overview_z integer;
|
||||
overview_tables REGCLASS[];
|
||||
overviews_step integer := 1;
|
||||
has_counter_column boolean;
|
||||
BEGIN
|
||||
-- Determine the referece zoom level
|
||||
EXECUTE 'SELECT ' || quote_ident(refscale_strategy::text) || Format('(''%s'', %s);', reloid, tolerance_px) INTO ref_z;
|
||||
@ -743,6 +744,17 @@ BEGIN
|
||||
SELECT array_append(overview_tables, base_rel) INTO overview_tables;
|
||||
END LOOP;
|
||||
|
||||
IF overview_tables IS NOT NULL AND array_length(overview_tables, 1) > 0 THEN
|
||||
SELECT EXISTS (
|
||||
SELECT * FROM CDB_ColumnNames(reloid) as colname WHERE colname = '_vovw_count'
|
||||
) INTO has_counter_column;
|
||||
IF NOT has_counter_column THEN
|
||||
EXECUTE Format('
|
||||
ALTER TABLE %s ADD COLUMN _vovw_count integer DEFAULT 1;
|
||||
', reloid);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
RETURN overview_tables;
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
|
Loading…
Reference in New Issue
Block a user