Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial SpatiaLite ↔ PostGIS support #96

Merged
merged 90 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
11e2bc3
Add initial SpatiaLite ↔ PostGIS support
mkgrgis Jan 11, 2024
db79d5a
Add initial SpatiaLite ↔ PostGIS support
mkgrgis Sep 30, 2024
d6534c7
Improve CI scripts supporting tests with PostGIS on CI Actions
mkgrgis Oct 7, 2024
15e1036
Merge branch 'master' into postgis_rewiews
mkgrgis Oct 7, 2024
3bc622b
Fix build process and pushing down
mkgrgis Oct 11, 2024
a0c2c57
Fix build spec Makefile
mkgrgis Oct 11, 2024
5745c92
Try to fix pushing down
mkgrgis Oct 11, 2024
55b643f
Simplify pushing predicate
mkgrgis Oct 11, 2024
38e1eb3
Try other predicate
mkgrgis Oct 11, 2024
feff025
Fix gcc warning
mkgrgis Oct 11, 2024
7db76ec
2nd trying to fix pushing prredicate
mkgrgis Oct 11, 2024
baf120f
3rd fix of pushable predicate
mkgrgis Oct 11, 2024
17c12f8
Fix malloc, improve comments
mkgrgis Oct 11, 2024
f1bdb98
Fix unused var
mkgrgis Oct 11, 2024
fbe71c9
4rd pushing predicate variant
mkgrgis Oct 11, 2024
9853c00
5th deparsing predicate variant
mkgrgis Oct 11, 2024
830bb38
Add PostGIS operator TCs
mkgrgis Oct 11, 2024
334ccae
Add other PostGIS TCs
mkgrgis Oct 11, 2024
035c3ca
Fix TC order
mkgrgis Oct 11, 2024
f8b8371
Add comments
mkgrgis Oct 11, 2024
54cfa4d
6th fix pushing predicate
mkgrgis Oct 11, 2024
919b5f6
7th ppushing predicate
mkgrgis Oct 11, 2024
3bc5b7a
8th pushing predicate
mkgrgis Oct 11, 2024
af4f06e
Revert pushdown prediacte
mkgrgis Oct 12, 2024
eddfd65
fix nogis tests
mkgrgis Oct 14, 2024
aab56af
Improve constant deparsing
mkgrgis Oct 15, 2024
996d375
Fix code style & behaviour without GIS support, add TCs
mkgrgis Oct 16, 2024
5e66258
Fix GIS constants deparsing
mkgrgis Oct 16, 2024
55408d5
Fix code style
mkgrgis Oct 16, 2024
1546cb9
Fix comment
mkgrgis Oct 16, 2024
7457e46
Expand PostGIS tests
mkgrgis Oct 16, 2024
2fedef4
Add expected result for current implementation
mkgrgis Oct 16, 2024
a61647f
Fix TC 41 comment
mkgrgis Oct 17, 2024
1a6adfe
Fix comments and TCs
mkgrgis Oct 17, 2024
c217d55
Fix file ini
mkgrgis Oct 17, 2024
b06159a
Fix nogis SQLite BLOB tests
mkgrgis Oct 18, 2024
bc5bef9
Update nogis test, commit for failed results
mkgrgis Oct 22, 2024
1d1f031
Fix nogis tests
mkgrgis Oct 22, 2024
178ac66
fix and expand tests
mkgrgis Oct 25, 2024
966ada5
Try other TCs
mkgrgis Oct 25, 2024
d9a0d5f
Fix postgis tests
mkgrgis Oct 25, 2024
98a6474
Add PostGIS tests
mkgrgis Oct 28, 2024
3f15b65
Fix PostGIS const deparsing
mkgrgis Oct 28, 2024
ca4351e
Add DEFINE branches to PostGIS const deparsing
mkgrgis Oct 28, 2024
2bd1a57
Reduce double calculation
mkgrgis Oct 28, 2024
348f228
Try other PostGIs const deparsing
mkgrgis Oct 28, 2024
27eb087
Fix extval
mkgrgis Oct 28, 2024
cc5f643
Fix function call
mkgrgis Oct 28, 2024
a120f2a
Add PostGIS TCs
mkgrgis Oct 28, 2024
89f1d10
Fix TC 61
mkgrgis Oct 28, 2024
9775492
Add new testing results
mkgrgis Oct 28, 2024
34265fe
Remove some operator tests
mkgrgis Oct 28, 2024
aedd651
Remove operators from result
mkgrgis Oct 28, 2024
84c925d
Add postgis TCs
mkgrgis Oct 29, 2024
8c5d712
Remove some built-in operators test
mkgrgis Oct 29, 2024
4a92806
Remove not unique operators from postgis test
mkgrgis Oct 29, 2024
6fa6224
Renumerate TCs
mkgrgis Oct 29, 2024
bacc068
Fix TCs
mkgrgis Oct 29, 2024
9b6f970
Fix expected
mkgrgis Oct 29, 2024
36d2b81
Fix comments, remove invalid TC
Oct 29, 2024
7d65e56
Fix expected
Oct 29, 2024
d086e3f
Add else if, sqlite_query.c
mkgrgis Oct 30, 2024
5e075a6
Fix `listed_datatype_oid` signature
Oct 30, 2024
74366ca
Fix spell
Oct 30, 2024
3e4e043
Fix `hexPrefix` legth for copy + `\0`
Oct 30, 2024
7aa5876
Fix text independence
Oct 31, 2024
a9a7d1d
Make separate `type` test for different ENABLE_GIS
Oct 31, 2024
70dec88
Fix test results path
Oct 31, 2024
da83c9c
Fix additional TCs
Oct 31, 2024
574a48d
Try to fix memory freeing
Oct 31, 2024
d31517a
Reduce double calculations
Oct 31, 2024
4da3346
Add `static` in signature, `sqlite_gis.c`
mkgrgis Nov 1, 2024
8ef9844
Add memory free call for SpatiaLite geom collection, sqlite_gis.c
mkgrgis Nov 8, 2024
68f9588
Try to use internal SpatiaLite cache
mkgrgis Nov 14, 2024
20d73d2
Add headers
mkgrgis Nov 14, 2024
fac9a43
Revert context usage
mkgrgis Nov 14, 2024
bba7648
Fix code style to SpatiaLite impl.
mkgrgis Nov 14, 2024
da25ebc
Reset tests before v2.5.0
mkgrgis Dec 12, 2024
524871f
Add v2.5.0 tests
mkgrgis Dec 12, 2024
8890cb1
Fix init data
mkgrgis Dec 12, 2024
eaeccb2
Revert "types_PostGIS" SQLite test table
mkgrgis Dec 12, 2024
18d31e4
Fix sqlite_fdw test
mkgrgis Dec 12, 2024
6c8fb13
Merge branch 'master' into postgis_2_5_0
mkgrgis Dec 12, 2024
26341be
Merge mac implementation from 'master' into postgis_2_5_0
mkgrgis Dec 20, 2024
d027a90
Remove GIS tests from extra (now in types)
mkgrgis Dec 20, 2024
009c5f7
Squash last 10 commits
mkgrgis Jan 7, 2025
88ef53c
By 2nd review: restore regress + improve docs
mkgrgis Jan 7, 2025
c53c281
Fix spell
mkgrgis Jan 7, 2025
11d62de
Fix typo by review, restore type_BOOLENAN in type_* tests, remove typ…
mkgrgis Jan 8, 2025
821a711
Fix inline doc in script
mkgrgis Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add v2.5.0 tests
mkgrgis committed Dec 12, 2024
commit 524871fca425f1b61226cdee4ae21a347af1fad3
193 changes: 193 additions & 0 deletions expected/13.15/aggregate.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
--SET log_min_messages TO DEBUG1;
--SET client_min_messages TO DEBUG1;
--Testcase 16:
CREATE EXTENSION sqlite_fdw;
--Testcase 17:
CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
OPTIONS (database '/tmp/sqlite_fdw_test/common.db');
--Testcase 18:
CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true'), c int OPTIONS(key 'true')) SERVER sqlite_svr;
-- test for aggregate pushdown
--Testcase 8:
DROP SERVER IF EXISTS sqlite_svr CASCADE;
NOTICE: drop cascades to foreign table multiprimary
--Testcase 9:
DROP EXTENSION IF EXISTS sqlite_fdw CASCADE;
--Testcase 10:
CREATE EXTENSION sqlite_fdw;
--Testcase 11:
CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
OPTIONS (database '/tmp/sqlite_fdw_test/common.db');
--Testcase 12:
CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true'), c int OPTIONS(key 'true')) SERVER sqlite_svr;
--Testcase 1:
explain (costs off, verbose) select count(distinct a) from multiprimary;
QUERY PLAN
---------------------------------------------------------------------
Foreign Scan
Output: (count(DISTINCT a))
SQLite query: SELECT count(DISTINCT `a`) FROM main."multiprimary"
(3 rows)

