Skip to content

Commit 41ff3da

Browse files
authored
Merge branch 'pgspider:master' into pure_float
2 parents 3db3874 + 0f002c9 commit 41ff3da

File tree

141 files changed

+13011
-8629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+13011
-8629
lines changed

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,29 @@ EXTENSION = sqlite_fdw
1616
DATA = sqlite_fdw--1.0.sql sqlite_fdw--1.0--1.1.sql
1717

1818
ifdef ENABLE_GIS
19-
override PG_CFLAGS += -DSQLITE_FDW_GIS_ENABLE
20-
GISTEST=postgis
19+
PG_CFLAGS += -DSQLITE_FDW_GIS_ENABLE
20+
GIS_DEP_TESTS_DIR = with_gis_support
21+
GIS_TEST = postgis
22+
$(info There is PostGIS support for SQLite FDW)
2123
else
22-
GISTEST=nogis
24+
GIS_DEP_TESTS_DIR = without_gis_support
25+
GIS_TEST = nogis
26+
$(info There is NO PostGIS support for SQLite FDW)
2327
endif
2428

29+
# Tests for PostgreSQL data types support
30+
DATA_TYPE_TESTS = types/bitstring types/bool types/float4 types/float8 types/int4 types/int8 types/numeric types/macaddr types/macaddr8 types/out_of_range types/timestamp types/uuid
31+
# Tests with different versions with GIS support and without GIS support
32+
GIS_DEP_TESTS = $(GIS_DEP_TESTS_DIR)/type $(GIS_DEP_TESTS_DIR)/auto_import $(GIS_DEP_TESTS_DIR)/$(GIS_TEST)
33+
2534
ifndef REGRESS
26-
REGRESS = extra/sqlite_fdw_post types/bitstring types/bool types/float4 types/float8 types/int4 types/int8 types/numeric types/$(GISTEST) types/macaddr types/macaddr8 types/out_of_range types/timestamp types/uuid extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/encodings sqlite_fdw type_$(GISTEST) aggregate selectfunc
35+
# System tests, full default sequence
36+
REGRESS = extra/sqlite_fdw_post $(DATA_TYPE_TESTS) extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/encodings sqlite_fdw aggregate selectfunc $(GIS_DEP_TESTS)
2737
endif
2838

39+
# Other encodings also are tested. Client encoding should be UTF-8.
2940
REGRESS_OPTS = --encoding=utf8
3041

31-
SQLITE_LIB = sqlite3
32-
3342
UNAME = uname
3443
OS := $(shell $(UNAME))
3544
ifeq ($(OS), Darwin)
@@ -70,6 +79,8 @@ endif
7079
REGRESS := $(addprefix $(REGRESS_PREFIX_SUB)/,$(REGRESS))
7180
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/extra)
7281
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/types)
82+
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/$(GIS_DEP_TESTS_DIR))
83+
7384

7485
ifdef ENABLE_GIS
7586
check: temp-install

connection.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,14 @@ sqlite_begin_remote_xact(ConnCacheEntry *entry)
391391

392392

393393
/*
394-
* Report an sqlite execution error
394+
* Report an SQLite execution error.
395395
*/
396396
void
397397
sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
398398
const char *sql, int rc)
399399
{
400400
const char *message = sqlite3_errmsg(conn);
401+
int erc = sqlite3_extended_errcode(conn);
401402
int sqlstate = ERRCODE_FDW_ERROR;
402403

403404
/* copy sql before callling another SQLite API */
@@ -414,11 +415,10 @@ sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
414415
(errcode(sqlstate),
415416
errmsg("Failed to execute remote SQL"),
416417
errcontext("SQL query: %s", sql ? sql : ""),
417-
errhint("SQLite error '%s', SQLite result code %d", message ? message : "", rc)
418+
errhint("SQLite error '%s', SQLite primary result code %d, extended result code %d", message ? message : "", rc, erc)
418419
));
419420
}
420421

421-
422422
/*
423423
* sqlitefdw_xact_callback --- cleanup at main-transaction end.
424424
*/

