-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial SpatiaLite ↔ PostGIS support
- Loading branch information
Showing
28 changed files
with
1,246 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--SET log_min_messages TO DEBUG1; | ||
--SET client_min_messages TO DEBUG1; | ||
--Testcase 001: | ||
CREATE EXTENSION sqlite_fdw; | ||
--Testcase 002: | ||
CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw | ||
OPTIONS (database '/tmp/sqlitefdw_test.db'); | ||
--Testcase 003: | ||
CREATE SERVER sqlite2 FOREIGN DATA WRAPPER sqlite_fdw; | ||
--Testcase 01: | ||
CREATE DOMAIN geometry AS bytea; | ||
--Testcase 02: | ||
CREATE DOMAIN geography AS bytea; | ||
--Testcase 03: | ||
CREATE DOMAIN addbandarg AS bytea; | ||
--Testcase 04: | ||
CREATE DOMAIN box2d AS bytea; | ||
--Testcase 05: | ||
CREATE DOMAIN box3d AS bytea; | ||
--Testcase 06: | ||
CREATE DOMAIN geometry_dump AS bytea; | ||
--Testcase 07: | ||
CREATE DOMAIN geomval AS bytea; | ||
--Testcase 08: | ||
CREATE DOMAIN getfaceedges_returntype AS bytea; | ||
--Testcase 09: | ||
CREATE DOMAIN rastbandarg AS bytea; | ||
--Testcase 10: | ||
CREATE DOMAIN raster AS bytea; | ||
--Testcase 11: | ||
CREATE DOMAIN reclassarg AS bytea; | ||
--Testcase 12: | ||
CREATE DOMAIN summarystats AS bytea; | ||
--Testcase 13: | ||
CREATE DOMAIN topoelement AS bytea; | ||
--Testcase 14: | ||
CREATE DOMAIN topoelementarray AS bytea; | ||
--Testcase 15: | ||
CREATE DOMAIN topogeometry AS bytea; | ||
--Testcase 16: | ||
CREATE DOMAIN unionarg AS bytea; | ||
--Testcase 17: | ||
CREATE DOMAIN validatetopology_returntype AS bytea; | ||
--Testcase 30: | ||
CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true'), gm geometry, gg geography, r raster, t text) SERVER sqlite_svr; | ||
--Testcase 31: ERR - raster | ||
INSERT INTO "types_PostGIS" ( "i", gm, gg, r, t ) VALUES (1, decode('0101000020e6100000fd5aa846f9733e406c054d4bacd74d40', 'hex'), decode('0101000020e6100000fd5aa846f9733e406c054d4bacd74d40', 'hex'), decode('1223456890', 'hex'), '{"genus": "Rhododendron", "taxon": "Rhododendron ledebourii", "natural": "shrub", "genus:ru": "Рододендрон", "taxon:ru": "Рододендрон Ледебура", "source:taxon": "board"}'); | ||
ERROR: This data type is PostGIS specific and have not any SpatiaLite value | ||
HINT: Data type: "public.raster" in column "r" | ||
--Testcase 32: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gm" TYPE bytea; | ||
--Testcase 33: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gg" TYPE bytea; | ||
-- Insert SpatiaLite BLOB, read PostGOS/GEOS BLOB | ||
--Testcase 34: OK | ||
INSERT INTO "types_PostGIS" ( "i", gm, gg, t ) VALUES (1, decode('0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe', 'hex'), decode('0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe', 'hex'), '{"genus": "Rhododendron", "taxon": "Rhododendron ledebourii", "natural": "shrub", "genus:ru": "Рододендрон", "taxon:ru": "Рододендрон Ледебура", "source:taxon": "board"}'); | ||
--Testcase 35: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gm" TYPE geometry; | ||
--Testcase 36: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gg" TYPE geography; | ||
--Testcase 37: OK | ||
SELECT "i", gm, gg, t FROM "types_PostGIS"; | ||
i | gm | gg | t | ||
---+------------------------------------------------------+------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
1 | \x0101000020e6100000bf72ce99fe763e40ed4960730ed84d40 | \x0101000020e6100000bf72ce99fe763e40ed4960730ed84d40 | {"genus": "Rhododendron", "taxon": "Rhododendron ledebourii", "natural": "shrub", "genus:ru": "Рододендрон", "taxon:ru": "Рододендрон Ледебура", "source:taxon": "board"} | ||
(1 row) | ||
|
||
-- Insert PostGOS/GEOS BLOB, read SpatiaLite BLOB | ||
--Testcase 38: OK | ||
INSERT INTO "types_PostGIS" ( "i", gm, gg, t ) VALUES (2, decode('0101000020e6100000bf72ce99fe763e40ed4960730ed84d40', 'hex'), decode('0101000020e6100000bf72ce99fe763e40ed4960730ed84d40', 'hex'), '{"genus": "Rhododendron", "taxon": "Rhododendron ledebourii"}'); | ||
--Testcase 39: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gm" TYPE bytea; | ||
--Testcase 40: | ||
ALTER FOREIGN TABLE "types_PostGIS" ALTER COLUMN "gg" TYPE bytea; | ||
--Testcase 41: OK | ||
SELECT "i", gm, gg, t FROM "types_PostGIS"; | ||
i | gm | gg | t | ||
---+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
1 | \x0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe | \x0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe | {"genus": "Rhododendron", "taxon": "Rhododendron ledebourii", "natural": "shrub", "genus:ru": "Рододендрон", "taxon:ru": "Рододендрон Ледебура", "source:taxon": "board"} | ||
2 | \x0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe | \x0001e6100000bf72ce99fe763e40ed4960730ed84d40bf72ce99fe763e40ed4960730ed84d407c01000000bf72ce99fe763e40ed4960730ed84d40fe | {"genus": "Rhododendron", "taxon": "Rhododendron ledebourii"} | ||
(2 rows) | ||
|
||
--Testcase 004: | ||
DROP EXTENSION sqlite_fdw CASCADE; | ||
NOTICE: drop cascades to 3 other objects | ||
DETAIL: drop cascades to server sqlite_svr | ||
drop cascades to foreign table "types_PostGIS" | ||
drop cascades to server sqlite2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.