- Install PostGIS (postgresql--postgis-3) in the final image. - Add postgis and postgis_topology to init-extensions.sh. - Add test script for PostGIS to the CI workflow. - Update README.md to reflect PostGIS integration. - Remove PG18 from CI matrix because of ABI incompatibility between TimescaleDB headers and the vchord-postgres PG18 runtime (missing palloc0_mul). PG18 support will be restored when VectorChord releases a stable PG18 image.
29 lines
701 B
SQL
29 lines
701 B
SQL
-- Test 5: PostGIS
|
|
\set ON_ERROR_STOP on
|
|
|
|
CREATE TABLE spatial_data (
|
|
id serial PRIMARY KEY,
|
|
geom geometry(Point, 4326)
|
|
);
|
|
|
|
INSERT INTO spatial_data (geom) VALUES (ST_GeomFromText('POINT(-71.060316 48.432044)', 4326));
|
|
INSERT INTO spatial_data (geom) VALUES (ST_GeomFromText('POINT(-71.059773 48.432867)', 4326));
|
|
|
|
DO $$
|
|
DECLARE
|
|
dist float;
|
|
BEGIN
|
|
SELECT ST_Distance(
|
|
(SELECT geom FROM spatial_data WHERE id = 1),
|
|
(SELECT geom FROM spatial_data WHERE id = 2)
|
|
) INTO dist;
|
|
|
|
IF dist IS NULL THEN
|
|
RAISE EXCEPTION 'PostGIS distance calculation failed';
|
|
END IF;
|
|
RAISE NOTICE 'PostGIS Check: OK, distance is %', dist;
|
|
END
|
|
$$;
|
|
|
|
DROP TABLE spatial_data;
|