expected/13.15/extra/insert.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CREATE FOREIGN TABLE inserttest01 (col1 int4, col2 int4 NOT NULL, col3 text defa
1111
--Testcase 1:
1212
insert into inserttest01 (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT);
1313
ERROR: Failed to execute remote SQL
14-
HINT: SQLite error 'NOT NULL constraint failed: inserttest01.col2', SQLite result code 19
14+
HINT: SQLite error 'NOT NULL constraint failed: inserttest01.col2', SQLite primary result code 19, extended result code 1299
1515
CONTEXT: SQL query: INSERT INTO main."inserttest01"(`col1`, `col2`, `col3`) VALUES (?, ?, ?)
1616
--Testcase 2:
1717
insert into inserttest01 (col2, col3) values (3, DEFAULT);

expected/13.15/extra/sqlite_fdw_post.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6437,7 +6437,7 @@ ALTER FOREIGN TABLE ft1_constraint RENAME TO ft1;
64376437
--Testcase 319:
64386438
INSERT INTO ft1(c1, c2) VALUES(11, 12); -- duplicate key
64396439
ERROR: Failed to execute remote SQL
6440-
HINT: SQLite error 'UNIQUE constraint failed: t1_constraint.c1', SQLite result code 19
6440+
HINT: SQLite error 'UNIQUE constraint failed: t1_constraint.c1', SQLite primary result code 19, extended result code 1555
64416441
CONTEXT: SQL query: INSERT INTO main."t1_constraint"(`c1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
64426442
--Testcase 320:
64436443
INSERT INTO ft1(c1, c2) VALUES(11, 12) ON CONFLICT (c1, c2) DO NOTHING; -- unsupported
@@ -6448,12 +6448,12 @@ ERROR: there is no unique or exclusion constraint matching the ON CONFLICT spec
64486448
--Testcase 743:
64496449
INSERT INTO ft1(c1, c2) VALUES(1111, -2); -- c2positive
64506450
ERROR: Failed to execute remote SQL
6451-
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite result code 19
6451+
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite primary result code 19, extended result code 275
64526452
CONTEXT: SQL query: INSERT INTO main."t1_constraint"(`c1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
64536453
--Testcase 744:
64546454
UPDATE ft1 SET c2 = -c2 WHERE c1 = 1; -- c2positive
64556455
ERROR: Failed to execute remote SQL
6456-
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite result code 19
6456+
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite primary result code 19, extended result code 275
64576457
CONTEXT: SQL query: UPDATE main."t1_constraint" SET `c2` = (- `c2`) WHERE ((`c1` = 1))
64586458
--Testcase 750:
64596459
ALTER FOREIGN TABLE ft1 RENAME TO ft1_constraint;
@@ -6856,12 +6856,12 @@ RESET constraint_exclusion;
68566856
--Testcase 745:
68576857
INSERT INTO ft1(c1, c2) VALUES(1111, -2); -- c2positive
68586858
ERROR: Failed to execute remote SQL
6859-
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite result code 19
6859+
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite primary result code 19, extended result code 275
68606860
CONTEXT: SQL query: INSERT INTO main."t1_constraint"(`c1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
68616861
--Testcase 746:
68626862
UPDATE ft1 SET c2 = -c2 WHERE c1 = 1; -- c2positive
68636863
ERROR: Failed to execute remote SQL
6864-
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite result code 19
6864+
HINT: SQLite error 'CHECK constraint failed: c2 >= 0', SQLite primary result code 19, extended result code 275
68656865
CONTEXT: SQL query: UPDATE main."t1_constraint" SET `c2` = (- `c2`) WHERE ((`c1` = 1))
68666866
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2positive;
68676867
-- But inconsistent check constraints provide inconsistent results

expected/13.15/sqlite_fdw.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ SELECT * from numbers;
576576
--Testcase 68:
577577
INSERT INTO numbers VALUES(1, 'One');
578578
ERROR: Failed to execute remote SQL
579-
HINT: SQLite error 'UNIQUE constraint failed: numbers.b', SQLite result code 19
579+
HINT: SQLite error 'UNIQUE constraint failed: numbers.b', SQLite primary result code 19, extended result code 2067
580580
CONTEXT: SQL query: INSERT INTO main."numbers"(`a`, `b`) VALUES (?, ?)
581581
--Testcase 69:
582582
DELETE from numbers;
@@ -590,7 +590,7 @@ COMMIT;
590590
--Testcase 72:
591591
UPDATE numbers SET b='Two' WHERE a = 1;
592592
ERROR: Failed to execute remote SQL
593-
HINT: SQLite error 'UNIQUE constraint failed: numbers.b', SQLite result code 19
593+
HINT: SQLite error 'UNIQUE constraint failed: numbers.b', SQLite primary result code 19, extended result code 2067
594594
CONTEXT: SQL query: UPDATE main."numbers" SET `b` = 'Two' WHERE ((`a` = 1))
595595
--Testcase 73:
596596
SELECT * from numbers;

0 commit comments

Comments
 (0)