--Testcase 2:
explain (costs off, verbose) select sum(b),max(b), min(b), avg(b) from multiprimary;
QUERY PLAN
----------------------------------------------------------------------------------------
Foreign Scan
Output: (sum(b)), (max(b)), (min(b)), (avg(b))
SQLite query: SELECT sum(`b`), max(`b`), min(`b`), avg(`b`) FROM main."multiprimary"
(3 rows)

--Testcase 3:
explain (costs off, verbose) select sum(b+5)+2 from multiprimary group by b/2 order by b/2;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Foreign Scan
Output: ((sum((b + 5)) + 2)), ((b / 2))
SQLite query: SELECT (sum((`b` + 5)) + 2), (`b` / 2) FROM main."multiprimary" GROUP BY 2 ORDER BY (`b` / 2) ASC NULLS LAST
(3 rows)

--Testcase 4:
explain (costs off, verbose) select sum(a) from multiprimary group by b having sum(a) > 0;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Foreign Scan
Output: (sum(a)), b
SQLite query: SELECT sum(`a`), `b` FROM main."multiprimary" GROUP BY 2 HAVING ((sum(`a`) > 0))
(3 rows)

--Testcase 5:
explain (costs off, verbose) select sum(a) from multiprimary group by b having avg(a^2) > 0 and sum(a) > 0;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------
GroupAggregate
Output: sum(a), b
Group Key: multiprimary.b
Filter: ((avg(((multiprimary.a)::double precision ^ '2'::double precision)) > '0'::double precision) AND (sum(multiprimary.a) > 0))
-> Foreign Scan on public.multiprimary
Output: a, b, c
SQLite query: SELECT `a`, `b` FROM main."multiprimary" ORDER BY `b` ASC NULLS LAST
(7 rows)

