CREATE TABLE points1 ( gid SERIAL PRIMARY KEY, geom GEOMETRY(POINT, 4326) ); CREATE VIEW points1_vw AS SELECT gid, geom FROM points1; -- INSERT INTO points1 -- SELECT generate_series(1, 3) as id, -- (ST_DUMP(ST_GENERATEPOINTS(st_transform(st_tileenvelope(18, 235085, 122323), 4326), 3))).geom; -- INSERT INTO points1 -- SELECT generate_series(4, 30) as id, -- (ST_DUMP(ST_GENERATEPOINTS(st_transform(st_tileenvelope(0, 0, 0), 4326), 27))).geom; -- -- To dump the data above, uncomment code the above, comment the INSERT code bellow, and run: -- just restart -- just pg_dump --data-only --inserts --rows-per-insert=100 --table=points1 INSERT INTO points1 values (1, '0101000020E6100000EC3A2806EDDA61401C2041E87DDA2740'), (2, '0101000020E61000005DDA9603E9DA614070BB4C49D0DA2740'), (3, '0101000020E6100000C975C49BE4DA61405E2616FDD1DA2740'), (4, '0101000020E61000005947D7F5EF045FC0560BE226301A4BC0'), (5, '0101000020E6100000776DF612E1BC65C0CE28B075BB805440'), (6, '0101000020E6100000D1188AF5BB166340F69C7E0388A14340'), (7, '0101000020E61000005051CFB7BF4563406F6D5E62B6145340'), (8, '0101000020E6100000E101F56A99164940960D11FF91024540'), (9, '0101000020E6100000E18D788FBD6866C058FCD51D83923140'), (10, '0101000020E6100000E23AE326D47B6140023F70AA32CF4EC0'), (11, '0101000020E6100000B63649F4E210544024CC8D72539732C0'), (12, '0101000020E6100000628B27A58F3E3740B0B989B6742D0F40'), (13, '0101000020E610000010DE41442D603940D0CD3A1C703646C0'), (14, '0101000020E61000004FC688AD360D4AC01870AA442B7E42C0'), (15, '0101000020E610000097316B3BD80D5AC004FAD27255E83340'), (16, '0101000020E610000044A5AD304AD24BC0BD3C7835943B5540'), (17, '0101000020E61000003A184905AF0A4F4010BF00583A1E5140'), (18, '0101000020E61000009B30264A61185CC05A2327A3A8EE4BC0'), (19, '0101000020E6100000EC7FFEA7C6866340BAF66508201A21C0'), (20, '0101000020E610000026156EA3E9C94E4028CE0241ECC03C40'), (21, '0101000020E610000041ED7EBCDAF665C0C8B67BDB424FF63F'), (22, '0101000020E6100000E89B8CD0F3896040D2AABB491A954FC0'), (23, '0101000020E61000003B7E4B1CC486474060EBF0EDF1863DC0'), (24, '0101000020E61000009CC12D9B329037406A6264529E143640'), (25, '0101000020E61000003C6231872D1A3CC0C0F5391D889247C0'), (26, '0101000020E61000000C4A2739273850C0B42533A49CE150C0'), (27, '0101000020E610000054990A64657F4DC0E459C5B3933D05C0'), (28, '0101000020E61000002FE1184680AE64C07D34C584D40049C0'), (29, '0101000020E61000006046EECC3C536440D410042DE5D04A40'), (30, '0101000020E61000000FFC00A790165040AA1B2B5EB01A2A40'); CREATE INDEX ON points1 USING GIST (geom); CLUSTER points1_geom_idx ON points1; DO $do$ BEGIN EXECUTE 'COMMENT ON VIEW points1_vw IS $tj$' || $$ { "description": "description from SQL comment", "attribution": "some attribution from SQL comment" } $$::json || '$tj$'; END $do$;