From 6a9b5ac9c8451b73d07dc0fbd17dacd3d4221adb Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Son Date: Fri, 13 Jan 2023 10:13:21 +0700 Subject: [PATCH] RELEASE v2.3.0 --- META.json | 4 +- README.md | 1 + connection.c | 82 ++++-- expected/{11.16 => 11.17}/aggregate.out | 0 .../{11.16 => 11.17}/extra/aggregates.out | 0 expected/{11.16 => 11.17}/extra/float4.out | 0 expected/{11.16 => 11.17}/extra/float8.out | 0 expected/{11.16 => 11.17}/extra/insert.out | 0 expected/{11.16 => 11.17}/extra/int4.out | 0 expected/{11.16 => 11.17}/extra/int8.out | 0 expected/{11.16 => 11.17}/extra/join.out | 0 expected/{11.16 => 11.17}/extra/limit.out | 0 expected/{11.16 => 11.17}/extra/numeric.out | 0 expected/{11.16 => 11.17}/extra/prepare.out | 0 expected/{11.16 => 11.17}/extra/select.out | 0 .../{11.16 => 11.17}/extra/select_having.out | 0 .../extra/sqlite_fdw_post.out | 0 expected/{11.16 => 11.17}/extra/timestamp.out | 0 expected/{11.16 => 11.17}/extra/update.out | 0 expected/{11.16 => 11.17}/selectfunc.out | 0 expected/{11.16 => 11.17}/sqlite_fdw.out | 4 +- expected/{11.16 => 11.17}/type.out | 0 expected/{12.11 => 12.12}/aggregate.out | 0 .../{12.11 => 12.12}/extra/aggregates.out | 0 expected/{12.11 => 12.12}/extra/float4.out | 0 expected/{12.11 => 12.12}/extra/float8.out | 0 expected/{12.11 => 12.12}/extra/insert.out | 0 expected/{12.11 => 12.12}/extra/int4.out | 0 expected/{12.11 => 12.12}/extra/int8.out | 0 expected/{12.11 => 12.12}/extra/join.out | 0 expected/{12.11 => 12.12}/extra/limit.out | 0 expected/{12.11 => 12.12}/extra/numeric.out | 0 expected/{12.11 => 12.12}/extra/prepare.out | 0 expected/{12.11 => 12.12}/extra/select.out | 0 .../{12.11 => 12.12}/extra/select_having.out | 0 .../extra/sqlite_fdw_post.out | 0 expected/{12.11 => 12.12}/extra/timestamp.out | 0 expected/{12.11 => 12.12}/extra/update.out | 0 expected/{12.11 => 12.12}/selectfunc.out | 0 expected/{12.11 => 12.12}/sqlite_fdw.out | 4 +- expected/{12.11 => 12.12}/type.out | 0 expected/{13.7 => 13.8}/aggregate.out | 0 expected/{13.7 => 13.8}/extra/aggregates.out | 0 expected/{13.7 => 13.8}/extra/float4.out | 0 expected/{13.7 => 13.8}/extra/float8.out | 0 expected/{13.7 => 13.8}/extra/insert.out | 0 expected/{13.7 => 13.8}/extra/int4.out | 0 expected/{13.7 => 13.8}/extra/int8.out | 0 expected/{13.7 => 13.8}/extra/join.out | 0 expected/{13.7 => 13.8}/extra/limit.out | 0 expected/{13.7 => 13.8}/extra/numeric.out | 0 expected/{13.7 => 13.8}/extra/prepare.out | 0 expected/{13.7 => 13.8}/extra/select.out | 0 .../{13.7 => 13.8}/extra/select_having.out | 0 .../{13.7 => 13.8}/extra/sqlite_fdw_post.out | 0 expected/{13.7 => 13.8}/extra/timestamp.out | 0 expected/{13.7 => 13.8}/extra/update.out | 0 expected/{13.7 => 13.8}/selectfunc.out | 0 expected/{13.7 => 13.8}/sqlite_fdw.out | 4 +- expected/{13.7 => 13.8}/type.out | 0 expected/{14.4 => 14.5}/aggregate.out | 0 expected/{14.4 => 14.5}/extra/aggregates.out | 0 expected/{14.4 => 14.5}/extra/float4.out | 0 expected/{14.4 => 14.5}/extra/float8.out | 0 expected/{14.4 => 14.5}/extra/insert.out | 0 expected/{14.4 => 14.5}/extra/int4.out | 0 expected/{14.4 => 14.5}/extra/int8.out | 0 expected/{14.4 => 14.5}/extra/join.out | 0 expected/{14.4 => 14.5}/extra/limit.out | 0 expected/{14.4 => 14.5}/extra/numeric.out | 0 expected/{14.4 => 14.5}/extra/prepare.out | 0 expected/{14.4 => 14.5}/extra/select.out | 0 .../{14.4 => 14.5}/extra/select_having.out | 0 .../{14.4 => 14.5}/extra/sqlite_fdw_post.out | 0 expected/{14.4 => 14.5}/extra/timestamp.out | 0 expected/{14.4 => 14.5}/extra/update.out | 0 expected/{14.4 => 14.5}/selectfunc.out | 0 expected/{15beta2 => 14.5}/sqlite_fdw.out | 4 +- expected/{14.4 => 14.5}/type.out | 0 expected/{15beta2 => 15.0}/aggregate.out | 0 .../{15beta2 => 15.0}/extra/aggregates.out | 222 ++-------------- expected/{15beta2 => 15.0}/extra/float4.out | 0 expected/{15beta2 => 15.0}/extra/float8.out | 0 expected/{15beta2 => 15.0}/extra/insert.out | 0 expected/{15beta2 => 15.0}/extra/int4.out | 0 expected/{15beta2 => 15.0}/extra/int8.out | 0 expected/{15beta2 => 15.0}/extra/join.out | 236 ++++++++++-------- expected/{15beta2 => 15.0}/extra/limit.out | 0 expected/{15beta2 => 15.0}/extra/numeric.out | 0 expected/{15beta2 => 15.0}/extra/prepare.out | 0 expected/{15beta2 => 15.0}/extra/select.out | 0 .../{15beta2 => 15.0}/extra/select_having.out | 0 .../extra/sqlite_fdw_post.out | 209 +++++++++++++--- .../{15beta2 => 15.0}/extra/timestamp.out | 0 expected/{15beta2 => 15.0}/extra/update.out | 0 expected/{15beta2 => 15.0}/selectfunc.out | 0 expected/{14.4 => 15.0}/sqlite_fdw.out | 4 +- expected/{15beta2 => 15.0}/type.out | 0 sql/{11.16 => 11.17}/aggregate.sql | 0 sql/{11.16 => 11.17}/extra/aggregates.sql | 0 sql/{11.16 => 11.17}/extra/float4.sql | 0 sql/{11.16 => 11.17}/extra/float8.sql | 0 sql/{11.16 => 11.17}/extra/insert.sql | 0 sql/{11.16 => 11.17}/extra/int4.sql | 0 sql/{11.16 => 11.17}/extra/int8.sql | 0 sql/{11.16 => 11.17}/extra/join.sql | 0 sql/{11.16 => 11.17}/extra/limit.sql | 0 sql/{11.16 => 11.17}/extra/numeric.sql | 0 sql/{11.16 => 11.17}/extra/prepare.sql | 0 sql/{11.16 => 11.17}/extra/select.sql | 0 sql/{11.16 => 11.17}/extra/select_having.sql | 0 .../extra/sqlite_fdw_post.sql | 0 sql/{11.16 => 11.17}/extra/timestamp.sql | 0 sql/{11.16 => 11.17}/extra/update.sql | 0 sql/{11.16 => 11.17}/selectfunc.sql | 0 sql/{11.16 => 11.17}/sqlite_fdw.sql | 0 sql/{11.16 => 11.17}/type.sql | 0 sql/{12.11 => 12.12}/aggregate.sql | 0 sql/{12.11 => 12.12}/extra/aggregates.sql | 0 sql/{12.11 => 12.12}/extra/float4.sql | 0 sql/{12.11 => 12.12}/extra/float8.sql | 0 sql/{12.11 => 12.12}/extra/insert.sql | 0 sql/{12.11 => 12.12}/extra/int4.sql | 0 sql/{12.11 => 12.12}/extra/int8.sql | 0 sql/{12.11 => 12.12}/extra/join.sql | 0 sql/{12.11 => 12.12}/extra/limit.sql | 0 sql/{12.11 => 12.12}/extra/numeric.sql | 0 sql/{12.11 => 12.12}/extra/prepare.sql | 0 sql/{12.11 => 12.12}/extra/select.sql | 0 sql/{12.11 => 12.12}/extra/select_having.sql | 0 .../extra/sqlite_fdw_post.sql | 0 sql/{12.11 => 12.12}/extra/timestamp.sql | 0 sql/{12.11 => 12.12}/extra/update.sql | 0 sql/{12.11 => 12.12}/selectfunc.sql | 0 sql/{12.11 => 12.12}/sqlite_fdw.sql | 0 sql/{12.11 => 12.12}/type.sql | 0 sql/{13.7 => 13.8}/aggregate.sql | 0 sql/{13.7 => 13.8}/extra/aggregates.sql | 0 sql/{13.7 => 13.8}/extra/float4.sql | 0 sql/{13.7 => 13.8}/extra/float8.sql | 0 sql/{13.7 => 13.8}/extra/insert.sql | 0 sql/{13.7 => 13.8}/extra/int4.sql | 0 sql/{13.7 => 13.8}/extra/int8.sql | 0 sql/{13.7 => 13.8}/extra/join.sql | 0 sql/{13.7 => 13.8}/extra/limit.sql | 0 sql/{13.7 => 13.8}/extra/numeric.sql | 0 sql/{13.7 => 13.8}/extra/prepare.sql | 0 sql/{13.7 => 13.8}/extra/select.sql | 0 sql/{13.7 => 13.8}/extra/select_having.sql | 0 sql/{13.7 => 13.8}/extra/sqlite_fdw_post.sql | 0 sql/{13.7 => 13.8}/extra/timestamp.sql | 0 sql/{13.7 => 13.8}/extra/update.sql | 0 sql/{13.7 => 13.8}/selectfunc.sql | 0 sql/{13.7 => 13.8}/sqlite_fdw.sql | 0 sql/{13.7 => 13.8}/type.sql | 0 sql/{14.4 => 14.5}/aggregate.sql | 0 sql/{14.4 => 14.5}/extra/aggregates.sql | 0 sql/{14.4 => 14.5}/extra/float4.sql | 0 sql/{14.4 => 14.5}/extra/float8.sql | 0 sql/{14.4 => 14.5}/extra/insert.sql | 0 sql/{14.4 => 14.5}/extra/int4.sql | 0 sql/{14.4 => 14.5}/extra/int8.sql | 0 sql/{14.4 => 14.5}/extra/join.sql | 0 sql/{14.4 => 14.5}/extra/limit.sql | 0 sql/{14.4 => 14.5}/extra/numeric.sql | 0 sql/{14.4 => 14.5}/extra/prepare.sql | 0 sql/{14.4 => 14.5}/extra/select.sql | 0 sql/{14.4 => 14.5}/extra/select_having.sql | 0 sql/{14.4 => 14.5}/extra/sqlite_fdw_post.sql | 0 sql/{14.4 => 14.5}/extra/timestamp.sql | 0 sql/{14.4 => 14.5}/extra/update.sql | 0 sql/{14.4 => 14.5}/selectfunc.sql | 0 sql/{14.4 => 14.5}/sqlite_fdw.sql | 0 sql/{14.4 => 14.5}/type.sql | 0 sql/{15beta2 => 15.0}/aggregate.sql | 0 sql/{15beta2 => 15.0}/extra/aggregates.sql | 141 ++--------- sql/{15beta2 => 15.0}/extra/float4.sql | 0 sql/{15beta2 => 15.0}/extra/float8.sql | 0 sql/{15beta2 => 15.0}/extra/insert.sql | 0 sql/{15beta2 => 15.0}/extra/int4.sql | 0 sql/{15beta2 => 15.0}/extra/int8.sql | 0 sql/{15beta2 => 15.0}/extra/join.sql | 27 ++ sql/{15beta2 => 15.0}/extra/limit.sql | 0 sql/{15beta2 => 15.0}/extra/numeric.sql | 0 sql/{15beta2 => 15.0}/extra/prepare.sql | 0 sql/{15beta2 => 15.0}/extra/select.sql | 0 sql/{15beta2 => 15.0}/extra/select_having.sql | 0 .../extra/sqlite_fdw_post.sql | 53 +++- sql/{15beta2 => 15.0}/extra/timestamp.sql | 0 sql/{15beta2 => 15.0}/extra/update.sql | 0 sql/{15beta2 => 15.0}/selectfunc.sql | 0 sql/{15beta2 => 15.0}/sqlite_fdw.sql | 0 sql/{15beta2 => 15.0}/type.sql | 0 sqlite_fdw.c | 73 +++++- sqlite_fdw.h | 4 +- 195 files changed, 586 insertions(+), 486 deletions(-) rename expected/{11.16 => 11.17}/aggregate.out (100%) rename expected/{11.16 => 11.17}/extra/aggregates.out (100%) rename expected/{11.16 => 11.17}/extra/float4.out (100%) rename expected/{11.16 => 11.17}/extra/float8.out (100%) rename expected/{11.16 => 11.17}/extra/insert.out (100%) rename expected/{11.16 => 11.17}/extra/int4.out (100%) rename expected/{11.16 => 11.17}/extra/int8.out (100%) rename expected/{11.16 => 11.17}/extra/join.out (100%) rename expected/{11.16 => 11.17}/extra/limit.out (100%) rename expected/{11.16 => 11.17}/extra/numeric.out (100%) rename expected/{11.16 => 11.17}/extra/prepare.out (100%) rename expected/{11.16 => 11.17}/extra/select.out (100%) rename expected/{11.16 => 11.17}/extra/select_having.out (100%) rename expected/{11.16 => 11.17}/extra/sqlite_fdw_post.out (100%) rename expected/{11.16 => 11.17}/extra/timestamp.out (100%) rename expected/{11.16 => 11.17}/extra/update.out (100%) rename expected/{11.16 => 11.17}/selectfunc.out (100%) rename expected/{11.16 => 11.17}/sqlite_fdw.out (99%) rename expected/{11.16 => 11.17}/type.out (100%) rename expected/{12.11 => 12.12}/aggregate.out (100%) rename expected/{12.11 => 12.12}/extra/aggregates.out (100%) rename expected/{12.11 => 12.12}/extra/float4.out (100%) rename expected/{12.11 => 12.12}/extra/float8.out (100%) rename expected/{12.11 => 12.12}/extra/insert.out (100%) rename expected/{12.11 => 12.12}/extra/int4.out (100%) rename expected/{12.11 => 12.12}/extra/int8.out (100%) rename expected/{12.11 => 12.12}/extra/join.out (100%) rename expected/{12.11 => 12.12}/extra/limit.out (100%) rename expected/{12.11 => 12.12}/extra/numeric.out (100%) rename expected/{12.11 => 12.12}/extra/prepare.out (100%) rename expected/{12.11 => 12.12}/extra/select.out (100%) rename expected/{12.11 => 12.12}/extra/select_having.out (100%) rename expected/{12.11 => 12.12}/extra/sqlite_fdw_post.out (100%) rename expected/{12.11 => 12.12}/extra/timestamp.out (100%) rename expected/{12.11 => 12.12}/extra/update.out (100%) rename expected/{12.11 => 12.12}/selectfunc.out (100%) rename expected/{12.11 => 12.12}/sqlite_fdw.out (99%) rename expected/{12.11 => 12.12}/type.out (100%) rename expected/{13.7 => 13.8}/aggregate.out (100%) rename expected/{13.7 => 13.8}/extra/aggregates.out (100%) rename expected/{13.7 => 13.8}/extra/float4.out (100%) rename expected/{13.7 => 13.8}/extra/float8.out (100%) rename expected/{13.7 => 13.8}/extra/insert.out (100%) rename expected/{13.7 => 13.8}/extra/int4.out (100%) rename expected/{13.7 => 13.8}/extra/int8.out (100%) rename expected/{13.7 => 13.8}/extra/join.out (100%) rename expected/{13.7 => 13.8}/extra/limit.out (100%) rename expected/{13.7 => 13.8}/extra/numeric.out (100%) rename expected/{13.7 => 13.8}/extra/prepare.out (100%) rename expected/{13.7 => 13.8}/extra/select.out (100%) rename expected/{13.7 => 13.8}/extra/select_having.out (100%) rename expected/{13.7 => 13.8}/extra/sqlite_fdw_post.out (100%) rename expected/{13.7 => 13.8}/extra/timestamp.out (100%) rename expected/{13.7 => 13.8}/extra/update.out (100%) rename expected/{13.7 => 13.8}/selectfunc.out (100%) rename expected/{13.7 => 13.8}/sqlite_fdw.out (99%) rename expected/{13.7 => 13.8}/type.out (100%) rename expected/{14.4 => 14.5}/aggregate.out (100%) rename expected/{14.4 => 14.5}/extra/aggregates.out (100%) rename expected/{14.4 => 14.5}/extra/float4.out (100%) rename expected/{14.4 => 14.5}/extra/float8.out (100%) rename expected/{14.4 => 14.5}/extra/insert.out (100%) rename expected/{14.4 => 14.5}/extra/int4.out (100%) rename expected/{14.4 => 14.5}/extra/int8.out (100%) rename expected/{14.4 => 14.5}/extra/join.out (100%) rename expected/{14.4 => 14.5}/extra/limit.out (100%) rename expected/{14.4 => 14.5}/extra/numeric.out (100%) rename expected/{14.4 => 14.5}/extra/prepare.out (100%) rename expected/{14.4 => 14.5}/extra/select.out (100%) rename expected/{14.4 => 14.5}/extra/select_having.out (100%) rename expected/{14.4 => 14.5}/extra/sqlite_fdw_post.out (100%) rename expected/{14.4 => 14.5}/extra/timestamp.out (100%) rename expected/{14.4 => 14.5}/extra/update.out (100%) rename expected/{14.4 => 14.5}/selectfunc.out (100%) rename expected/{15beta2 => 14.5}/sqlite_fdw.out (99%) rename expected/{14.4 => 14.5}/type.out (100%) rename expected/{15beta2 => 15.0}/aggregate.out (100%) rename expected/{15beta2 => 15.0}/extra/aggregates.out (96%) rename expected/{15beta2 => 15.0}/extra/float4.out (100%) rename expected/{15beta2 => 15.0}/extra/float8.out (100%) rename expected/{15beta2 => 15.0}/extra/insert.out (100%) rename expected/{15beta2 => 15.0}/extra/int4.out (100%) rename expected/{15beta2 => 15.0}/extra/int8.out (100%) rename expected/{15beta2 => 15.0}/extra/join.out (97%) rename expected/{15beta2 => 15.0}/extra/limit.out (100%) rename expected/{15beta2 => 15.0}/extra/numeric.out (100%) rename expected/{15beta2 => 15.0}/extra/prepare.out (100%) rename expected/{15beta2 => 15.0}/extra/select.out (100%) rename expected/{15beta2 => 15.0}/extra/select_having.out (100%) rename expected/{15beta2 => 15.0}/extra/sqlite_fdw_post.out (97%) rename expected/{15beta2 => 15.0}/extra/timestamp.out (100%) rename expected/{15beta2 => 15.0}/extra/update.out (100%) rename expected/{15beta2 => 15.0}/selectfunc.out (100%) rename expected/{14.4 => 15.0}/sqlite_fdw.out (99%) rename expected/{15beta2 => 15.0}/type.out (100%) rename sql/{11.16 => 11.17}/aggregate.sql (100%) rename sql/{11.16 => 11.17}/extra/aggregates.sql (100%) rename sql/{11.16 => 11.17}/extra/float4.sql (100%) rename sql/{11.16 => 11.17}/extra/float8.sql (100%) rename sql/{11.16 => 11.17}/extra/insert.sql (100%) rename sql/{11.16 => 11.17}/extra/int4.sql (100%) rename sql/{11.16 => 11.17}/extra/int8.sql (100%) rename sql/{11.16 => 11.17}/extra/join.sql (100%) rename sql/{11.16 => 11.17}/extra/limit.sql (100%) rename sql/{11.16 => 11.17}/extra/numeric.sql (100%) rename sql/{11.16 => 11.17}/extra/prepare.sql (100%) rename sql/{11.16 => 11.17}/extra/select.sql (100%) rename sql/{11.16 => 11.17}/extra/select_having.sql (100%) rename sql/{11.16 => 11.17}/extra/sqlite_fdw_post.sql (100%) rename sql/{11.16 => 11.17}/extra/timestamp.sql (100%) rename sql/{11.16 => 11.17}/extra/update.sql (100%) rename sql/{11.16 => 11.17}/selectfunc.sql (100%) rename sql/{11.16 => 11.17}/sqlite_fdw.sql (100%) rename sql/{11.16 => 11.17}/type.sql (100%) rename sql/{12.11 => 12.12}/aggregate.sql (100%) rename sql/{12.11 => 12.12}/extra/aggregates.sql (100%) rename sql/{12.11 => 12.12}/extra/float4.sql (100%) rename sql/{12.11 => 12.12}/extra/float8.sql (100%) rename sql/{12.11 => 12.12}/extra/insert.sql (100%) rename sql/{12.11 => 12.12}/extra/int4.sql (100%) rename sql/{12.11 => 12.12}/extra/int8.sql (100%) rename sql/{12.11 => 12.12}/extra/join.sql (100%) rename sql/{12.11 => 12.12}/extra/limit.sql (100%) rename sql/{12.11 => 12.12}/extra/numeric.sql (100%) rename sql/{12.11 => 12.12}/extra/prepare.sql (100%) rename sql/{12.11 => 12.12}/extra/select.sql (100%) rename sql/{12.11 => 12.12}/extra/select_having.sql (100%) rename sql/{12.11 => 12.12}/extra/sqlite_fdw_post.sql (100%) rename sql/{12.11 => 12.12}/extra/timestamp.sql (100%) rename sql/{12.11 => 12.12}/extra/update.sql (100%) rename sql/{12.11 => 12.12}/selectfunc.sql (100%) rename sql/{12.11 => 12.12}/sqlite_fdw.sql (100%) rename sql/{12.11 => 12.12}/type.sql (100%) rename sql/{13.7 => 13.8}/aggregate.sql (100%) rename sql/{13.7 => 13.8}/extra/aggregates.sql (100%) rename sql/{13.7 => 13.8}/extra/float4.sql (100%) rename sql/{13.7 => 13.8}/extra/float8.sql (100%) rename sql/{13.7 => 13.8}/extra/insert.sql (100%) rename sql/{13.7 => 13.8}/extra/int4.sql (100%) rename sql/{13.7 => 13.8}/extra/int8.sql (100%) rename sql/{13.7 => 13.8}/extra/join.sql (100%) rename sql/{13.7 => 13.8}/extra/limit.sql (100%) rename sql/{13.7 => 13.8}/extra/numeric.sql (100%) rename sql/{13.7 => 13.8}/extra/prepare.sql (100%) rename sql/{13.7 => 13.8}/extra/select.sql (100%) rename sql/{13.7 => 13.8}/extra/select_having.sql (100%) rename sql/{13.7 => 13.8}/extra/sqlite_fdw_post.sql (100%) rename sql/{13.7 => 13.8}/extra/timestamp.sql (100%) rename sql/{13.7 => 13.8}/extra/update.sql (100%) rename sql/{13.7 => 13.8}/selectfunc.sql (100%) rename sql/{13.7 => 13.8}/sqlite_fdw.sql (100%) rename sql/{13.7 => 13.8}/type.sql (100%) rename sql/{14.4 => 14.5}/aggregate.sql (100%) rename sql/{14.4 => 14.5}/extra/aggregates.sql (100%) rename sql/{14.4 => 14.5}/extra/float4.sql (100%) rename sql/{14.4 => 14.5}/extra/float8.sql (100%) rename sql/{14.4 => 14.5}/extra/insert.sql (100%) rename sql/{14.4 => 14.5}/extra/int4.sql (100%) rename sql/{14.4 => 14.5}/extra/int8.sql (100%) rename sql/{14.4 => 14.5}/extra/join.sql (100%) rename sql/{14.4 => 14.5}/extra/limit.sql (100%) rename sql/{14.4 => 14.5}/extra/numeric.sql (100%) rename sql/{14.4 => 14.5}/extra/prepare.sql (100%) rename sql/{14.4 => 14.5}/extra/select.sql (100%) rename sql/{14.4 => 14.5}/extra/select_having.sql (100%) rename sql/{14.4 => 14.5}/extra/sqlite_fdw_post.sql (100%) rename sql/{14.4 => 14.5}/extra/timestamp.sql (100%) rename sql/{14.4 => 14.5}/extra/update.sql (100%) rename sql/{14.4 => 14.5}/selectfunc.sql (100%) rename sql/{14.4 => 14.5}/sqlite_fdw.sql (100%) rename sql/{14.4 => 14.5}/type.sql (100%) rename sql/{15beta2 => 15.0}/aggregate.sql (100%) rename sql/{15beta2 => 15.0}/extra/aggregates.sql (96%) rename sql/{15beta2 => 15.0}/extra/float4.sql (100%) rename sql/{15beta2 => 15.0}/extra/float8.sql (100%) rename sql/{15beta2 => 15.0}/extra/insert.sql (100%) rename sql/{15beta2 => 15.0}/extra/int4.sql (100%) rename sql/{15beta2 => 15.0}/extra/int8.sql (100%) rename sql/{15beta2 => 15.0}/extra/join.sql (99%) rename sql/{15beta2 => 15.0}/extra/limit.sql (100%) rename sql/{15beta2 => 15.0}/extra/numeric.sql (100%) rename sql/{15beta2 => 15.0}/extra/prepare.sql (100%) rename sql/{15beta2 => 15.0}/extra/select.sql (100%) rename sql/{15beta2 => 15.0}/extra/select_having.sql (100%) rename sql/{15beta2 => 15.0}/extra/sqlite_fdw_post.sql (98%) rename sql/{15beta2 => 15.0}/extra/timestamp.sql (100%) rename sql/{15beta2 => 15.0}/extra/update.sql (100%) rename sql/{15beta2 => 15.0}/selectfunc.sql (100%) rename sql/{15beta2 => 15.0}/sqlite_fdw.sql (100%) rename sql/{15beta2 => 15.0}/type.sql (100%) diff --git a/META.json b/META.json index 9e429738..7adcd382 100644 --- a/META.json +++ b/META.json @@ -2,7 +2,7 @@ "name": "sqlite_fdw", "abstract": "Foreign Data Wrapper for SQLite databases", "description": "PostgreSQL extension which implements a Foreign Data Wrapper (FDW) for SQLite databases.", - "version": "2.2.0", + "version": "2.3.0", "maintainer": "pgspider", "license": "postgresql", "provides": { @@ -10,7 +10,7 @@ "abstract": "Foreign Data Wrapper for SQLite databases", "file": "sqlite_fdw.c", "docfile": "README.md", - "version": "2.2.0" + "version": "2.3.0" } }, "prereqs": { diff --git a/README.md b/README.md index 8f6f31ae..0f845627 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ SELECT * FROM t1; - SQLite FDW only supports ARRAY const, for example, ANY (ARRAY[1, 2, 3]) or ANY ('{1, 2 ,3}'). SQlite FDW does not support ARRAY expression, for example, ANY (ARRAY[c1, 1, c1+0]). For ANY(ARRAY) clause, SQLite FDW deparses it using IN operator. - For sum function of SQLite, output of sum(bigint) is integer value. If input values are big, the overflow error may occurs on SQLite because it overflow within the range of signed 64bit. For PostgreSQL, it can calculate as over the precision of bigint, so overflow does not occur. - SQLite promises to preserve the 15 most significant digits of a floating point value. The big value which exceed 15 most significant digits may become different value after inserted. +- SQLite does not support Numeric type as PostgreSQL. Therefore, it does not allow to store numbers with too high precision and scale. Error out of range occurs. ## Contributing Opening issues and pull requests on GitHub are welcome. diff --git a/connection.c b/connection.c index 9177ed2c..ce94ee92 100644 --- a/connection.c +++ b/connection.c @@ -66,7 +66,7 @@ PG_FUNCTION_INFO_V1(sqlite_fdw_disconnect); PG_FUNCTION_INFO_V1(sqlite_fdw_disconnect_all); static void sqlite_make_new_connection(ConnCacheEntry *entry, ForeignServer *server); -void sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level); +void sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level, List **busy_connection); static void sqlite_begin_remote_xact(ConnCacheEntry *entry); static void sqlitefdw_xact_callback(XactEvent event, void *arg); static void sqlitefdw_reset_xact_state(ConnCacheEntry *entry, bool toplevel); @@ -75,13 +75,20 @@ static void sqlitefdw_subxact_callback(SubXactEvent event, SubTransactionId parentSubid, void *arg); static void sqlitefdw_inval_callback(Datum arg, int cacheid, uint32 hashvalue); -static void sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel); +static void sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel, List **busy_connection); #if PG_VERSION_NUM >= 140000 static bool sqlite_disconnect_cached_connections(Oid serverid); #endif static void sqlite_finalize_list_stmt(List **list); static List *sqlite_append_stmt_to_list(List *list, sqlite3_stmt * stmt); +typedef struct BusyHandlerArg +{ + sqlite3 *conn; + const char *sql; + int level; +} BusyHandlerArg; + /* * sqlite_get_connection: * Get a connection which can be used to execute queries on @@ -264,18 +271,33 @@ sqlite_cleanup_connection(void) } } - /* * Convenience subroutine to issue a non-data-returning SQL command to remote */ void -sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level) +sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level, List **busy_connection) { char *err = NULL; + int rc; elog(DEBUG3, "sqlite_fdw do_sql_command %s", sql); - if (sqlite3_exec(conn, sql, NULL, NULL, &err) != SQLITE_OK) + rc = sqlite3_exec(conn, sql, NULL, NULL, &err); + + if (busy_connection && rc == SQLITE_BUSY) + { + /* Busy case will be handled later, not here */ + BusyHandlerArg *arg = palloc0(sizeof(BusyHandlerArg)); + + arg->conn = conn; + arg->sql = sql; + arg->level = level; + *busy_connection = lappend(*busy_connection, arg); + + return; + } + + if (rc != SQLITE_OK) { char *perr = NULL; @@ -319,7 +341,7 @@ sqlite_begin_remote_xact(ConnCacheEntry *entry) sql = "BEGIN"; - sqlite_do_sql_command(entry->conn, sql, ERROR); + sqlite_do_sql_command(entry->conn, sql, ERROR, NULL); entry->xact_depth = 1; } @@ -334,7 +356,7 @@ sqlite_begin_remote_xact(ConnCacheEntry *entry) char sql[64]; snprintf(sql, sizeof(sql), "SAVEPOINT s%d", entry->xact_depth + 1); - sqlite_do_sql_command(entry->conn, sql, ERROR); + sqlite_do_sql_command(entry->conn, sql, ERROR, NULL); entry->xact_depth++; } } @@ -377,6 +399,8 @@ sqlitefdw_xact_callback(XactEvent event, void *arg) { HASH_SEQ_STATUS scan; ConnCacheEntry *entry; + ListCell *lc; + List *busy_connection = NIL; /* Quick exit if no connections were touched in this transaction. */ if (!xact_got_connection) @@ -408,7 +432,7 @@ sqlitefdw_xact_callback(XactEvent event, void *arg) /* Commit all remote transactions during pre-commit */ if (!sqlite3_get_autocommit(entry->conn)) - sqlite_do_sql_command(entry->conn, "COMMIT", ERROR); + sqlite_do_sql_command(entry->conn, "COMMIT", ERROR, &busy_connection); /* Finalize all prepared statements */ sqlite_finalize_list_stmt(&entry->stmtList); break; @@ -436,7 +460,7 @@ sqlitefdw_xact_callback(XactEvent event, void *arg) case XACT_EVENT_PARALLEL_ABORT: case XACT_EVENT_ABORT: { - sqlitefdw_abort_cleanup(entry, true); + sqlitefdw_abort_cleanup(entry, true, &busy_connection); break; } } @@ -446,6 +470,20 @@ sqlitefdw_xact_callback(XactEvent event, void *arg) sqlitefdw_reset_xact_state(entry, true); } + /* Execute again the query after server is available */ + foreach(lc, busy_connection) + { + BusyHandlerArg *arg = lfirst(lc); + + /* + * If there is still error, we can not do anything more, just raise it. + * requireBusyHandler is set to false, and NULL busy_connection list. + */ + sqlite_do_sql_command(arg->conn, arg->sql, arg->level, NULL); + } + + list_free(busy_connection); + /* * Regardless of the event type, we can now mark ourselves as out of the * transaction. (Note: if we are here during PRE_COMMIT or PRE_PREPARE, @@ -491,6 +529,8 @@ sqlitefdw_subxact_callback(SubXactEvent event, SubTransactionId mySubid, HASH_SEQ_STATUS scan; ConnCacheEntry *entry; int curlevel; + ListCell *lc; + List *busy_connection = NIL; /* Nothing to do at subxact start, nor after commit. */ if (!(event == SUBXACT_EVENT_PRE_COMMIT_SUB || @@ -529,7 +569,7 @@ sqlitefdw_subxact_callback(SubXactEvent event, SubTransactionId mySubid, { /* Commit all remote subtransactions during pre-commit */ snprintf(sql, sizeof(sql), "RELEASE SAVEPOINT s%d", curlevel); - sqlite_do_sql_command(entry->conn, sql, ERROR); + sqlite_do_sql_command(entry->conn, sql, ERROR, &busy_connection); } else if (in_error_recursion_trouble()) @@ -542,12 +582,26 @@ sqlitefdw_subxact_callback(SubXactEvent event, SubTransactionId mySubid, else { /* Rollback all remote subtransactions during abort */ - sqlitefdw_abort_cleanup(entry, false); + sqlitefdw_abort_cleanup(entry, false, &busy_connection); } /* OK, we're outta that level of subtransaction */ sqlitefdw_reset_xact_state(entry, false); } + + /* Execute again the query after server is available */ + foreach(lc, busy_connection) + { + BusyHandlerArg *arg = lfirst(lc); + + /* + * If there is still error, we can not do anything more, just raise it. + * requireBusyHandler is set to false, and NULL busy_connection list. + */ + sqlite_do_sql_command(arg->conn, arg->sql, arg->level, NULL); + } + + list_free(busy_connection); } /* @@ -812,7 +866,7 @@ sqlite_fdw_disconnect_all(PG_FUNCTION_ARGS) * rollbacked, false otherwise. */ static void -sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel) +sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel, List **busy_connection) { if (toplevel) { @@ -826,7 +880,7 @@ sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel) * already rollback */ if (!sqlite3_get_autocommit(entry->conn)) - sqlite_do_sql_command(entry->conn, "ROLLBACK", WARNING); + sqlite_do_sql_command(entry->conn, "ROLLBACK", WARNING, busy_connection); } else { @@ -836,7 +890,7 @@ sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel) "ROLLBACK TO SAVEPOINT s%d; RELEASE SAVEPOINT s%d", curlevel, curlevel); if (!sqlite3_get_autocommit(entry->conn)) - sqlite_do_sql_command(entry->conn, sql, ERROR); + sqlite_do_sql_command(entry->conn, sql, ERROR, busy_connection); } } diff --git a/expected/11.16/aggregate.out b/expected/11.17/aggregate.out similarity index 100% rename from expected/11.16/aggregate.out rename to expected/11.17/aggregate.out diff --git a/expected/11.16/extra/aggregates.out b/expected/11.17/extra/aggregates.out similarity index 100% rename from expected/11.16/extra/aggregates.out rename to expected/11.17/extra/aggregates.out diff --git a/expected/11.16/extra/float4.out b/expected/11.17/extra/float4.out similarity index 100% rename from expected/11.16/extra/float4.out rename to expected/11.17/extra/float4.out diff --git a/expected/11.16/extra/float8.out b/expected/11.17/extra/float8.out similarity index 100% rename from expected/11.16/extra/float8.out rename to expected/11.17/extra/float8.out diff --git a/expected/11.16/extra/insert.out b/expected/11.17/extra/insert.out similarity index 100% rename from expected/11.16/extra/insert.out rename to expected/11.17/extra/insert.out diff --git a/expected/11.16/extra/int4.out b/expected/11.17/extra/int4.out similarity index 100% rename from expected/11.16/extra/int4.out rename to expected/11.17/extra/int4.out diff --git a/expected/11.16/extra/int8.out b/expected/11.17/extra/int8.out similarity index 100% rename from expected/11.16/extra/int8.out rename to expected/11.17/extra/int8.out diff --git a/expected/11.16/extra/join.out b/expected/11.17/extra/join.out similarity index 100% rename from expected/11.16/extra/join.out rename to expected/11.17/extra/join.out diff --git a/expected/11.16/extra/limit.out b/expected/11.17/extra/limit.out similarity index 100% rename from expected/11.16/extra/limit.out rename to expected/11.17/extra/limit.out diff --git a/expected/11.16/extra/numeric.out b/expected/11.17/extra/numeric.out similarity index 100% rename from expected/11.16/extra/numeric.out rename to expected/11.17/extra/numeric.out diff --git a/expected/11.16/extra/prepare.out b/expected/11.17/extra/prepare.out similarity index 100% rename from expected/11.16/extra/prepare.out rename to expected/11.17/extra/prepare.out diff --git a/expected/11.16/extra/select.out b/expected/11.17/extra/select.out similarity index 100% rename from expected/11.16/extra/select.out rename to expected/11.17/extra/select.out diff --git a/expected/11.16/extra/select_having.out b/expected/11.17/extra/select_having.out similarity index 100% rename from expected/11.16/extra/select_having.out rename to expected/11.17/extra/select_having.out diff --git a/expected/11.16/extra/sqlite_fdw_post.out b/expected/11.17/extra/sqlite_fdw_post.out similarity index 100% rename from expected/11.16/extra/sqlite_fdw_post.out rename to expected/11.17/extra/sqlite_fdw_post.out diff --git a/expected/11.16/extra/timestamp.out b/expected/11.17/extra/timestamp.out similarity index 100% rename from expected/11.16/extra/timestamp.out rename to expected/11.17/extra/timestamp.out diff --git a/expected/11.16/extra/update.out b/expected/11.17/extra/update.out similarity index 100% rename from expected/11.16/extra/update.out rename to expected/11.17/extra/update.out diff --git a/expected/11.16/selectfunc.out b/expected/11.17/selectfunc.out similarity index 100% rename from expected/11.16/selectfunc.out rename to expected/11.17/selectfunc.out diff --git a/expected/11.16/sqlite_fdw.out b/expected/11.17/sqlite_fdw.out similarity index 99% rename from expected/11.16/sqlite_fdw.out rename to expected/11.17/sqlite_fdw.out index a9b8ea58..65e2515d 100644 --- a/expected/11.16/sqlite_fdw.out +++ b/expected/11.17/sqlite_fdw.out @@ -1473,14 +1473,14 @@ SELECT * FROM noprimary; SELECT * FROM public.sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) --Testcase 155: SELECT sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) -- issue #44 github diff --git a/expected/11.16/type.out b/expected/11.17/type.out similarity index 100% rename from expected/11.16/type.out rename to expected/11.17/type.out diff --git a/expected/12.11/aggregate.out b/expected/12.12/aggregate.out similarity index 100% rename from expected/12.11/aggregate.out rename to expected/12.12/aggregate.out diff --git a/expected/12.11/extra/aggregates.out b/expected/12.12/extra/aggregates.out similarity index 100% rename from expected/12.11/extra/aggregates.out rename to expected/12.12/extra/aggregates.out diff --git a/expected/12.11/extra/float4.out b/expected/12.12/extra/float4.out similarity index 100% rename from expected/12.11/extra/float4.out rename to expected/12.12/extra/float4.out diff --git a/expected/12.11/extra/float8.out b/expected/12.12/extra/float8.out similarity index 100% rename from expected/12.11/extra/float8.out rename to expected/12.12/extra/float8.out diff --git a/expected/12.11/extra/insert.out b/expected/12.12/extra/insert.out similarity index 100% rename from expected/12.11/extra/insert.out rename to expected/12.12/extra/insert.out diff --git a/expected/12.11/extra/int4.out b/expected/12.12/extra/int4.out similarity index 100% rename from expected/12.11/extra/int4.out rename to expected/12.12/extra/int4.out diff --git a/expected/12.11/extra/int8.out b/expected/12.12/extra/int8.out similarity index 100% rename from expected/12.11/extra/int8.out rename to expected/12.12/extra/int8.out diff --git a/expected/12.11/extra/join.out b/expected/12.12/extra/join.out similarity index 100% rename from expected/12.11/extra/join.out rename to expected/12.12/extra/join.out diff --git a/expected/12.11/extra/limit.out b/expected/12.12/extra/limit.out similarity index 100% rename from expected/12.11/extra/limit.out rename to expected/12.12/extra/limit.out diff --git a/expected/12.11/extra/numeric.out b/expected/12.12/extra/numeric.out similarity index 100% rename from expected/12.11/extra/numeric.out rename to expected/12.12/extra/numeric.out diff --git a/expected/12.11/extra/prepare.out b/expected/12.12/extra/prepare.out similarity index 100% rename from expected/12.11/extra/prepare.out rename to expected/12.12/extra/prepare.out diff --git a/expected/12.11/extra/select.out b/expected/12.12/extra/select.out similarity index 100% rename from expected/12.11/extra/select.out rename to expected/12.12/extra/select.out diff --git a/expected/12.11/extra/select_having.out b/expected/12.12/extra/select_having.out similarity index 100% rename from expected/12.11/extra/select_having.out rename to expected/12.12/extra/select_having.out diff --git a/expected/12.11/extra/sqlite_fdw_post.out b/expected/12.12/extra/sqlite_fdw_post.out similarity index 100% rename from expected/12.11/extra/sqlite_fdw_post.out rename to expected/12.12/extra/sqlite_fdw_post.out diff --git a/expected/12.11/extra/timestamp.out b/expected/12.12/extra/timestamp.out similarity index 100% rename from expected/12.11/extra/timestamp.out rename to expected/12.12/extra/timestamp.out diff --git a/expected/12.11/extra/update.out b/expected/12.12/extra/update.out similarity index 100% rename from expected/12.11/extra/update.out rename to expected/12.12/extra/update.out diff --git a/expected/12.11/selectfunc.out b/expected/12.12/selectfunc.out similarity index 100% rename from expected/12.11/selectfunc.out rename to expected/12.12/selectfunc.out diff --git a/expected/12.11/sqlite_fdw.out b/expected/12.12/sqlite_fdw.out similarity index 99% rename from expected/12.11/sqlite_fdw.out rename to expected/12.12/sqlite_fdw.out index a9b8ea58..65e2515d 100644 --- a/expected/12.11/sqlite_fdw.out +++ b/expected/12.12/sqlite_fdw.out @@ -1473,14 +1473,14 @@ SELECT * FROM noprimary; SELECT * FROM public.sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) --Testcase 155: SELECT sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) -- issue #44 github diff --git a/expected/12.11/type.out b/expected/12.12/type.out similarity index 100% rename from expected/12.11/type.out rename to expected/12.12/type.out diff --git a/expected/13.7/aggregate.out b/expected/13.8/aggregate.out similarity index 100% rename from expected/13.7/aggregate.out rename to expected/13.8/aggregate.out diff --git a/expected/13.7/extra/aggregates.out b/expected/13.8/extra/aggregates.out similarity index 100% rename from expected/13.7/extra/aggregates.out rename to expected/13.8/extra/aggregates.out diff --git a/expected/13.7/extra/float4.out b/expected/13.8/extra/float4.out similarity index 100% rename from expected/13.7/extra/float4.out rename to expected/13.8/extra/float4.out diff --git a/expected/13.7/extra/float8.out b/expected/13.8/extra/float8.out similarity index 100% rename from expected/13.7/extra/float8.out rename to expected/13.8/extra/float8.out diff --git a/expected/13.7/extra/insert.out b/expected/13.8/extra/insert.out similarity index 100% rename from expected/13.7/extra/insert.out rename to expected/13.8/extra/insert.out diff --git a/expected/13.7/extra/int4.out b/expected/13.8/extra/int4.out similarity index 100% rename from expected/13.7/extra/int4.out rename to expected/13.8/extra/int4.out diff --git a/expected/13.7/extra/int8.out b/expected/13.8/extra/int8.out similarity index 100% rename from expected/13.7/extra/int8.out rename to expected/13.8/extra/int8.out diff --git a/expected/13.7/extra/join.out b/expected/13.8/extra/join.out similarity index 100% rename from expected/13.7/extra/join.out rename to expected/13.8/extra/join.out diff --git a/expected/13.7/extra/limit.out b/expected/13.8/extra/limit.out similarity index 100% rename from expected/13.7/extra/limit.out rename to expected/13.8/extra/limit.out diff --git a/expected/13.7/extra/numeric.out b/expected/13.8/extra/numeric.out similarity index 100% rename from expected/13.7/extra/numeric.out rename to expected/13.8/extra/numeric.out diff --git a/expected/13.7/extra/prepare.out b/expected/13.8/extra/prepare.out similarity index 100% rename from expected/13.7/extra/prepare.out rename to expected/13.8/extra/prepare.out diff --git a/expected/13.7/extra/select.out b/expected/13.8/extra/select.out similarity index 100% rename from expected/13.7/extra/select.out rename to expected/13.8/extra/select.out diff --git a/expected/13.7/extra/select_having.out b/expected/13.8/extra/select_having.out similarity index 100% rename from expected/13.7/extra/select_having.out rename to expected/13.8/extra/select_having.out diff --git a/expected/13.7/extra/sqlite_fdw_post.out b/expected/13.8/extra/sqlite_fdw_post.out similarity index 100% rename from expected/13.7/extra/sqlite_fdw_post.out rename to expected/13.8/extra/sqlite_fdw_post.out diff --git a/expected/13.7/extra/timestamp.out b/expected/13.8/extra/timestamp.out similarity index 100% rename from expected/13.7/extra/timestamp.out rename to expected/13.8/extra/timestamp.out diff --git a/expected/13.7/extra/update.out b/expected/13.8/extra/update.out similarity index 100% rename from expected/13.7/extra/update.out rename to expected/13.8/extra/update.out diff --git a/expected/13.7/selectfunc.out b/expected/13.8/selectfunc.out similarity index 100% rename from expected/13.7/selectfunc.out rename to expected/13.8/selectfunc.out diff --git a/expected/13.7/sqlite_fdw.out b/expected/13.8/sqlite_fdw.out similarity index 99% rename from expected/13.7/sqlite_fdw.out rename to expected/13.8/sqlite_fdw.out index a9b8ea58..65e2515d 100644 --- a/expected/13.7/sqlite_fdw.out +++ b/expected/13.8/sqlite_fdw.out @@ -1473,14 +1473,14 @@ SELECT * FROM noprimary; SELECT * FROM public.sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) --Testcase 155: SELECT sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) -- issue #44 github diff --git a/expected/13.7/type.out b/expected/13.8/type.out similarity index 100% rename from expected/13.7/type.out rename to expected/13.8/type.out diff --git a/expected/14.4/aggregate.out b/expected/14.5/aggregate.out similarity index 100% rename from expected/14.4/aggregate.out rename to expected/14.5/aggregate.out diff --git a/expected/14.4/extra/aggregates.out b/expected/14.5/extra/aggregates.out similarity index 100% rename from expected/14.4/extra/aggregates.out rename to expected/14.5/extra/aggregates.out diff --git a/expected/14.4/extra/float4.out b/expected/14.5/extra/float4.out similarity index 100% rename from expected/14.4/extra/float4.out rename to expected/14.5/extra/float4.out diff --git a/expected/14.4/extra/float8.out b/expected/14.5/extra/float8.out similarity index 100% rename from expected/14.4/extra/float8.out rename to expected/14.5/extra/float8.out diff --git a/expected/14.4/extra/insert.out b/expected/14.5/extra/insert.out similarity index 100% rename from expected/14.4/extra/insert.out rename to expected/14.5/extra/insert.out diff --git a/expected/14.4/extra/int4.out b/expected/14.5/extra/int4.out similarity index 100% rename from expected/14.4/extra/int4.out rename to expected/14.5/extra/int4.out diff --git a/expected/14.4/extra/int8.out b/expected/14.5/extra/int8.out similarity index 100% rename from expected/14.4/extra/int8.out rename to expected/14.5/extra/int8.out diff --git a/expected/14.4/extra/join.out b/expected/14.5/extra/join.out similarity index 100% rename from expected/14.4/extra/join.out rename to expected/14.5/extra/join.out diff --git a/expected/14.4/extra/limit.out b/expected/14.5/extra/limit.out similarity index 100% rename from expected/14.4/extra/limit.out rename to expected/14.5/extra/limit.out diff --git a/expected/14.4/extra/numeric.out b/expected/14.5/extra/numeric.out similarity index 100% rename from expected/14.4/extra/numeric.out rename to expected/14.5/extra/numeric.out diff --git a/expected/14.4/extra/prepare.out b/expected/14.5/extra/prepare.out similarity index 100% rename from expected/14.4/extra/prepare.out rename to expected/14.5/extra/prepare.out diff --git a/expected/14.4/extra/select.out b/expected/14.5/extra/select.out similarity index 100% rename from expected/14.4/extra/select.out rename to expected/14.5/extra/select.out diff --git a/expected/14.4/extra/select_having.out b/expected/14.5/extra/select_having.out similarity index 100% rename from expected/14.4/extra/select_having.out rename to expected/14.5/extra/select_having.out diff --git a/expected/14.4/extra/sqlite_fdw_post.out b/expected/14.5/extra/sqlite_fdw_post.out similarity index 100% rename from expected/14.4/extra/sqlite_fdw_post.out rename to expected/14.5/extra/sqlite_fdw_post.out diff --git a/expected/14.4/extra/timestamp.out b/expected/14.5/extra/timestamp.out similarity index 100% rename from expected/14.4/extra/timestamp.out rename to expected/14.5/extra/timestamp.out diff --git a/expected/14.4/extra/update.out b/expected/14.5/extra/update.out similarity index 100% rename from expected/14.4/extra/update.out rename to expected/14.5/extra/update.out diff --git a/expected/14.4/selectfunc.out b/expected/14.5/selectfunc.out similarity index 100% rename from expected/14.4/selectfunc.out rename to expected/14.5/selectfunc.out diff --git a/expected/15beta2/sqlite_fdw.out b/expected/14.5/sqlite_fdw.out similarity index 99% rename from expected/15beta2/sqlite_fdw.out rename to expected/14.5/sqlite_fdw.out index e4b46009..356f7c77 100644 --- a/expected/15beta2/sqlite_fdw.out +++ b/expected/14.5/sqlite_fdw.out @@ -1455,14 +1455,14 @@ SELECT * FROM noprimary; SELECT * FROM public.sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) --Testcase 155: SELECT sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) -- issue #44 github diff --git a/expected/14.4/type.out b/expected/14.5/type.out similarity index 100% rename from expected/14.4/type.out rename to expected/14.5/type.out diff --git a/expected/15beta2/aggregate.out b/expected/15.0/aggregate.out similarity index 100% rename from expected/15beta2/aggregate.out rename to expected/15.0/aggregate.out diff --git a/expected/15beta2/extra/aggregates.out b/expected/15.0/extra/aggregates.out similarity index 96% rename from expected/15beta2/extra/aggregates.out rename to expected/15.0/extra/aggregates.out index f1f893fe..081834da 100644 --- a/expected/15beta2/extra/aggregates.out +++ b/expected/15.0/extra/aggregates.out @@ -69,196 +69,6 @@ CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true'), b int, c text) S CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')) SERVER sqlite_svr; --Testcase 276: CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')) SERVER sqlite_svr; --- GROUP BY optimization by reorder columns ---Testcase 678: -CREATE FOREIGN TABLE btg(id int, p int, v text, c float, d float, e int) SERVER sqlite_svr; ---Testcase 679: -INSERT INTO btg -SELECT - i, - i/2, - format('%60s', i%2), - i/4, - i/8, - (random() * (10000/8))::int --the same as d but no correlation with p -FROM - generate_series(1, 10000) i; --- VACUUM btg; --- ANALYZE btg; --- GROUP BY optimization by reorder columns by frequency -SET enable_hashagg=off; -SET max_parallel_workers= 0; -SET max_parallel_workers_per_gather = 0; ---Testcase 680: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 681: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 682: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 683: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c ORDER BY v, p, c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 684: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 685: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c ORDER BY v, p, d ,c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 686: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c ORDER BY p, v, d ,c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 687: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, d, e; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 688: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, e, d; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 689: -CREATE STATISTICS btg_dep ON d, e, p FROM btg; --- ANALYZE btg; ---Testcase 690: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, d, e; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 691: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, e, d; - QUERY PLAN --------------- - Foreign Scan -(1 row) - --- GROUP BY optimization by reorder columns by index scan ---Testcase 692: -CREATE INDEX ON btg(p, v); -ERROR: cannot create index on relation "btg" -DETAIL: This operation is not supported for foreign tables. -SET enable_seqscan=off; -SET enable_bitmapscan=off; --- VACUUM btg; ---Testcase 693: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 694: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v ORDER BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 695: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 696: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p ORDER BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 697: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 698: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c ORDER BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 699: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, c, p, d; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 700: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, c, p, d ORDER BY p, v; - QUERY PLAN --------------- - Foreign Scan -(1 row) - ---Testcase 701: -DROP FOREIGN TABLE btg; -RESET enable_hashagg; -RESET max_parallel_workers; -RESET max_parallel_workers_per_gather; -RESET enable_seqscan; -RESET enable_bitmapscan; -- avoid bit-exact output here because operations may not be bit-exact. --Testcase 588: SET extra_float_digits = 0; @@ -279,6 +89,7 @@ SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100; -- In 7.1, avg(float4) is computed using float8 arithmetic. --Testcase 3: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 678: SELECT avg(b)::numeric(10,3) AS avg_107_943 FROM aggtest; avg_107_943 ------------- @@ -287,6 +98,7 @@ SELECT avg(b)::numeric(10,3) AS avg_107_943 FROM aggtest; --Testcase 4: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 679: SELECT avg(gpa)::numeric(10,3) AS avg_3_4 FROM ONLY student; avg_3_4 --------- @@ -309,6 +121,7 @@ SELECT sum(a) AS sum_198 FROM aggtest; --Testcase 7: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 680: SELECT sum(b)::numeric(10,3) AS avg_431_773 FROM aggtest; avg_431_773 ------------- @@ -317,6 +130,7 @@ SELECT sum(b)::numeric(10,3) AS avg_431_773 FROM aggtest; --Testcase 8: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 681: SELECT sum(gpa)::numeric(10,3) AS avg_6_8 FROM ONLY student; avg_6_8 --------- @@ -353,6 +167,7 @@ SELECT max(student.gpa) AS max_3_7 FROM student; --Testcase 13: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 682: SELECT stddev_pop(b)::numeric(20,10) FROM aggtest; stddev_pop ---------------- @@ -361,6 +176,7 @@ SELECT stddev_pop(b)::numeric(20,10) FROM aggtest; --Testcase 14: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 683: SELECT stddev_samp(b)::numeric(20,10) FROM aggtest; stddev_samp ---------------- @@ -369,6 +185,7 @@ SELECT stddev_samp(b)::numeric(20,10) FROM aggtest; --Testcase 15: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 684: SELECT var_pop(b)::numeric(20,10) FROM aggtest; var_pop ------------------ @@ -377,6 +194,7 @@ SELECT var_pop(b)::numeric(20,10) FROM aggtest; --Testcase 16: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 685: SELECT var_samp(b)::numeric(20,10) FROM aggtest; var_samp ------------------ @@ -827,6 +645,7 @@ SELECT regr_sxx(b, a) FROM aggtest; --Testcase 23: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 686: SELECT regr_syy(b, a)::numeric(20,10) FROM aggtest; regr_syy ------------------ @@ -835,6 +654,7 @@ SELECT regr_syy(b, a)::numeric(20,10) FROM aggtest; --Testcase 24: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 687: SELECT regr_sxy(b, a)::numeric(20,10) FROM aggtest; regr_sxy ----------------- @@ -843,6 +663,7 @@ SELECT regr_sxy(b, a)::numeric(20,10) FROM aggtest; --Testcase 25: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 688: SELECT regr_avgx(b, a), regr_avgy(b, a)::numeric(20,10) FROM aggtest; regr_avgx | regr_avgy -----------+---------------- @@ -851,6 +672,7 @@ SELECT regr_avgx(b, a), regr_avgy(b, a)::numeric(20,10) FROM aggtest; --Testcase 26: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 689: SELECT regr_r2(b, a)::numeric(20,10) FROM aggtest; regr_r2 -------------- @@ -859,6 +681,7 @@ SELECT regr_r2(b, a)::numeric(20,10) FROM aggtest; --Testcase 27: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 690: SELECT regr_slope(b, a)::numeric(20,10), regr_intercept(b, a)::numeric(20,10) FROM aggtest; regr_slope | regr_intercept --------------+---------------- @@ -867,6 +690,7 @@ SELECT regr_slope(b, a)::numeric(20,10), regr_intercept(b, a)::numeric(20,10) FR --Testcase 28: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 691: SELECT covar_pop(b, a)::numeric(20,10), covar_samp(b, a)::numeric(20,10) FROM aggtest; covar_pop | covar_samp ----------------+---------------- @@ -875,6 +699,7 @@ SELECT covar_pop(b, a)::numeric(20,10), covar_samp(b, a)::numeric(20,10) FROM ag --Testcase 29: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 692: SELECT corr(b, a)::numeric(20,10) FROM aggtest; corr -------------- @@ -1632,12 +1457,13 @@ select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt --Testcase 67: explain (costs off) select distinct max(unique2) from tenk1; - QUERY PLAN ------------------------------ - HashAggregate - Group Key: (max(unique2)) - -> Foreign Scan -(3 rows) + QUERY PLAN +---------------------------------- + Unique + -> Sort + Sort Key: (max(unique2)) + -> Foreign Scan +(4 rows) --Testcase 68: select distinct max(unique2) from tenk1; @@ -2632,6 +2458,7 @@ LINE 1: select f1, percentile_cont(f1,f1) -- error rollback; --Testcase 179: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 693: select (percentile_cont(0.5) within group (order by b))::numeric(20,10) from aggtest; percentile_cont ----------------- @@ -2640,6 +2467,7 @@ select (percentile_cont(0.5) within group (order by b))::numeric(20,10) from agg --Testcase 180: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 694: select (percentile_cont(0.5) within group (order by b))::numeric(20,10), sum(b)::numeric(10,3) from aggtest; percentile_cont | sum -----------------+--------- @@ -2648,6 +2476,7 @@ select (percentile_cont(0.5) within group (order by b))::numeric(20,10), sum(b): --Testcase 181: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 695: select percentile_cont(0.5) within group (order by thousand) from tenk1; percentile_cont ----------------- @@ -2684,6 +2513,7 @@ select cume_dist(3) within group (order by f1) from INT4_TBL; insert into INT4_TBL values (5); --Testcase 458: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 696: select (percent_rank(3) within group (order by f1))::numeric(20,10) from INT4_TBL; percent_rank -------------- diff --git a/expected/15beta2/extra/float4.out b/expected/15.0/extra/float4.out similarity index 100% rename from expected/15beta2/extra/float4.out rename to expected/15.0/extra/float4.out diff --git a/expected/15beta2/extra/float8.out b/expected/15.0/extra/float8.out similarity index 100% rename from expected/15beta2/extra/float8.out rename to expected/15.0/extra/float8.out diff --git a/expected/15beta2/extra/insert.out b/expected/15.0/extra/insert.out similarity index 100% rename from expected/15beta2/extra/insert.out rename to expected/15.0/extra/insert.out diff --git a/expected/15beta2/extra/int4.out b/expected/15.0/extra/int4.out similarity index 100% rename from expected/15beta2/extra/int4.out rename to expected/15.0/extra/int4.out diff --git a/expected/15beta2/extra/int8.out b/expected/15.0/extra/int8.out similarity index 100% rename from expected/15beta2/extra/int8.out rename to expected/15.0/extra/int8.out diff --git a/expected/15beta2/extra/join.out b/expected/15.0/extra/join.out similarity index 97% rename from expected/15beta2/extra/join.out rename to expected/15.0/extra/join.out index f85a9643..45b21267 100644 --- a/expected/15beta2/extra/join.out +++ b/expected/15.0/extra/join.out @@ -2124,8 +2124,8 @@ USING (name); ------+----+---- bb | 12 | 13 cc | 22 | 23 - ee | 42 | dd | | 33 + ee | 42 | (4 rows) -- Cases with non-nullable expressions in subquery results; @@ -2162,8 +2162,8 @@ NATURAL FULL JOIN ------+------+------+------+------ bb | 12 | 2 | 13 | 3 cc | 22 | 2 | 23 | 3 - ee | 42 | 2 | | dd | | | 33 | 3 + ee | 42 | 2 | | (4 rows) --Testcase 67: @@ -2716,6 +2716,44 @@ ERROR: column t12.x does not exist LINE 1: select t12.x from t12 join t32 on (t12.a = t32.x); ^ HINT: Perhaps you meant to reference the column "t32.x". +-- Test matching of locking clause with wrong alias +--Testcase 540: +select t12.*, t22.*, unnamed_join.* from + t12 join t22 on (t12.a = t22.a), t32 as unnamed_join + for update of unnamed_join; + a | b | a | b | x | y +---+---+---+---+---+--- +(0 rows) + +--Testcase 541: +select foo.*, unnamed_join.* from + t12 join t22 using (a) as foo, t32 as unnamed_join + for update of unnamed_join; + a | x | y +---+---+--- +(0 rows) + +--Testcase 542: +select foo.*, unnamed_join.* from + t12 join t22 using (a) as foo, t32 as unnamed_join + for update of foo; +ERROR: FOR UPDATE cannot be applied to a join +LINE 3: for update of foo; + ^ +--Testcase 543: +select bar.*, unnamed_join.* from + (t12 join t22 using (a) as foo) as bar, t32 as unnamed_join + for update of foo; +ERROR: relation "foo" in FOR UPDATE clause not found in FROM clause +LINE 3: for update of foo; + ^ +--Testcase 544: +select bar.*, unnamed_join.* from + (t12 join t22 using (a) as foo) as bar, t32 as unnamed_join + for update of bar; +ERROR: FOR UPDATE cannot be applied to a join +LINE 3: for update of bar; + ^ --Testcase 536: drop table t2a; -- @@ -4170,15 +4208,18 @@ select a.unique1, b.unique1, c.unique1, coalesce(b.twothousand, a.twothousand) ------------------------------------------------------------------- Hash Left Join Hash Cond: (COALESCE(b.twothousand, a.twothousand) = c.unique2) - -> Hash Right Join - Hash Cond: (b.thousand = a.unique1) + -> Merge Left Join + Merge Cond: (a.unique1 = b.thousand) Filter: (COALESCE(b.twothousand, a.twothousand) = 44) - -> Foreign Scan on tenk1 b - -> Hash + -> Sort + Sort Key: a.unique1 -> Foreign Scan on tenk1 a + -> Sort + Sort Key: b.thousand + -> Foreign Scan on tenk1 b -> Hash -> Foreign Scan on tenk1 c -(10 rows) +(13 rows) --Testcase 208: select a.unique1, b.unique1, c.unique1, coalesce(b.twothousand, a.twothousand) @@ -4350,69 +4391,63 @@ select t1.* from on (t1.f1 = b1.d1) left join int4_tbl i4 on (i8.q2 = i4.f1); - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------- - Merge Right Join + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Hash Left Join Output: t1.f1 - Merge Cond: (i4.f1 = i8.q2) - -> Sort - Output: i4.f1 - Sort Key: i4.f1 - -> Foreign Scan on public.int4_tbl i4 - Output: i4.f1 - SQLite query: SELECT `f1` FROM main."int4_tbl" - -> Materialize + Hash Cond: (i8.q2 = i4.f1) + -> Nested Loop Left Join Output: t1.f1, i8.q2 - -> Sort - Output: t1.f1, i8.q2 - Sort Key: i8.q2 - -> Nested Loop Left Join - Output: t1.f1, i8.q2 - Join Filter: (t1.f1 = '***'::text) - -> Foreign Scan on public.text_tbl t1 - Output: t1.f1 - SQLite query: SELECT `f1` FROM main."text_tbl" + Join Filter: (t1.f1 = '***'::text) + -> Foreign Scan on public.text_tbl t1 + Output: t1.f1 + SQLite query: SELECT `f1` FROM main."text_tbl" + -> Materialize + Output: i8.q2 + -> Merge Left Join + Output: i8.q2 + Merge Cond: (i8b1.q2 = (NULL::integer)) + -> Sort + Output: i8b1.q2 + Sort Key: i8b1.q2 + -> Foreign Scan on public.int8_tbl i8b1 + Output: i8b1.q2 + SQLite query: SELECT `q2` FROM main."int8_tbl" -> Materialize - Output: i8.q2 - -> Merge Left Join - Output: i8.q2 - Merge Cond: (i8b1.q2 = (NULL::integer)) - -> Sort - Output: i8b1.q2 - Sort Key: i8b1.q2 - -> Foreign Scan on public.int8_tbl i8b1 - Output: i8b1.q2 - SQLite query: SELECT `q2` FROM main."int8_tbl" - -> Materialize + Output: i8.q2, (NULL::integer) + -> Sort + Output: i8.q2, (NULL::integer) + Sort Key: (NULL::integer) + -> Merge Left Join Output: i8.q2, (NULL::integer) + Merge Cond: (i8.q1 = i8b2.q1) -> Sort - Output: i8.q2, (NULL::integer) - Sort Key: (NULL::integer) - -> Merge Left Join - Output: i8.q2, (NULL::integer) - Merge Cond: (i8.q1 = i8b2.q1) - -> Sort - Output: i8.q1, i8.q2 - Sort Key: i8.q1 - -> Foreign Scan on public.int8_tbl i8 - Output: i8.q1, i8.q2 - SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" - -> Materialize - Output: i8b2.q1, (NULL::integer) - -> Sort - Output: i8b2.q1, (NULL::integer) - Sort Key: i8b2.q1 - -> Nested Loop - Output: i8b2.q1, NULL::integer - -> Foreign Scan on public.int4_tbl i4b2 - Output: i4b2.f1 - SQLite query: SELECT NULL FROM main."int4_tbl" - -> Materialize - Output: i8b2.q1 - -> Foreign Scan on public.int8_tbl i8b2 - Output: i8b2.q1 - SQLite query: SELECT `q1` FROM main."int8_tbl" -(60 rows) + Output: i8.q1, i8.q2 + Sort Key: i8.q1 + -> Foreign Scan on public.int8_tbl i8 + Output: i8.q1, i8.q2 + SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" + -> Materialize + Output: i8b2.q1, (NULL::integer) + -> Sort + Output: i8b2.q1, (NULL::integer) + Sort Key: i8b2.q1 + -> Nested Loop + Output: i8b2.q1, NULL::integer + -> Foreign Scan on public.int4_tbl i4b2 + Output: i4b2.f1 + SQLite query: SELECT NULL FROM main."int4_tbl" + -> Materialize + Output: i8b2.q1 + -> Foreign Scan on public.int8_tbl i8b2 + Output: i8b2.q1 + SQLite query: SELECT `q1` FROM main."int8_tbl" + -> Hash + Output: i4.f1 + -> Foreign Scan on public.int4_tbl i4 + Output: i4.f1 + SQLite query: SELECT `f1` FROM main."int4_tbl" +(54 rows) --Testcase 214: select t1.* from @@ -4820,14 +4855,17 @@ explain (costs off) --Testcase 230: explain (costs off) select * from tenk1 a full join tenk1 b using(unique2) where unique2 = 42; - QUERY PLAN --------------------------------------- - Hash Full Join - Hash Cond: (a.unique2 = b.unique2) - -> Foreign Scan on tenk1 a - -> Hash + QUERY PLAN +--------------------------------------- + Merge Full Join + Merge Cond: (a.unique2 = b.unique2) + -> Sort + Sort Key: a.unique2 + -> Foreign Scan on tenk1 a + -> Sort + Sort Key: b.unique2 -> Foreign Scan on tenk1 b -(5 rows) +(8 rows) -- -- test that quals attached to an outer join have correct semantics, @@ -6266,43 +6304,37 @@ select * from ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop Output: c.q1, c.q2, a.q1, a.q2, b.q1, (COALESCE(b.q2, '42'::bigint)), d.q1, (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)), ((COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2))) - -> Merge Left Join + -> Hash Right Join Output: c.q1, c.q2, a.q1, a.q2, b.q1, d.q1, (COALESCE(b.q2, '42'::bigint)), (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) - Merge Cond: (c.q2 = d.q1) - -> Sort + Hash Cond: (d.q1 = c.q2) + -> Nested Loop + Output: a.q1, a.q2, b.q1, d.q1, (COALESCE(b.q2, '42'::bigint)), (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) + -> Merge Left Join + Output: a.q1, a.q2, b.q1, (COALESCE(b.q2, '42'::bigint)) + Merge Cond: (a.q2 = b.q1) + -> Sort + Output: a.q1, a.q2 + Sort Key: a.q2 + -> Foreign Scan on public.int8_tbl a + Output: a.q1, a.q2 + SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" + -> Sort + Output: b.q1, (COALESCE(b.q2, '42'::bigint)) + Sort Key: b.q1 + -> Foreign Scan on public.int8_tbl b + Output: b.q1, COALESCE(b.q2, '42'::bigint) + SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" + -> Foreign Scan on public.int8_tbl d + Output: d.q1, COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2) + SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" + -> Hash Output: c.q1, c.q2 - Sort Key: c.q2 -> Foreign Scan on public.int8_tbl c Output: c.q1, c.q2 SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" - -> Materialize - Output: a.q1, a.q2, b.q1, d.q1, (COALESCE(b.q2, '42'::bigint)), (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) - -> Sort - Output: a.q1, a.q2, b.q1, d.q1, (COALESCE(b.q2, '42'::bigint)), (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) - Sort Key: d.q1 - -> Nested Loop - Output: a.q1, a.q2, b.q1, d.q1, (COALESCE(b.q2, '42'::bigint)), (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) - -> Merge Left Join - Output: a.q1, a.q2, b.q1, (COALESCE(b.q2, '42'::bigint)) - Merge Cond: (a.q2 = b.q1) - -> Sort - Output: a.q1, a.q2 - Sort Key: a.q2 - -> Foreign Scan on public.int8_tbl a - Output: a.q1, a.q2 - SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" - -> Sort - Output: b.q1, (COALESCE(b.q2, '42'::bigint)) - Sort Key: b.q1 - -> Foreign Scan on public.int8_tbl b - Output: b.q1, COALESCE(b.q2, '42'::bigint) - SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" - -> Foreign Scan on public.int8_tbl d - Output: d.q1, COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2) - SQLite query: SELECT `q1`, `q2` FROM main."int8_tbl" -> Result Output: (COALESCE((COALESCE(b.q2, '42'::bigint)), d.q2)) -(38 rows) +(32 rows) -- case that breaks the old ph_may_need optimization --Testcase 462: diff --git a/expected/15beta2/extra/limit.out b/expected/15.0/extra/limit.out similarity index 100% rename from expected/15beta2/extra/limit.out rename to expected/15.0/extra/limit.out diff --git a/expected/15beta2/extra/numeric.out b/expected/15.0/extra/numeric.out similarity index 100% rename from expected/15beta2/extra/numeric.out rename to expected/15.0/extra/numeric.out diff --git a/expected/15beta2/extra/prepare.out b/expected/15.0/extra/prepare.out similarity index 100% rename from expected/15beta2/extra/prepare.out rename to expected/15.0/extra/prepare.out diff --git a/expected/15beta2/extra/select.out b/expected/15.0/extra/select.out similarity index 100% rename from expected/15beta2/extra/select.out rename to expected/15.0/extra/select.out diff --git a/expected/15beta2/extra/select_having.out b/expected/15.0/extra/select_having.out similarity index 100% rename from expected/15beta2/extra/select_having.out rename to expected/15.0/extra/select_having.out diff --git a/expected/15beta2/extra/sqlite_fdw_post.out b/expected/15.0/extra/sqlite_fdw_post.out similarity index 97% rename from expected/15beta2/extra/sqlite_fdw_post.out rename to expected/15.0/extra/sqlite_fdw_post.out index 3585f07d..c86176a8 100644 --- a/expected/15beta2/extra/sqlite_fdw_post.out +++ b/expected/15.0/extra/sqlite_fdw_post.out @@ -1147,6 +1147,30 @@ SELECT * FROM ft1 WHERE CASE c3 COLLATE "C" WHEN c6 THEN true ELSE c3 < 'bar' EN SQLite query: SELECT `C 1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8` FROM main."T 1" (4 rows) +-- check schema-qualification of regconfig constant +--Testcase 984: +CREATE TEXT SEARCH CONFIGURATION public.custom_search + (COPY = pg_catalog.english); +--Testcase 985: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM ft1 +WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0; + QUERY PLAN +-------------------------------------------------------------------------- + Foreign Scan on public.ft1 + Output: c1, to_tsvector('custom_search'::regconfig, c3) + Filter: (length(to_tsvector('custom_search'::regconfig, ft1.c3)) > 0) + SQLite query: SELECT `C 1`, `c3` FROM main."T 1" WHERE ((`C 1` = 642)) +(4 rows) + +--Testcase 986: +SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM ft1 +WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0; + c1 | to_tsvector +-----+------------- + 642 | '00642':1 +(1 row) + -- =================================================================== -- JOIN queries -- =================================================================== @@ -1580,8 +1604,8 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 --Testcase 91: EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNER JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (TRUE) ORDER BY t1.c1, ss.a, ss.b FOR UPDATE OF t1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- LockRows Output: "T 3".c1, ft4.c1, ft5.c1, "T 3".*, ft4.*, ft5.* -> Sort @@ -1592,19 +1616,25 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNE -> Foreign Scan on "S 1"."T 3" Output: "T 3".c1, "T 3".* SQLite query: SELECT `c1`, `c2`, `c3` FROM main."T 3" WHERE ((`c1` = 50)) - -> Hash Full Join + -> Materialize Output: ft4.c1, ft4.*, ft5.c1, ft5.* - Hash Cond: (ft4.c1 = ft5.c1) - Filter: ((ft4.c1 IS NULL) OR (ft4.c1 IS NOT NULL)) - -> Foreign Scan on public.ft4 - Output: ft4.c1, ft4.* - SQLite query: SELECT `c1`, `c2`, `c3` FROM main."T 3" WHERE ((`c1` >= 50)) AND ((`c1` <= 60)) - -> Hash - Output: ft5.c1, ft5.* - -> Foreign Scan on public.ft5 + -> Merge Full Join + Output: ft4.c1, ft4.*, ft5.c1, ft5.* + Merge Cond: (ft4.c1 = ft5.c1) + Filter: ((ft4.c1 IS NULL) OR (ft4.c1 IS NOT NULL)) + -> Sort + Output: ft4.c1, ft4.* + Sort Key: ft4.c1 + -> Foreign Scan on public.ft4 + Output: ft4.c1, ft4.* + SQLite query: SELECT `c1`, `c2`, `c3` FROM main."T 3" WHERE ((`c1` >= 50)) AND ((`c1` <= 60)) + -> Sort Output: ft5.c1, ft5.* - SQLite query: SELECT `c1`, `c2`, `c3` FROM main."T 4" WHERE ((`c1` >= 50)) AND ((`c1` <= 60)) -(22 rows) + Sort Key: ft5.c1 + -> Foreign Scan on public.ft5 + Output: ft5.c1, ft5.* + SQLite query: SELECT `c1`, `c2`, `c3` FROM main."T 4" WHERE ((`c1` >= 50)) AND ((`c1` <= 60)) +(28 rows) --Testcase 92: SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNER JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (TRUE) ORDER BY t1.c1, ss.a, ss.b FOR UPDATE OF t1; @@ -2016,8 +2046,7 @@ SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE (14 rows) --Testcase 777: -ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); -ERROR: server "loopback" does not exist +-- ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); -- join two tables with FOR UPDATE clause -- tests whole-row reference for row marks --Testcase 111: @@ -2751,6 +2780,79 @@ SELECT * FROM ft1, ft2, ft4, ft5, local_tbl WHERE ft1.c1 = ft2.c1 AND ft1.c2 = f RESET enable_nestloop; --Testcase 781: RESET enable_hashjoin; +-- test that add_paths_with_pathkeys_for_rel() arranges for the epq_path to +-- return columns needed by the parent ForeignScan node +-- This does not work as SQLite FDW does not support use_remote_estimate +--Testcase 987: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT * FROM local_tbl LEFT JOIN (SELECT ft1.*, COALESCE(ft1.c3 || ft2.c3, 'foobar') FROM ft1 INNER JOIN ft2 ON (ft1.c1 = ft2.c1 AND ft1.c1 < 100)) ss ON (local_tbl.c1 = ss.c1) ORDER BY local_tbl.c1 FOR UPDATE OF local_tbl; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + LockRows + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, (COALESCE((ft1.c3 || ft2.c3), 'foobar'::text)), local_tbl.ctid, ft1.*, ft2.* + -> Merge Left Join + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, (COALESCE((ft1.c3 || ft2.c3), 'foobar'::text)), local_tbl.ctid, ft1.*, ft2.* + Merge Cond: (local_tbl.c1 = ft1.c1) + -> Index Scan using local_tbl_pkey on public.local_tbl + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, local_tbl.ctid + -> Sort + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.*, (COALESCE((ft1.c3 || ft2.c3), 'foobar'::text)) + Sort Key: ft1.c1 + -> Foreign Scan + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.*, COALESCE((ft1.c3 || ft2.c3), 'foobar'::text) + SQLite query: SELECT r4.`C 1`, r4.`c2`, r4.`c3`, r4.`c4`, r4.`c5`, r4.`c6`, r4.`c7`, r4.`c8`, CASE WHEN ( r4.`C 1` IS NOT NULL) OR ( r4.`c2` IS NOT NULL) OR ( r4.`c3` IS NOT NULL) OR ( r4.`c4` IS NOT NULL) OR ( r4.`c5` IS NOT NULL) OR ( r4.`c6` IS NOT NULL) OR ( r4.`c7` IS NOT NULL) OR ( r4.`c8` IS NOT NULL) THEN ("(" || COALESCE(r4.`C 1`, '') || "," || COALESCE(r4.`c2`, '') || "," || COALESCE(r4.`c3`, '') || "," || COALESCE(r4.`c4`, '') || "," || COALESCE(r4.`c5`, '') || "," || COALESCE(r4.`c6`, '') || "," || COALESCE(r4.`c7`, '') || "," || COALESCE(r4.`c8`, '')|| ")") END, CASE WHEN ( r5.`C 1` IS NOT NULL) OR ( r5.`c2` IS NOT NULL) OR ( r5.`c3` IS NOT NULL) OR ( r5.`c4` IS NOT NULL) OR ( r5.`c5` IS NOT NULL) OR ( r5.`c6` IS NOT NULL) OR ( r5.`c7` IS NOT NULL) OR ( r5.`c8` IS NOT NULL) THEN ("(" || COALESCE(r5.`C 1`, '') || "," || COALESCE(r5.`c2`, '') || "," || COALESCE(r5.`c3`, '') || "," || COALESCE(r5.`c4`, '') || "," || COALESCE(r5.`c5`, '') || "," || COALESCE(r5.`c6`, '') || "," || COALESCE(r5.`c7`, '') || "," || COALESCE(r5.`c8`, '')|| ")") END, r5.`c3` FROM (main."T 1" r4 INNER JOIN main."T 1" r5 ON (((r4.`C 1` = r5.`C 1`)) AND ((r4.`C 1` < 100)))) + -> Hash Join + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.*, ft2.c3 + Hash Cond: (ft1.c1 = ft2.c1) + -> Foreign Scan on public.ft1 + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.* + SQLite query: SELECT `C 1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8` FROM main."T 1" WHERE ((`C 1` < 100)) + -> Hash + Output: ft2.*, ft2.c1, ft2.c3 + -> Foreign Scan on public.ft2 + Output: ft2.*, ft2.c1, ft2.c3 + SQLite query: SELECT `C 1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8` FROM main."T 1" +(24 rows) + +-- ALTER SERVER loopback OPTIONS (DROP extensions); +-- ALTER SERVER loopback OPTIONS (ADD fdw_startup_cost '10000.0'); +--Testcase 988: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT * FROM local_tbl LEFT JOIN (SELECT ft1.* FROM ft1 INNER JOIN ft2 ON (ft1.c1 = ft2.c1 AND ft1.c1 < 100 AND ft1.c1 = sqlite_fdw_abs(ft2.c2))) ss ON (local_tbl.c3 = ss.c3) ORDER BY local_tbl.c1 FOR UPDATE OF local_tbl; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + LockRows + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, local_tbl.ctid, ft1.*, ft2.* + -> Nested Loop Left Join + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, local_tbl.ctid, ft1.*, ft2.* + Join Filter: (local_tbl.c3 = ft1.c3) + -> Index Scan using local_tbl_pkey on public.local_tbl + Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, local_tbl.ctid + -> Materialize + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.* + -> Foreign Scan + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.* + Filter: (ft1.c1 = sqlite_fdw_abs(ft2.c2)) + SQLite query: SELECT r4.`C 1`, r4.`c2`, r4.`c3`, r4.`c4`, r4.`c5`, r4.`c6`, r4.`c7`, r4.`c8`, CASE WHEN ( r4.`C 1` IS NOT NULL) OR ( r4.`c2` IS NOT NULL) OR ( r4.`c3` IS NOT NULL) OR ( r4.`c4` IS NOT NULL) OR ( r4.`c5` IS NOT NULL) OR ( r4.`c6` IS NOT NULL) OR ( r4.`c7` IS NOT NULL) OR ( r4.`c8` IS NOT NULL) THEN ("(" || COALESCE(r4.`C 1`, '') || "," || COALESCE(r4.`c2`, '') || "," || COALESCE(r4.`c3`, '') || "," || COALESCE(r4.`c4`, '') || "," || COALESCE(r4.`c5`, '') || "," || COALESCE(r4.`c6`, '') || "," || COALESCE(r4.`c7`, '') || "," || COALESCE(r4.`c8`, '')|| ")") END, CASE WHEN ( r5.`C 1` IS NOT NULL) OR ( r5.`c2` IS NOT NULL) OR ( r5.`c3` IS NOT NULL) OR ( r5.`c4` IS NOT NULL) OR ( r5.`c5` IS NOT NULL) OR ( r5.`c6` IS NOT NULL) OR ( r5.`c7` IS NOT NULL) OR ( r5.`c8` IS NOT NULL) THEN ("(" || COALESCE(r5.`C 1`, '') || "," || COALESCE(r5.`c2`, '') || "," || COALESCE(r5.`c3`, '') || "," || COALESCE(r5.`c4`, '') || "," || COALESCE(r5.`c5`, '') || "," || COALESCE(r5.`c6`, '') || "," || COALESCE(r5.`c7`, '') || "," || COALESCE(r5.`c8`, '')|| ")") END, r5.`c2` FROM (main."T 1" r4 INNER JOIN main."T 1" r5 ON (((r4.`C 1` = r5.`C 1`)) AND ((r4.`C 1` < 100)))) + -> Merge Join + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.*, ft2.*, ft2.c2 + Merge Cond: ((ft1.c1 = (sqlite_fdw_abs(ft2.c2))) AND (ft1.c1 = ft2.c1)) + -> Sort + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.* + Sort Key: ft1.c1 + -> Foreign Scan on public.ft1 + Output: ft1.c1, ft1.c2, ft1.c3, ft1.c4, ft1.c5, ft1.c6, ft1.c7, ft1.c8, ft1.* + SQLite query: SELECT `C 1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8` FROM main."T 1" WHERE ((`C 1` < 100)) + -> Sort + Output: ft2.*, ft2.c1, ft2.c2, (sqlite_fdw_abs(ft2.c2)) + Sort Key: (sqlite_fdw_abs(ft2.c2)), ft2.c1 + -> Foreign Scan on public.ft2 + Output: ft2.*, ft2.c1, ft2.c2, sqlite_fdw_abs(ft2.c2) + SQLite query: SELECT `C 1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8` FROM main."T 1" +(28 rows) + +-- ALTER SERVER loopback OPTIONS (DROP fdw_startup_cost); +-- ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); --DROP TABLE local_tbl; -- check join pushdown in situations where multiple userids are involved --Testcase 508: @@ -7308,6 +7410,31 @@ SELECT * FROM foreign_tbl; 20 | 30 (1 row) +-- We don't allow batch insert when there are any WCO constraints +ALTER SERVER sqlite_svr OPTIONS (ADD batch_size '10'); +--Testcase 989: +EXPLAIN (VERBOSE, COSTS OFF) +INSERT INTO rw_view VALUES (0, 15), (1, 5); + QUERY PLAN +-------------------------------------------------------- + Insert on public.foreign_tbl + Batch Size: 1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1, "*VALUES*".column2 +(4 rows) + +--Testcase 990: +INSERT INTO rw_view VALUES (0, 15), (1, 5); -- should fail +ERROR: new row violates check option for view "rw_view" +DETAIL: Failing row contains (11, 5). +--Testcase 991: +SELECT * FROM foreign_tbl; + a | b +----+---- + 20 | 30 +(1 row) + +ALTER SERVER sqlite_svr OPTIONS (DROP batch_size); --Testcase 611: DROP FOREIGN TABLE foreign_tbl CASCADE; NOTICE: drop cascades to view rw_view @@ -7414,6 +7541,29 @@ SELECT * FROM foreign_tbl; 40 | 50 (1 row) +-- We don't allow batch insert when there are any WCO constraints +ALTER SERVER sqlite_svr OPTIONS (ADD batch_size '10'); +--Testcase 992: +EXPLAIN (VERBOSE, COSTS OFF) +INSERT INTO rw_view VALUES (0, 15), (1, 5); + QUERY PLAN +-------------------------------------------------------- + Insert on public.parent_tbl + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1, "*VALUES*".column2 +(3 rows) + +--Testcase 993: +INSERT INTO rw_view VALUES (0, 15), (1, 5); -- should fail +ERROR: Not support partition insert +--Testcase 994: +SELECT * FROM foreign_tbl; + a | b +----+---- + 40 | 50 +(1 row) + +ALTER SERVER sqlite_svr OPTIONS (DROP batch_size); --Testcase 628: DROP TRIGGER row_before_insupd_trigger ON foreign_tbl; --Testcase 629: @@ -9003,26 +9153,30 @@ select * from parent inner join remt2 on (parent.a = remt2.a); --Testcase 475: explain (verbose, costs off) delete from parent using remt2 where parent.a = remt2.a; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------- Delete on public.parent Delete on public.parent parent_1 Foreign Delete on public.remt1 parent_2 - -> Hash Join + -> Merge Join Output: remt2.*, parent.tableoid, parent.ctid, (NULL::integer) - Hash Cond: (parent.a = remt2.a) - -> Append - -> Seq Scan on public.parent parent_1 - Output: parent_1.a, parent_1.tableoid, parent_1.ctid, NULL::integer - -> Foreign Scan on public.remt1 parent_2 - Output: parent_2.a, parent_2.tableoid, NULL::tid, parent_2.a - SQLite query: SELECT `a` FROM main."loct3" - -> Hash + Merge Cond: (remt2.a = parent.a) + -> Sort Output: remt2.*, remt2.a + Sort Key: remt2.a -> Foreign Scan on public.remt2 Output: remt2.*, remt2.a SQLite query: SELECT `a`, `b` FROM main."loct4" -(17 rows) + -> Sort + Output: parent.a, parent.tableoid, parent.ctid, (NULL::integer) + Sort Key: parent.a + -> Append + -> Seq Scan on public.parent parent_1 + Output: parent_1.a, parent_1.tableoid, parent_1.ctid, NULL::integer + -> Foreign Scan on public.remt1 parent_2 + Output: parent_2.a, parent_2.tableoid, NULL::tid, parent_2.a + SQLite query: SELECT `a` FROM main."loct3" +(21 rows) --Testcase 476: delete from parent using remt2 where parent.a = remt2.a; @@ -10965,7 +11119,6 @@ SELECT COUNT(*) FROM ftable; ALTER FOREIGN TABLE ftable OPTIONS ( SET batch_size '10' ); --Testcase 978: CREATE TRIGGER trig_row_before BEFORE INSERT ON ftable ---Testcase 979: FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo'); --Testcase 980: EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO ftable VALUES (3), (4); diff --git a/expected/15beta2/extra/timestamp.out b/expected/15.0/extra/timestamp.out similarity index 100% rename from expected/15beta2/extra/timestamp.out rename to expected/15.0/extra/timestamp.out diff --git a/expected/15beta2/extra/update.out b/expected/15.0/extra/update.out similarity index 100% rename from expected/15beta2/extra/update.out rename to expected/15.0/extra/update.out diff --git a/expected/15beta2/selectfunc.out b/expected/15.0/selectfunc.out similarity index 100% rename from expected/15beta2/selectfunc.out rename to expected/15.0/selectfunc.out diff --git a/expected/14.4/sqlite_fdw.out b/expected/15.0/sqlite_fdw.out similarity index 99% rename from expected/14.4/sqlite_fdw.out rename to expected/15.0/sqlite_fdw.out index e4b46009..356f7c77 100644 --- a/expected/14.4/sqlite_fdw.out +++ b/expected/15.0/sqlite_fdw.out @@ -1455,14 +1455,14 @@ SELECT * FROM noprimary; SELECT * FROM public.sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) --Testcase 155: SELECT sqlite_fdw_version(); sqlite_fdw_version -------------------- - 20200 + 20300 (1 row) -- issue #44 github diff --git a/expected/15beta2/type.out b/expected/15.0/type.out similarity index 100% rename from expected/15beta2/type.out rename to expected/15.0/type.out diff --git a/sql/11.16/aggregate.sql b/sql/11.17/aggregate.sql similarity index 100% rename from sql/11.16/aggregate.sql rename to sql/11.17/aggregate.sql diff --git a/sql/11.16/extra/aggregates.sql b/sql/11.17/extra/aggregates.sql similarity index 100% rename from sql/11.16/extra/aggregates.sql rename to sql/11.17/extra/aggregates.sql diff --git a/sql/11.16/extra/float4.sql b/sql/11.17/extra/float4.sql similarity index 100% rename from sql/11.16/extra/float4.sql rename to sql/11.17/extra/float4.sql diff --git a/sql/11.16/extra/float8.sql b/sql/11.17/extra/float8.sql similarity index 100% rename from sql/11.16/extra/float8.sql rename to sql/11.17/extra/float8.sql diff --git a/sql/11.16/extra/insert.sql b/sql/11.17/extra/insert.sql similarity index 100% rename from sql/11.16/extra/insert.sql rename to sql/11.17/extra/insert.sql diff --git a/sql/11.16/extra/int4.sql b/sql/11.17/extra/int4.sql similarity index 100% rename from sql/11.16/extra/int4.sql rename to sql/11.17/extra/int4.sql diff --git a/sql/11.16/extra/int8.sql b/sql/11.17/extra/int8.sql similarity index 100% rename from sql/11.16/extra/int8.sql rename to sql/11.17/extra/int8.sql diff --git a/sql/11.16/extra/join.sql b/sql/11.17/extra/join.sql similarity index 100% rename from sql/11.16/extra/join.sql rename to sql/11.17/extra/join.sql diff --git a/sql/11.16/extra/limit.sql b/sql/11.17/extra/limit.sql similarity index 100% rename from sql/11.16/extra/limit.sql rename to sql/11.17/extra/limit.sql diff --git a/sql/11.16/extra/numeric.sql b/sql/11.17/extra/numeric.sql similarity index 100% rename from sql/11.16/extra/numeric.sql rename to sql/11.17/extra/numeric.sql diff --git a/sql/11.16/extra/prepare.sql b/sql/11.17/extra/prepare.sql similarity index 100% rename from sql/11.16/extra/prepare.sql rename to sql/11.17/extra/prepare.sql diff --git a/sql/11.16/extra/select.sql b/sql/11.17/extra/select.sql similarity index 100% rename from sql/11.16/extra/select.sql rename to sql/11.17/extra/select.sql diff --git a/sql/11.16/extra/select_having.sql b/sql/11.17/extra/select_having.sql similarity index 100% rename from sql/11.16/extra/select_having.sql rename to sql/11.17/extra/select_having.sql diff --git a/sql/11.16/extra/sqlite_fdw_post.sql b/sql/11.17/extra/sqlite_fdw_post.sql similarity index 100% rename from sql/11.16/extra/sqlite_fdw_post.sql rename to sql/11.17/extra/sqlite_fdw_post.sql diff --git a/sql/11.16/extra/timestamp.sql b/sql/11.17/extra/timestamp.sql similarity index 100% rename from sql/11.16/extra/timestamp.sql rename to sql/11.17/extra/timestamp.sql diff --git a/sql/11.16/extra/update.sql b/sql/11.17/extra/update.sql similarity index 100% rename from sql/11.16/extra/update.sql rename to sql/11.17/extra/update.sql diff --git a/sql/11.16/selectfunc.sql b/sql/11.17/selectfunc.sql similarity index 100% rename from sql/11.16/selectfunc.sql rename to sql/11.17/selectfunc.sql diff --git a/sql/11.16/sqlite_fdw.sql b/sql/11.17/sqlite_fdw.sql similarity index 100% rename from sql/11.16/sqlite_fdw.sql rename to sql/11.17/sqlite_fdw.sql diff --git a/sql/11.16/type.sql b/sql/11.17/type.sql similarity index 100% rename from sql/11.16/type.sql rename to sql/11.17/type.sql diff --git a/sql/12.11/aggregate.sql b/sql/12.12/aggregate.sql similarity index 100% rename from sql/12.11/aggregate.sql rename to sql/12.12/aggregate.sql diff --git a/sql/12.11/extra/aggregates.sql b/sql/12.12/extra/aggregates.sql similarity index 100% rename from sql/12.11/extra/aggregates.sql rename to sql/12.12/extra/aggregates.sql diff --git a/sql/12.11/extra/float4.sql b/sql/12.12/extra/float4.sql similarity index 100% rename from sql/12.11/extra/float4.sql rename to sql/12.12/extra/float4.sql diff --git a/sql/12.11/extra/float8.sql b/sql/12.12/extra/float8.sql similarity index 100% rename from sql/12.11/extra/float8.sql rename to sql/12.12/extra/float8.sql diff --git a/sql/12.11/extra/insert.sql b/sql/12.12/extra/insert.sql similarity index 100% rename from sql/12.11/extra/insert.sql rename to sql/12.12/extra/insert.sql diff --git a/sql/12.11/extra/int4.sql b/sql/12.12/extra/int4.sql similarity index 100% rename from sql/12.11/extra/int4.sql rename to sql/12.12/extra/int4.sql diff --git a/sql/12.11/extra/int8.sql b/sql/12.12/extra/int8.sql similarity index 100% rename from sql/12.11/extra/int8.sql rename to sql/12.12/extra/int8.sql diff --git a/sql/12.11/extra/join.sql b/sql/12.12/extra/join.sql similarity index 100% rename from sql/12.11/extra/join.sql rename to sql/12.12/extra/join.sql diff --git a/sql/12.11/extra/limit.sql b/sql/12.12/extra/limit.sql similarity index 100% rename from sql/12.11/extra/limit.sql rename to sql/12.12/extra/limit.sql diff --git a/sql/12.11/extra/numeric.sql b/sql/12.12/extra/numeric.sql similarity index 100% rename from sql/12.11/extra/numeric.sql rename to sql/12.12/extra/numeric.sql diff --git a/sql/12.11/extra/prepare.sql b/sql/12.12/extra/prepare.sql similarity index 100% rename from sql/12.11/extra/prepare.sql rename to sql/12.12/extra/prepare.sql diff --git a/sql/12.11/extra/select.sql b/sql/12.12/extra/select.sql similarity index 100% rename from sql/12.11/extra/select.sql rename to sql/12.12/extra/select.sql diff --git a/sql/12.11/extra/select_having.sql b/sql/12.12/extra/select_having.sql similarity index 100% rename from sql/12.11/extra/select_having.sql rename to sql/12.12/extra/select_having.sql diff --git a/sql/12.11/extra/sqlite_fdw_post.sql b/sql/12.12/extra/sqlite_fdw_post.sql similarity index 100% rename from sql/12.11/extra/sqlite_fdw_post.sql rename to sql/12.12/extra/sqlite_fdw_post.sql diff --git a/sql/12.11/extra/timestamp.sql b/sql/12.12/extra/timestamp.sql similarity index 100% rename from sql/12.11/extra/timestamp.sql rename to sql/12.12/extra/timestamp.sql diff --git a/sql/12.11/extra/update.sql b/sql/12.12/extra/update.sql similarity index 100% rename from sql/12.11/extra/update.sql rename to sql/12.12/extra/update.sql diff --git a/sql/12.11/selectfunc.sql b/sql/12.12/selectfunc.sql similarity index 100% rename from sql/12.11/selectfunc.sql rename to sql/12.12/selectfunc.sql diff --git a/sql/12.11/sqlite_fdw.sql b/sql/12.12/sqlite_fdw.sql similarity index 100% rename from sql/12.11/sqlite_fdw.sql rename to sql/12.12/sqlite_fdw.sql diff --git a/sql/12.11/type.sql b/sql/12.12/type.sql similarity index 100% rename from sql/12.11/type.sql rename to sql/12.12/type.sql diff --git a/sql/13.7/aggregate.sql b/sql/13.8/aggregate.sql similarity index 100% rename from sql/13.7/aggregate.sql rename to sql/13.8/aggregate.sql diff --git a/sql/13.7/extra/aggregates.sql b/sql/13.8/extra/aggregates.sql similarity index 100% rename from sql/13.7/extra/aggregates.sql rename to sql/13.8/extra/aggregates.sql diff --git a/sql/13.7/extra/float4.sql b/sql/13.8/extra/float4.sql similarity index 100% rename from sql/13.7/extra/float4.sql rename to sql/13.8/extra/float4.sql diff --git a/sql/13.7/extra/float8.sql b/sql/13.8/extra/float8.sql similarity index 100% rename from sql/13.7/extra/float8.sql rename to sql/13.8/extra/float8.sql diff --git a/sql/13.7/extra/insert.sql b/sql/13.8/extra/insert.sql similarity index 100% rename from sql/13.7/extra/insert.sql rename to sql/13.8/extra/insert.sql diff --git a/sql/13.7/extra/int4.sql b/sql/13.8/extra/int4.sql similarity index 100% rename from sql/13.7/extra/int4.sql rename to sql/13.8/extra/int4.sql diff --git a/sql/13.7/extra/int8.sql b/sql/13.8/extra/int8.sql similarity index 100% rename from sql/13.7/extra/int8.sql rename to sql/13.8/extra/int8.sql diff --git a/sql/13.7/extra/join.sql b/sql/13.8/extra/join.sql similarity index 100% rename from sql/13.7/extra/join.sql rename to sql/13.8/extra/join.sql diff --git a/sql/13.7/extra/limit.sql b/sql/13.8/extra/limit.sql similarity index 100% rename from sql/13.7/extra/limit.sql rename to sql/13.8/extra/limit.sql diff --git a/sql/13.7/extra/numeric.sql b/sql/13.8/extra/numeric.sql similarity index 100% rename from sql/13.7/extra/numeric.sql rename to sql/13.8/extra/numeric.sql diff --git a/sql/13.7/extra/prepare.sql b/sql/13.8/extra/prepare.sql similarity index 100% rename from sql/13.7/extra/prepare.sql rename to sql/13.8/extra/prepare.sql diff --git a/sql/13.7/extra/select.sql b/sql/13.8/extra/select.sql similarity index 100% rename from sql/13.7/extra/select.sql rename to sql/13.8/extra/select.sql diff --git a/sql/13.7/extra/select_having.sql b/sql/13.8/extra/select_having.sql similarity index 100% rename from sql/13.7/extra/select_having.sql rename to sql/13.8/extra/select_having.sql diff --git a/sql/13.7/extra/sqlite_fdw_post.sql b/sql/13.8/extra/sqlite_fdw_post.sql similarity index 100% rename from sql/13.7/extra/sqlite_fdw_post.sql rename to sql/13.8/extra/sqlite_fdw_post.sql diff --git a/sql/13.7/extra/timestamp.sql b/sql/13.8/extra/timestamp.sql similarity index 100% rename from sql/13.7/extra/timestamp.sql rename to sql/13.8/extra/timestamp.sql diff --git a/sql/13.7/extra/update.sql b/sql/13.8/extra/update.sql similarity index 100% rename from sql/13.7/extra/update.sql rename to sql/13.8/extra/update.sql diff --git a/sql/13.7/selectfunc.sql b/sql/13.8/selectfunc.sql similarity index 100% rename from sql/13.7/selectfunc.sql rename to sql/13.8/selectfunc.sql diff --git a/sql/13.7/sqlite_fdw.sql b/sql/13.8/sqlite_fdw.sql similarity index 100% rename from sql/13.7/sqlite_fdw.sql rename to sql/13.8/sqlite_fdw.sql diff --git a/sql/13.7/type.sql b/sql/13.8/type.sql similarity index 100% rename from sql/13.7/type.sql rename to sql/13.8/type.sql diff --git a/sql/14.4/aggregate.sql b/sql/14.5/aggregate.sql similarity index 100% rename from sql/14.4/aggregate.sql rename to sql/14.5/aggregate.sql diff --git a/sql/14.4/extra/aggregates.sql b/sql/14.5/extra/aggregates.sql similarity index 100% rename from sql/14.4/extra/aggregates.sql rename to sql/14.5/extra/aggregates.sql diff --git a/sql/14.4/extra/float4.sql b/sql/14.5/extra/float4.sql similarity index 100% rename from sql/14.4/extra/float4.sql rename to sql/14.5/extra/float4.sql diff --git a/sql/14.4/extra/float8.sql b/sql/14.5/extra/float8.sql similarity index 100% rename from sql/14.4/extra/float8.sql rename to sql/14.5/extra/float8.sql diff --git a/sql/14.4/extra/insert.sql b/sql/14.5/extra/insert.sql similarity index 100% rename from sql/14.4/extra/insert.sql rename to sql/14.5/extra/insert.sql diff --git a/sql/14.4/extra/int4.sql b/sql/14.5/extra/int4.sql similarity index 100% rename from sql/14.4/extra/int4.sql rename to sql/14.5/extra/int4.sql diff --git a/sql/14.4/extra/int8.sql b/sql/14.5/extra/int8.sql similarity index 100% rename from sql/14.4/extra/int8.sql rename to sql/14.5/extra/int8.sql diff --git a/sql/14.4/extra/join.sql b/sql/14.5/extra/join.sql similarity index 100% rename from sql/14.4/extra/join.sql rename to sql/14.5/extra/join.sql diff --git a/sql/14.4/extra/limit.sql b/sql/14.5/extra/limit.sql similarity index 100% rename from sql/14.4/extra/limit.sql rename to sql/14.5/extra/limit.sql diff --git a/sql/14.4/extra/numeric.sql b/sql/14.5/extra/numeric.sql similarity index 100% rename from sql/14.4/extra/numeric.sql rename to sql/14.5/extra/numeric.sql diff --git a/sql/14.4/extra/prepare.sql b/sql/14.5/extra/prepare.sql similarity index 100% rename from sql/14.4/extra/prepare.sql rename to sql/14.5/extra/prepare.sql diff --git a/sql/14.4/extra/select.sql b/sql/14.5/extra/select.sql similarity index 100% rename from sql/14.4/extra/select.sql rename to sql/14.5/extra/select.sql diff --git a/sql/14.4/extra/select_having.sql b/sql/14.5/extra/select_having.sql similarity index 100% rename from sql/14.4/extra/select_having.sql rename to sql/14.5/extra/select_having.sql diff --git a/sql/14.4/extra/sqlite_fdw_post.sql b/sql/14.5/extra/sqlite_fdw_post.sql similarity index 100% rename from sql/14.4/extra/sqlite_fdw_post.sql rename to sql/14.5/extra/sqlite_fdw_post.sql diff --git a/sql/14.4/extra/timestamp.sql b/sql/14.5/extra/timestamp.sql similarity index 100% rename from sql/14.4/extra/timestamp.sql rename to sql/14.5/extra/timestamp.sql diff --git a/sql/14.4/extra/update.sql b/sql/14.5/extra/update.sql similarity index 100% rename from sql/14.4/extra/update.sql rename to sql/14.5/extra/update.sql diff --git a/sql/14.4/selectfunc.sql b/sql/14.5/selectfunc.sql similarity index 100% rename from sql/14.4/selectfunc.sql rename to sql/14.5/selectfunc.sql diff --git a/sql/14.4/sqlite_fdw.sql b/sql/14.5/sqlite_fdw.sql similarity index 100% rename from sql/14.4/sqlite_fdw.sql rename to sql/14.5/sqlite_fdw.sql diff --git a/sql/14.4/type.sql b/sql/14.5/type.sql similarity index 100% rename from sql/14.4/type.sql rename to sql/14.5/type.sql diff --git a/sql/15beta2/aggregate.sql b/sql/15.0/aggregate.sql similarity index 100% rename from sql/15beta2/aggregate.sql rename to sql/15.0/aggregate.sql diff --git a/sql/15beta2/extra/aggregates.sql b/sql/15.0/extra/aggregates.sql similarity index 96% rename from sql/15beta2/extra/aggregates.sql rename to sql/15.0/extra/aggregates.sql index b3462e45..157ed7e5 100644 --- a/sql/15beta2/extra/aggregates.sql +++ b/sql/15.0/extra/aggregates.sql @@ -79,128 +79,6 @@ CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')) SERVER sqli CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')) SERVER sqlite_svr; --- GROUP BY optimization by reorder columns ---Testcase 678: -CREATE FOREIGN TABLE btg(id int, p int, v text, c float, d float, e int) SERVER sqlite_svr; - ---Testcase 679: -INSERT INTO btg -SELECT - i, - i/2, - format('%60s', i%2), - i/4, - i/8, - (random() * (10000/8))::int --the same as d but no correlation with p -FROM - generate_series(1, 10000) i; - --- VACUUM btg; --- ANALYZE btg; - --- GROUP BY optimization by reorder columns by frequency - -SET enable_hashagg=off; -SET max_parallel_workers= 0; -SET max_parallel_workers_per_gather = 0; - ---Testcase 680: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v; - ---Testcase 681: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p; - ---Testcase 682: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c; - ---Testcase 683: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c ORDER BY v, p, c; - ---Testcase 684: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c; - ---Testcase 685: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c ORDER BY v, p, d ,c; - ---Testcase 686: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, d, c ORDER BY p, v, d ,c; - ---Testcase 687: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, d, e; - ---Testcase 688: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, e, d; - ---Testcase 689: -CREATE STATISTICS btg_dep ON d, e, p FROM btg; --- ANALYZE btg; - ---Testcase 690: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, d, e; - ---Testcase 691: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, e, d; - - --- GROUP BY optimization by reorder columns by index scan - ---Testcase 692: -CREATE INDEX ON btg(p, v); -SET enable_seqscan=off; -SET enable_bitmapscan=off; --- VACUUM btg; - ---Testcase 693: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v; - ---Testcase 694: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY p, v ORDER BY p, v; - ---Testcase 695: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p; - ---Testcase 696: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p ORDER BY p, v; - ---Testcase 697: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c; - ---Testcase 698: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, p, c ORDER BY p, v; - ---Testcase 699: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, c, p, d; - ---Testcase 700: -EXPLAIN (COSTS off) -SELECT count(*) FROM btg GROUP BY v, c, p, d ORDER BY p, v; - ---Testcase 701: -DROP FOREIGN TABLE btg; -RESET enable_hashagg; -RESET max_parallel_workers; -RESET max_parallel_workers_per_gather; -RESET enable_seqscan; -RESET enable_bitmapscan; - -- avoid bit-exact output here because operations may not be bit-exact. --Testcase 588: SET extra_float_digits = 0; @@ -213,10 +91,12 @@ SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100; -- In 7.1, avg(float4) is computed using float8 arithmetic. --Testcase 3: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 678: SELECT avg(b)::numeric(10,3) AS avg_107_943 FROM aggtest; --Testcase 4: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 679: SELECT avg(gpa)::numeric(10,3) AS avg_3_4 FROM ONLY student; @@ -226,9 +106,11 @@ SELECT sum(four) AS sum_1500 FROM onek; SELECT sum(a) AS sum_198 FROM aggtest; --Testcase 7: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 680: SELECT sum(b)::numeric(10,3) AS avg_431_773 FROM aggtest; --Testcase 8: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 681: SELECT sum(gpa)::numeric(10,3) AS avg_6_8 FROM ONLY student; --Testcase 9: @@ -242,15 +124,19 @@ SELECT max(student.gpa) AS max_3_7 FROM student; --Testcase 13: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 682: SELECT stddev_pop(b)::numeric(20,10) FROM aggtest; --Testcase 14: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 683: SELECT stddev_samp(b)::numeric(20,10) FROM aggtest; --Testcase 15: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 684: SELECT var_pop(b)::numeric(20,10) FROM aggtest; --Testcase 16: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 685: SELECT var_samp(b)::numeric(20,10) FROM aggtest; --Testcase 17: @@ -494,24 +380,31 @@ SELECT regr_count(b, a) FROM aggtest; SELECT regr_sxx(b, a) FROM aggtest; --Testcase 23: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 686: SELECT regr_syy(b, a)::numeric(20,10) FROM aggtest; --Testcase 24: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 687: SELECT regr_sxy(b, a)::numeric(20,10) FROM aggtest; --Testcase 25: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 688: SELECT regr_avgx(b, a), regr_avgy(b, a)::numeric(20,10) FROM aggtest; --Testcase 26: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 689: SELECT regr_r2(b, a)::numeric(20,10) FROM aggtest; --Testcase 27: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 690: SELECT regr_slope(b, a)::numeric(20,10), regr_intercept(b, a)::numeric(20,10) FROM aggtest; --Testcase 28: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 691: SELECT covar_pop(b, a)::numeric(20,10), covar_samp(b, a)::numeric(20,10) FROM aggtest; --Testcase 29: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 692: SELECT corr(b, a)::numeric(20,10) FROM aggtest; -- check single-tuple behavior @@ -1501,12 +1394,15 @@ rollback; --Testcase 179: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 693: select (percentile_cont(0.5) within group (order by b))::numeric(20,10) from aggtest; --Testcase 180: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 694: select (percentile_cont(0.5) within group (order by b))::numeric(20,10), sum(b)::numeric(10,3) from aggtest; --Testcase 181: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 695: select percentile_cont(0.5) within group (order by thousand) from tenk1; --Testcase 182: select percentile_disc(0.5) within group (order by thousand) from tenk1; @@ -1524,6 +1420,7 @@ select cume_dist(3) within group (order by f1) from INT4_TBL; insert into INT4_TBL values (5); --Testcase 458: -- Round the result to limited digits to avoid platform-specific results. +--Testcase 696: select (percent_rank(3) within group (order by f1))::numeric(20,10) from INT4_TBL; --Testcase 459: delete from INT4_TBL where f1 = 5; diff --git a/sql/15beta2/extra/float4.sql b/sql/15.0/extra/float4.sql similarity index 100% rename from sql/15beta2/extra/float4.sql rename to sql/15.0/extra/float4.sql diff --git a/sql/15beta2/extra/float8.sql b/sql/15.0/extra/float8.sql similarity index 100% rename from sql/15beta2/extra/float8.sql rename to sql/15.0/extra/float8.sql diff --git a/sql/15beta2/extra/insert.sql b/sql/15.0/extra/insert.sql similarity index 100% rename from sql/15beta2/extra/insert.sql rename to sql/15.0/extra/insert.sql diff --git a/sql/15beta2/extra/int4.sql b/sql/15.0/extra/int4.sql similarity index 100% rename from sql/15beta2/extra/int4.sql rename to sql/15.0/extra/int4.sql diff --git a/sql/15beta2/extra/int8.sql b/sql/15.0/extra/int8.sql similarity index 100% rename from sql/15beta2/extra/int8.sql rename to sql/15.0/extra/int8.sql diff --git a/sql/15beta2/extra/join.sql b/sql/15.0/extra/join.sql similarity index 99% rename from sql/15beta2/extra/join.sql rename to sql/15.0/extra/join.sql index e10b19fc..9f2c3876 100644 --- a/sql/15beta2/extra/join.sql +++ b/sql/15.0/extra/join.sql @@ -741,6 +741,33 @@ select * from t12 left join t22 on (t12.a = t22.a); --Testcase 120: select t12.x from t12 join t32 on (t12.a = t32.x); +-- Test matching of locking clause with wrong alias + +--Testcase 540: +select t12.*, t22.*, unnamed_join.* from + t12 join t22 on (t12.a = t22.a), t32 as unnamed_join + for update of unnamed_join; + +--Testcase 541: +select foo.*, unnamed_join.* from + t12 join t22 using (a) as foo, t32 as unnamed_join + for update of unnamed_join; + +--Testcase 542: +select foo.*, unnamed_join.* from + t12 join t22 using (a) as foo, t32 as unnamed_join + for update of foo; + +--Testcase 543: +select bar.*, unnamed_join.* from + (t12 join t22 using (a) as foo) as bar, t32 as unnamed_join + for update of foo; + +--Testcase 544: +select bar.*, unnamed_join.* from + (t12 join t22 using (a) as foo) as bar, t32 as unnamed_join + for update of bar; + --Testcase 536: drop table t2a; diff --git a/sql/15beta2/extra/limit.sql b/sql/15.0/extra/limit.sql similarity index 100% rename from sql/15beta2/extra/limit.sql rename to sql/15.0/extra/limit.sql diff --git a/sql/15beta2/extra/numeric.sql b/sql/15.0/extra/numeric.sql similarity index 100% rename from sql/15beta2/extra/numeric.sql rename to sql/15.0/extra/numeric.sql diff --git a/sql/15beta2/extra/prepare.sql b/sql/15.0/extra/prepare.sql similarity index 100% rename from sql/15beta2/extra/prepare.sql rename to sql/15.0/extra/prepare.sql diff --git a/sql/15beta2/extra/select.sql b/sql/15.0/extra/select.sql similarity index 100% rename from sql/15beta2/extra/select.sql rename to sql/15.0/extra/select.sql diff --git a/sql/15beta2/extra/select_having.sql b/sql/15.0/extra/select_having.sql similarity index 100% rename from sql/15beta2/extra/select_having.sql rename to sql/15.0/extra/select_having.sql diff --git a/sql/15beta2/extra/sqlite_fdw_post.sql b/sql/15.0/extra/sqlite_fdw_post.sql similarity index 98% rename from sql/15beta2/extra/sqlite_fdw_post.sql rename to sql/15.0/extra/sqlite_fdw_post.sql index accb38e4..f7cbddfb 100644 --- a/sql/15beta2/extra/sqlite_fdw_post.sql +++ b/sql/15.0/extra/sqlite_fdw_post.sql @@ -447,6 +447,18 @@ SELECT * FROM ft1 WHERE CASE c3 WHEN c6 THEN true ELSE c3 < 'bar' END; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 WHERE CASE c3 COLLATE "C" WHEN c6 THEN true ELSE c3 < 'bar' END; +-- check schema-qualification of regconfig constant +--Testcase 984: +CREATE TEXT SEARCH CONFIGURATION public.custom_search + (COPY = pg_catalog.english); +--Testcase 985: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM ft1 +WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0; +--Testcase 986: +SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM ft1 +WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0; + -- =================================================================== -- JOIN queries -- =================================================================== @@ -613,7 +625,7 @@ SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE sqlite_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10; --Testcase 777: -ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); +-- ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); -- join two tables with FOR UPDATE clause -- tests whole-row reference for row marks --Testcase 111: @@ -753,6 +765,22 @@ SELECT * FROM ft1, ft2, ft4, ft5, local_tbl WHERE ft1.c1 = ft2.c1 AND ft1.c2 = f RESET enable_nestloop; --Testcase 781: RESET enable_hashjoin; + +-- test that add_paths_with_pathkeys_for_rel() arranges for the epq_path to +-- return columns needed by the parent ForeignScan node +-- This does not work as SQLite FDW does not support use_remote_estimate +--Testcase 987: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT * FROM local_tbl LEFT JOIN (SELECT ft1.*, COALESCE(ft1.c3 || ft2.c3, 'foobar') FROM ft1 INNER JOIN ft2 ON (ft1.c1 = ft2.c1 AND ft1.c1 < 100)) ss ON (local_tbl.c1 = ss.c1) ORDER BY local_tbl.c1 FOR UPDATE OF local_tbl; + +-- ALTER SERVER loopback OPTIONS (DROP extensions); +-- ALTER SERVER loopback OPTIONS (ADD fdw_startup_cost '10000.0'); +--Testcase 988: +EXPLAIN (VERBOSE, COSTS OFF) +SELECT * FROM local_tbl LEFT JOIN (SELECT ft1.* FROM ft1 INNER JOIN ft2 ON (ft1.c1 = ft2.c1 AND ft1.c1 < 100 AND ft1.c1 = sqlite_fdw_abs(ft2.c2))) ss ON (local_tbl.c3 = ss.c3) ORDER BY local_tbl.c1 FOR UPDATE OF local_tbl; +-- ALTER SERVER loopback OPTIONS (DROP fdw_startup_cost); +-- ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw'); + --DROP TABLE local_tbl; -- check join pushdown in situations where multiple userids are involved @@ -1970,6 +1998,17 @@ UPDATE rw_view SET b = b + 15; -- ok --Testcase 610: SELECT * FROM foreign_tbl; +-- We don't allow batch insert when there are any WCO constraints +ALTER SERVER sqlite_svr OPTIONS (ADD batch_size '10'); +--Testcase 989: +EXPLAIN (VERBOSE, COSTS OFF) +INSERT INTO rw_view VALUES (0, 15), (1, 5); +--Testcase 990: +INSERT INTO rw_view VALUES (0, 15), (1, 5); -- should fail +--Testcase 991: +SELECT * FROM foreign_tbl; +ALTER SERVER sqlite_svr OPTIONS (DROP batch_size); + --Testcase 611: DROP FOREIGN TABLE foreign_tbl CASCADE; --Testcase 612: @@ -2025,6 +2064,17 @@ UPDATE rw_view SET b = b + 15; -- ok --Testcase 627: SELECT * FROM foreign_tbl; +-- We don't allow batch insert when there are any WCO constraints +ALTER SERVER sqlite_svr OPTIONS (ADD batch_size '10'); +--Testcase 992: +EXPLAIN (VERBOSE, COSTS OFF) +INSERT INTO rw_view VALUES (0, 15), (1, 5); +--Testcase 993: +INSERT INTO rw_view VALUES (0, 15), (1, 5); -- should fail +--Testcase 994: +SELECT * FROM foreign_tbl; +ALTER SERVER sqlite_svr OPTIONS (DROP batch_size); + --Testcase 628: DROP TRIGGER row_before_insupd_trigger ON foreign_tbl; --Testcase 629: @@ -3965,7 +4015,6 @@ SELECT COUNT(*) FROM ftable; ALTER FOREIGN TABLE ftable OPTIONS ( SET batch_size '10' ); --Testcase 978: CREATE TRIGGER trig_row_before BEFORE INSERT ON ftable ---Testcase 979: FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo'); --Testcase 980: EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO ftable VALUES (3), (4); diff --git a/sql/15beta2/extra/timestamp.sql b/sql/15.0/extra/timestamp.sql similarity index 100% rename from sql/15beta2/extra/timestamp.sql rename to sql/15.0/extra/timestamp.sql diff --git a/sql/15beta2/extra/update.sql b/sql/15.0/extra/update.sql similarity index 100% rename from sql/15beta2/extra/update.sql rename to sql/15.0/extra/update.sql diff --git a/sql/15beta2/selectfunc.sql b/sql/15.0/selectfunc.sql similarity index 100% rename from sql/15beta2/selectfunc.sql rename to sql/15.0/selectfunc.sql diff --git a/sql/15beta2/sqlite_fdw.sql b/sql/15.0/sqlite_fdw.sql similarity index 100% rename from sql/15beta2/sqlite_fdw.sql rename to sql/15.0/sqlite_fdw.sql diff --git a/sql/15beta2/type.sql b/sql/15.0/type.sql similarity index 100% rename from sql/15beta2/type.sql rename to sql/15.0/type.sql diff --git a/sqlite_fdw.c b/sqlite_fdw.c index c23289d4..be8e2c6e 100644 --- a/sqlite_fdw.c +++ b/sqlite_fdw.c @@ -740,6 +740,57 @@ sqlite_add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel, List useful_pathkeys_list = sqlite_get_useful_pathkeys_for_relation(root, rel); +#if PG_VERSION_NUM >= 150000 + /* + * Before creating sorted paths, arrange for the passed-in EPQ path, if + * any, to return columns needed by the parent ForeignScan node so that + * they will propagate up through Sort nodes injected below, if necessary. + */ + if (epq_path != NULL && useful_pathkeys_list != NIL) + { + SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) rel->fdw_private; + PathTarget *target = copy_pathtarget(epq_path->pathtarget); + + /* Include columns required for evaluating PHVs in the tlist. */ + add_new_columns_to_pathtarget(target, + pull_var_clause((Node *) target->exprs, + PVC_RECURSE_PLACEHOLDERS)); + + /* Include columns required for evaluating the local conditions. */ + foreach(lc, fpinfo->local_conds) + { + RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc); + + add_new_columns_to_pathtarget(target, + pull_var_clause((Node *) rinfo->clause, + PVC_RECURSE_PLACEHOLDERS)); + } + + /* + * If we have added any new columns, adjust the tlist of the EPQ path. + * + * Note: the plan created using this path will only be used to execute + * EPQ checks, where accuracy of the plan cost and width estimates + * would not be important, so we do not do set_pathtarget_cost_width() + * for the new pathtarget here. See also postgresGetForeignPlan(). + */ + if (list_length(target->exprs) > list_length(epq_path->pathtarget->exprs)) + { + /* The EPQ path is a join path, so it is projection-capable. */ + Assert(is_projection_capable_path(epq_path)); + + /* + * Use create_projection_path() here, so as to avoid modifying it + * in place. + */ + epq_path = (Path *) create_projection_path(root, + rel, + epq_path, + target); + } + } +#endif + /* Create one path for each set of pathkeys we found above. */ foreach(lc, useful_pathkeys_list) { @@ -2111,20 +2162,18 @@ sqliteGetForeignModifyBatchSize(ResultRelInfo *resultRelInfo) /* * Disable batching when there are any BEFORE/AFTER ROW - * INSERT triggers on the foreign table. + * INSERT triggers on the foreign table, or there are any + * WITH CHECK OPTION constraints from parent views. * * When there are any BEFORE ROW INSERT triggers on the table, we can't * support it, because such triggers might query the table we're inserting * into and act differently if the tuples that have already been processed * and prepared for insertion are not there. */ - if (resultRelInfo->ri_TrigDesc && -#if PG_VERSION_NUM >= 150000 + if (resultRelInfo->ri_WithCheckOptions != NIL || + (resultRelInfo->ri_TrigDesc && (resultRelInfo->ri_TrigDesc->trig_insert_before_row || - resultRelInfo->ri_TrigDesc->trig_insert_after_row)) -#else - resultRelInfo->ri_TrigDesc->trig_insert_after_row) -#endif + resultRelInfo->ri_TrigDesc->trig_insert_after_row))) return 1; /* @@ -2738,7 +2787,7 @@ sqliteExecForeignTruncate(List *rels, sqlite_deparse_truncate(&sql, rels); /* Issue the DELETE statement without WHERE clause to remote server */ - sqlite_do_sql_command(conn, sql.data, ERROR); + sqlite_do_sql_command(conn, sql.data, ERROR, NULL); pfree(sql.data); } @@ -5081,6 +5130,14 @@ sqlite_set_transmission_modes(void) PGC_USERSET, PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + /* + * In addition force restrictive search_path, in case there are any + * regproc or similar constants to be printed. + */ + (void) set_config_option("search_path", "pg_catalog", + PGC_USERSET, PGC_S_SESSION, + GUC_ACTION_SAVE, true, 0, false); + return nestlevel; } diff --git a/sqlite_fdw.h b/sqlite_fdw.h index fe210ec6..aa047233 100644 --- a/sqlite_fdw.h +++ b/sqlite_fdw.h @@ -50,7 +50,7 @@ #endif /* Code version is updated at new release. */ -#define CODE_VERSION 20200 +#define CODE_VERSION 20300 #if (PG_VERSION_NUM < 100000) /* @@ -364,5 +364,5 @@ void sqlite_cache_stmt(ForeignServer *server, sqlite3_stmt * *stmt); Datum sqlite_convert_to_pg(Oid pgtyp, int pgtypmod, sqlite3_stmt * stmt, int attnum, AttInMetadata *attinmeta); void sqlite_bind_sql_var(Oid type, int attnum, Datum value, sqlite3_stmt * stmt, bool *isnull); -extern void sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level); +extern void sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level, List **busy_connection); #endif /* SQLITE_FDW_H */