-- stddev and variance are not pushed down
--Testcase 6:
explain (costs off, verbose) select stddev(a) from multiprimary;
QUERY PLAN
-----------------------------------------------------------
Aggregate
Output: stddev(a)
-> Foreign Scan on public.multiprimary
Output: a, b, c
SQLite query: SELECT `a` FROM main."multiprimary"
(5 rows)

--Testcase 7:
explain (costs off, verbose) select sum(a) from multiprimary group by b having variance(a) > 0;
QUERY PLAN
--------------------------------------------------------------------------------------------
GroupAggregate
Output: sum(a), b
Group Key: multiprimary.b
Filter: (variance(multiprimary.a) > '0'::numeric)
-> Foreign Scan on public.multiprimary
Output: a, b, c
SQLite query: SELECT `a`, `b` FROM main."multiprimary" ORDER BY `b` ASC NULLS LAST
(7 rows)

--Testcase 13:
DROP FOREIGN TABLE multiprimary;
--Testcase 16:
CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true'), x int, y text) SERVER sqlite_svr;
--Testcase 17:
INSERT INTO limittest(x, y) VALUES (1, 'x'), (2, 'x'), (3, 'x'), (4, 'x');
--Testcase 18:
INSERT INTO limittest(x, y) VALUES (1, 'y'), (2, 'y'), (3, 'y'), (4, 'y');
--Testcase 19:
INSERT INTO limittest(x, y) VALUES (1, 'z'), (2, 'z'), (3, 'z'), (4, 'z');
--Testcase 20:
EXPLAIN VERBOSE
SELECT avg(x) FROM limittest GROUP BY y ORDER BY 1 DESC FETCH FIRST 2 ROWS WITH TIES;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------
Limit (cost=1.00..1.00 rows=1 width=64)
Output: (avg(x)), y
-> Foreign Scan (cost=1.00..1.00 rows=1 width=64)
Output: (avg(x)), y
SQLite query: SELECT avg(`x`), `y` FROM main."limittest" GROUP BY 2 ORDER BY avg(`x`) DESC NULLS FIRST
(5 rows)

--Testcase 21:
SELECT avg(x) FROM limittest GROUP BY y ORDER BY 1 DESC FETCH FIRST 2 ROWS WITH TIES;
avg
-----
2.5
2.5
2.5
(3 rows)

--Testcase 22:
EXPLAIN VERBOSE
SELECT avg(x) FROM limittest WHERE x >= 0 GROUP BY y ORDER BY 1 DESC FETCH FIRST 2 ROWS WITH TIES;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------
Limit (cost=1.00..1.00 rows=1 width=64)
Output: (avg(x)), y
-> Foreign Scan (cost=1.00..1.00 rows=1 width=64)
Output: (avg(x)), y
SQLite query: SELECT avg(`x`), `y` FROM main."limittest" WHERE ((`x` >= 0)) GROUP BY 2 ORDER BY avg(`x`) DESC NULLS FIRST
(5 rows)

--Testcase 23:
SELECT avg(x) FROM limittest WHERE x >= 0 GROUP BY y ORDER BY 1 DESC FETCH FIRST 2 ROWS WITH TIES;
avg
-----
2.5
2.5
2.5
(3 rows)

--Testcase 24:
EXPLAIN VERBOSE
SELECT x FROM limittest WHERE x > 0 ORDER BY 1 FETCH FIRST 2 ROWS WITH TIES;
QUERY PLAN
------------------------------------------------------------------------------------------------------
Limit (cost=10.00..10.00 rows=2 width=4)
Output: x
-> Foreign Scan on public.limittest (cost=10.00..10.00 rows=10 width=4)
Output: x
SQLite query: SELECT `x` FROM main."limittest" WHERE ((`x` > 0)) ORDER BY `x` ASC NULLS LAST
(5 rows)

--Testcase 25:
SELECT x FROM limittest WHERE x > 0 ORDER BY 1 FETCH FIRST 2 ROWS WITH TIES;
x
---
1
1
1
(3 rows)

--Testcase 26:
EXPLAIN VERBOSE
SELECT x FROM limittest ORDER BY 1 FETCH FIRST 2 ROWS ONLY;
QUERY PLAN
--------------------------------------------------------------------------------------
Foreign Scan on public.limittest (cost=1.00..1.00 rows=1 width=4)
Output: x
SQLite query: SELECT `x` FROM main."limittest" ORDER BY `x` ASC NULLS LAST LIMIT 2
(3 rows)

--Testcase 27:
SELECT x FROM limittest ORDER BY 1 FETCH FIRST 2 ROWS ONLY;
x
---
1
1
(2 rows)

--Testcase 28:
DROP FOREIGN TABLE limittest;
--Testcase 14:
DROP SERVER sqlite_svr;
--Testcase 15:
DROP EXTENSION sqlite_fdw CASCADE;
Loading