Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
99cd2f8
feat: propagate GEOMETRY CRS through PostGIS in both directions
jatorre Mar 20, 2026
640b9fa
fix(postgres_utils): preserve GEOMETRY CRS through CREATE TABLE AS
jatorre Apr 25, 2026
aded053
Fix error message for Postgres connection failure
MBkkt Jul 2, 2026
4f0c4cb
Merge pull request #492 from MBkkt/patch-1
staticlibs Jul 2, 2026
4bee0f4
first attempt to enable use_information_schema for ATTACH
seb-ant Jul 3, 2026
796e68d
Merge pull request #493 from khepin/use_info_schema
staticlibs Jul 3, 2026
777c0e9
Follow-up format for 493
staticlibs Jul 3, 2026
74b8d3f
Submodules bump to 2daa4fc9a4
staticlibs Jul 3, 2026
90328df
fix: catalog cache loading race
hello-world-bfree Jul 7, 2026
ce5d107
Merge pull request #499 from hello-world-bfree/fix/postgres-catalog-l…
staticlibs Jul 8, 2026
d4c447d
fix: prevent catalog scan use-after-free
hello-world-bfree Jul 8, 2026
f8537b8
fix: synchronize ReferenceEntry
hello-world-bfree Jul 8, 2026
5a456c7
VARCHAR fallback for types in inaccessible schema
staticlibs Jul 8, 2026
dbaf7f4
Merge pull request #501 from hello-world-bfree/fix/postgres-catalogse…
staticlibs Jul 8, 2026
c782d6f
fix: avoid crash by setting default index constraint type
hello-world-bfree Jul 8, 2026
3dc5744
Merge pull request #508 from hello-world-bfree/fix/postgres-indexes-c…
staticlibs Jul 9, 2026
d335398
Allow ATTACHing to multiple Postgres schemas
staticlibs Jul 9, 2026
d26fd99
fix: detect Postgres table catalog staleness
hello-world-bfree Jul 10, 2026
cb4efea
Apply .github/patches/extensions/postgres_scanner/0014-freeloaded-inc…
carlopi Jul 11, 2026
cd4be97
Apply .github/patches/extensions/postgres_scanner/0015-logging-includ…
carlopi Jul 11, 2026
2a07470
Apply .github/patches/extensions/postgres_scanner/0016-log-macro-mana…
carlopi Jul 11, 2026
9175138
Apply .github/patches/extensions/postgres_scanner/0017-log-manager-in…
carlopi Jul 11, 2026
072c3e2
Apply .github/patches/extensions/postgres_scanner/zzzzzzzz-zz-connect…
carlopi Jul 11, 2026
b700d0e
Bump duckdb to dfd87550849406b1823812222ef92525724780d3
carlopi Jul 11, 2026
ad69a89
Apply the text protocol opt-out on the postgres_query (CONNECT) path
carlopi Jul 11, 2026
cd77c70
Merge pull request #515 from carlopi/fixup_connect_redshift
staticlibs Jul 11, 2026
b1cb71a
Remove varchar_array from test
carlopi Jul 12, 2026
2c9e18a
fix: support wire compat. enable custom staleness query.
hello-world-bfree Jul 10, 2026
4442b42
fix: gate tests correctly for shorter ci time
hello-world-bfree Jul 12, 2026
d684b82
Merge pull request #514 from hello-world-bfree/fix/postgres-catalog-c…
staticlibs Jul 12, 2026
a4e03aa
Merge pull request #516 from carlopi/bump_duckdb
staticlibs Jul 12, 2026
c669681
fix: resolve ON CONFLICT target after DROP COLUMN
CatherineThompson Jul 17, 2026
21012c3
CI extension load fix
staticlibs Jul 18, 2026
d3a2b2a
Fix catalog staleness option
staticlibs Jul 18, 2026
35ee7df
Support insertion with plain INSERTs
staticlibs Jul 19, 2026
9ae1ba6
Allow synchronous snapshot on replicas and in RDS/Aurora
jgmills98 Jul 20, 2026
ba06cb6
Merge pull request #523 from CatherineThompson/ct-logical-col-index
staticlibs Jul 20, 2026
75e7f33
Merge pull request #524 from jgmills98/allow-sync-snapshot-on-replicas
staticlibs Jul 21, 2026
b7632f3
Pin the first scan connection in multi-scan streaming queries
jgmills98 Jul 22, 2026
0106fd9
Drop postgres 9.6 support
jgmills98 Jul 22, 2026
b07870f
Merge pull request #527 from jgmills98/pin-first-scan-connection
staticlibs Jul 23, 2026
f190c59
Merge pull request #528 from jgmills98/drop-9-6-support
staticlibs Jul 23, 2026
e69282f
Reject out-of-range Postgres timestamps
Jul 24, 2026
52f943c
Fix timestamp constant formatting
Jul 24, 2026
2a09f4f
Merge pull request #530 from marknefedov/fix/postgres-timestamp-overflow
staticlibs Jul 24, 2026
7f446ab
Drain libpq results before throwing
Jul 24, 2026
cf7c800
Use the constant config when writing blob IN list literals
Jul 24, 2026
a404c80
Skip the COPY file header when scanning for row boundaries
Jul 24, 2026
46e2929
Merge pull request #531 from marknefedov/fix/undrained-state
staticlibs Jul 25, 2026
9ab3255
Merge pull request #532 from marknefedov/fix/binary-copy-header-bound…
staticlibs Jul 25, 2026
c809ae0
Update database-connector submodule
staticlibs Jul 25, 2026
4daa465
Merge pull request #534 from marknefedov/fix/blob-in-pushdown-constan…
staticlibs Jul 25, 2026
8207dd5
Move more logic to common connection pool
staticlibs Aug 3, 2026
871e258
add connect_display option
Tmonster Aug 5, 2026
b0530b4
add some more tests
Tmonster Aug 5, 2026
99e174f
Use configure_pool template from common repo
staticlibs Aug 5, 2026
3de69ac
Merge pull request #544 from Tmonster/add_connect_display_option_para…
staticlibs Aug 5, 2026
dbb444e
Fix idle transaction timeout error reporting
xjn2005 Aug 5, 2026
4f06dff
Fix idle transaction timeout error reporting
xjn2005 Aug 6, 2026
0e6655b
Fix idle transaction timeout test under TLS
xjn2005 Aug 6, 2026
e2e912d
Merge pull request #543 from xjn2005/issue378
staticlibs Aug 6, 2026
4975792
Fix connection pool slot leak on COMMIT failure
staticlibs Aug 6, 2026
1ab2381
Use transaction manager from common repo
staticlibs Aug 7, 2026
05ec025
Add a test to cover parallel scans safety
staticlibs Aug 10, 2026
757a631
Return row count for DML queries in postgres_query
staticlibs Aug 11, 2026
75d5ea8
Make postgres_execute an alias to postgres_query
staticlibs Aug 11, 2026
c1f9710
Suppress DML output only in CONNECT mode
staticlibs Aug 14, 2026
f9f9e1a
Fix two libpq resource-handling bugs on COPY error paths
sfc-gh-mslot Aug 21, 2026
1279dca
Merge pull request #555 from sfc-gh-mslot/fix-libpq-resource-leaks
staticlibs Aug 21, 2026
8422ea3
Update submodules to 326202015f
staticlibs Aug 20, 2026
66b9a06
Update vcpkg and libpq
staticlibs Aug 28, 2026
c91ea57
Update submodules to DuckDB 8616efa9da
staticlibs Aug 29, 2026
14a2f3a
- added numeric -> varchar cast
jgmills98 Aug 29, 2026
0735df0
Merge pull request #560 from jgmills98/numeric-varchar
staticlibs Aug 31, 2026
50dd6aa
Add detection of out-of-bound NUMERICs
staticlibs Sep 1, 2026
fffcb35
Allow non-preparable queries in postgres_query
staticlibs Sep 2, 2026
83f98e4
apply patches from duckdb v2.0-cyanoptera
carlopi Sep 3, 2026
a9f6f70
bump duckdb references to v2.0.0
carlopi Sep 3, 2026
67d4639
Format fix
carlopi Sep 3, 2026
33ae590
Serialize MERGE INTO actions
staticlibs Sep 4, 2026
40d9492
Update duckdb version to include relassert fix
staticlibs Sep 4, 2026
bc6aab5
Merge pull request #567 from staticlibs/apply-patches-e077bc6306fc227…
staticlibs Sep 4, 2026
7f3ae52
Support PREPARE/EXECUTE interleaved with DETACH
staticlibs Sep 11, 2026
14d7b2b
Retry the first Postgres connection once
staticlibs Sep 11, 2026
d397312
Add concurrent tests for catalog cache
staticlibs Sep 12, 2026
d57412f
Merge pull request #418 from jatorre/fix/geometry-srid-ewkb
staticlibs Sep 18, 2026
cf928c7
Submodules and CI reference update
staticlibs Sep 23, 2026
07d6d1f
Absorb 0001-fix-ninja-1.13-meson-install.patch
staticlibs Sep 23, 2026
5120063
Absorb 0002-table-catalog-entry-columns.patch
staticlibs Sep 23, 2026
3e01563
Absorb 0003-literal-constant-expression.patch
staticlibs Sep 23, 2026
2dfa08d
Merge pull request #580 from staticlibs/submodules_and_patches
staticlibs Sep 24, 2026
74c1ef8
bump duckdb references to v2.0.0
maiadegraaf Sep 25, 2026
3a76064
Filter pushdown enhancements for table scans
staticlibs Sep 29, 2026
dd7cdff
Absorb 0001-table-function-signature-options.patch
staticlibs Oct 1, 2026
32ef1ba
Update submodules
staticlibs Oct 1, 2026
2b6ef82
Remove DONT_LINK
staticlibs Oct 1, 2026
052a9d3
Format fix
staticlibs Oct 1, 2026
6ac3e6a
Test script fix
staticlibs Oct 1, 2026
f9db66e
Merge pull request #585 from staticlibs/apply_patches
staticlibs Oct 1, 2026
a119f4d
apply patches from duckdb v2.0-cyanoptera
maiadegraaf Oct 6, 2026
64bc0df
bump duckdb references to v2.0.0
maiadegraaf Oct 6, 2026
6a85943
Test output fix
staticlibs Oct 6, 2026
5a9e81c
Absorb 0003-catalog-set-concurrent-clear.patch
staticlibs Oct 5, 2026
a0fcfde
Merge pull request #588 from staticlibs/apply-patches-f4a378b1d1521be…
staticlibs Oct 6, 2026
45697e9
bump duckdb references to v2.0.0
duckdblabs-bot Oct 8, 2026
98ee7fc
Rename clear-cache function
staticlibs Oct 8, 2026
16737d4
Remove attach and scan functions
staticlibs Oct 8, 2026
b443fd1
Submodule update
staticlibs Oct 9, 2026
5fa3ccb
Absorb 0003-table-function-get-table-entry.patch
staticlibs Oct 9, 2026
936bf68
Make COPY binary format length checks an error instead of D_ASSERT
gavinwahl Oct 11, 2026
1bda7b6
Merge pull request #595 from gavinwahl/binary-parser-length-checks
staticlibs Oct 11, 2026
52aed68
Filter out allow_quoted_nulls CSV import option
staticlibs Oct 11, 2026
8d201d4
Merge pull request #593 from duckdb/duckdb-bump/main
staticlibs Oct 11, 2026
df96cc8
bump duckdb references to v2.0.0 (2658ef961f)
carlopi Oct 12, 2026
8a46d40
Fix libpq C99 check with clang-cl
Oct 12, 2026
21b85fe
Add plain query binary reader
staticlibs Oct 12, 2026
e2d4844
ctid scan fix for plain query mode
staticlibs Oct 12, 2026
1e18d1c
Fall back to text inserts for unsupported types
staticlibs Oct 12, 2026
1289238
Merge pull request #599 from carlopi/duckdb-bump/main
staticlibs Oct 12, 2026
57f857e
Merge pull request #600 from smvv/fix-clang-cl-libpq-c99-test
staticlibs Oct 12, 2026
782fe1a
Fix cardinality call
staticlibs Oct 12, 2026
c635fbd
Outdated comment fix
staticlibs Oct 12, 2026
f5bde76
Inline the binary COPY parser's length and bounds checks
gavinwahl Oct 12, 2026
b4af341
Merge pull request #601 from staticlibs/plain_query_binary_reader
staticlibs Oct 13, 2026
d60bc85
Merge pull request #603 from gavinwahl/binary-parser-inline-helpers
staticlibs Oct 13, 2026
62bdc41
Set the chunk's cardinality once per chunk when reading binary COPY
gavinwahl Oct 12, 2026
3d1c12f
Chunk cardinality fix in text reader
staticlibs Oct 13, 2026
37cea87
Remove ORDER pushdown optimizer
staticlibs Oct 12, 2026
bfe14d8
Autodetect query mode when params are specified
staticlibs Oct 12, 2026
5e88eaf
Merge pull request #607 from staticlibs/copy-cardinality-once-per-chunk
staticlibs Oct 13, 2026
9e93d92
Fix libpq Meson detection for clang-cl
Oct 13, 2026
5f2f969
Fix binary NUMERIC-to-DOUBLE rounding
ItsM0rty Oct 13, 2026
9c0c895
Update giant numeric expectations after rounding fix
ItsM0rty Oct 13, 2026
a40dae3
Merge pull request #609 from smvv/fix-clang-cl-libpq-msvc-abi
staticlibs Oct 13, 2026
ae8ae90
Merge pull request #610 from ItsM0rty/fix/numeric-double-rounding
staticlibs Oct 13, 2026
47730ea
Allow running postgres_query on a specific conn
staticlibs Oct 13, 2026
565df41
Bump database-connector for the pushdown of TIMESTAMPTZ constants and…
PeterVanHolland Oct 13, 2026
25cb64c
Submodule update
staticlibs Oct 13, 2026
048f23c
Merge pull request #615 from staticlibs/pushdown_timestamptz_conjunction
staticlibs Oct 13, 2026
9671d2c
Pushdown option rename
staticlibs Oct 13, 2026
ef48123
Pass DuckDB label as a default application_name
staticlibs Oct 14, 2026
33d50e5
Do not run app_name test on PgBouncer
staticlibs Oct 14, 2026
7c696fe
Merge pull request #617 from staticlibs/app_name
staticlibs Oct 14, 2026
b717f7f
Put the default application_name into URI connection strings instead …
PeterVanHolland Oct 15, 2026
ed73241
Merge pull request #619 from PeterVanHolland/uri_application_name
staticlibs Oct 15, 2026
4f73f18
Do not wrap postgres_query SQL unless necessary
staticlibs Oct 15, 2026
c0f5a3c
Deduplicate column names from postgres_query
staticlibs Oct 15, 2026
d27212f
bump duckdb references to v2.0.0
duckdblabs-bot Oct 19, 2026
7ccd4ee
Per-attach CTID scan
leo-altertable Jun 30, 2026
b40978b
Bump DuckDB to altertable-2.0.0 (v2.0.0, 24f6388b5e)
leo-altertable Oct 22, 2026
1c19e88
Format the per-attach CTID scan change
leo-altertable Nov 2, 2026
cce83f4
Bump action-setup-postgres to v9 for the ubuntu-26.04 runner image
leo-altertable Nov 2, 2026
ac5de1f
Test PgBouncer against Postgres 15 as the oldest version
leo-altertable Nov 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions .github/workflows/IntegrationTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:

env:
GEN: ninja
CC: 'ccache gcc'
CXX: 'ccache g++'
CC: '/usr/lib/ccache/gcc'
CXX: '/usr/lib/ccache/g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
vcpkgGitCommitId: 9e593bb18ea69cc5095e012465dcd675a822ed0d # Release 2026.07.29

- name: Build extension
run: |
Expand All @@ -98,7 +98,7 @@ jobs:
key: ${{ steps.cache_key.outputs.value }}

- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
uses: ikalnytskyi/action-setup-postgres@v9
with:
postgres-version: 17
username: 'postgres'
Expand All @@ -114,6 +114,7 @@ jobs:
PGUSER: postgres
PGPASSWORD: postgres
POSTGRES_TEST_DATABASE_AVAILABLE: 1
POSTGRES_CONNECTION_IS_DIRECT: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
run: |
source ./create-postgres-tables.sh
Expand All @@ -128,15 +129,15 @@ jobs:
strategy:
matrix:
postgres:
- name: pg-14
version: 14
- name: pg-15
version: 15
- name: pg-18
version: 18

env:
GEN: ninja
CC: 'ccache gcc'
CXX: 'ccache g++'
CC: '/usr/lib/ccache/gcc'
CXX: '/usr/lib/ccache/g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
Expand Down Expand Up @@ -176,14 +177,14 @@ jobs:
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
vcpkgGitCommitId: 9e593bb18ea69cc5095e012465dcd675a822ed0d # Release 2026.07.29

- name: Build extension
run: |
make release

- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
uses: ikalnytskyi/action-setup-postgres@v9
with:
postgres-version: ${{ matrix.postgres.version }}
username: 'postgres'
Expand Down Expand Up @@ -269,8 +270,8 @@ jobs:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
CC: 'ccache gcc'
CXX: 'ccache g++'
CC: '/usr/lib/ccache/gcc'
CXX: '/usr/lib/ccache/g++'
CCACHE_DIR: ${{ github.workspace }}/ccache
VCPKG_TARGET_TRIPLET: x64-linux-release
VCPKG_HOST_TRIPLET: x64-linux-release
Expand Down Expand Up @@ -310,7 +311,7 @@ jobs:
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
vcpkgGitCommitId: 9e593bb18ea69cc5095e012465dcd675a822ed0d # Release 2026.07.29

- name: Build extension
env:
Expand All @@ -328,7 +329,7 @@ jobs:
key: ${{ steps.cache_key.outputs.value }}

- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
uses: ikalnytskyi/action-setup-postgres@v9
with:
postgres-version: 17
username: 'postgres'
Expand All @@ -345,6 +346,8 @@ jobs:
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
POSTGRES_CONNECTION_IS_DIRECT: 1
SANITIZER_BUILD: 1
LOCAL_EXTENSION_REPO: 'build/relassert/repository'
run: |
source ./create-postgres-tables.sh
Expand Down Expand Up @@ -420,7 +423,7 @@ jobs:
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 84bab45d415d22042bd0b9081aea57f362da3f35
vcpkgGitCommitId: 9e593bb18ea69cc5095e012465dcd675a822ed0d # Release 2026.07.29

- name: Prepare build tree
shell: bash
Expand All @@ -442,7 +445,7 @@ jobs:
key: ${{ steps.cache_key.outputs.value }}

- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v8
uses: ikalnytskyi/action-setup-postgres@v9
with:
postgres-version: '17'
username: 'postgres'
Expand Down Expand Up @@ -470,6 +473,7 @@ jobs:
PGPASSWORD: postgres
PGSSLMODE: require
POSTGRES_TEST_DATABASE_AVAILABLE: 1
POSTGRES_CONNECTION_IS_DIRECT: 1
LOCAL_EXTENSION_REPO: 'build/release/repository'
shell: bash
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
name: Build extension binaries
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
with:
duckdb_version: main
ci_tools_version: main
extension_name: postgres_scanner
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_mingw'
Expand All @@ -27,7 +26,6 @@ jobs:
uses: duckdb/extension-ci-tools/.github/workflows/_extension_deploy.yml@main
secrets: inherit
with:
duckdb_version: main
ci_tools_version: main
extension_name: postgres_scanner
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_mingw'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ cmake-build-debug
.vscode
.cache
duckdb_unittest_tempdir
.envrc
docker-compose.yml
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "duckdb"]
path = duckdb
url = https://github.com/duckdb/duckdb.git
url = https://github.com/altertable-ai/duckdb
[submodule "extension-ci-tools"]
path = extension-ci-tools
url = https://github.com/duckdb/extension-ci-tools.git
Expand Down
61 changes: 21 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,22 @@ cmake_minimum_required(VERSION 2.8.12...3.29)
set(TARGET_NAME postgres_scanner)
project(${TARGET_NAME})

add_definitions(
-DFRONTEND=1
-D_GNU_SOURCE=1
-DUSE_OPENSSL=1
-DHAVE_BIO_GET_DATA=1
-DHAVE_BIO_METH_NEW=1)
add_definitions(-DFRONTEND=1 -D_GNU_SOURCE=1 -DUSE_OPENSSL=1
-DHAVE_BIO_GET_DATA=1 -DHAVE_BIO_METH_NEW=1)

find_package(OpenSSL REQUIRED)
find_package(PostgreSQL REQUIRED)

if(NOT MSVC)
add_compile_options(
-Wno-pedantic
-Wno-sign-compare
-Wno-unused-variable)
add_compile_options(-Wno-pedantic -Wno-sign-compare -Wno-unused-variable)
endif()

include_directories(
include
database-connector/src/include
${OPENSSL_INCLUDE_DIR}
${PostgreSQL_INCLUDE_DIRS})
include_directories(include database-connector/src/include
${OPENSSL_INCLUDE_DIR} ${PostgreSQL_INCLUDE_DIRS})

if(WIN32)
include_directories(
vcpkg_ports/libpq/include/port/win32
vcpkg_ports/libpq/include/port/win32_msvc)
include_directories(vcpkg_ports/libpq/include/port/win32
vcpkg_ports/libpq/include/port/win32_msvc)
endif()

add_subdirectory(src)
Expand All @@ -40,35 +29,27 @@ set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
build_static_extension(${TARGET_NAME} ${ALL_OBJECT_FILES})
build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${ALL_OBJECT_FILES})

# Fix for ELF symbol conflict when loaded inside PostgreSQL backend
# Use -Bsymbolic to force the extension to prefer its own symbols over global ones
# This fixes the pg_link_canary_is_frontend() check failure where calls from within
# this extension resolve to the backend's version (returns false) instead of ours (returns true)
# Fix for ELF symbol conflict when loaded inside PostgreSQL backend Use
# -Bsymbolic to force the extension to prefer its own symbols over global ones
# This fixes the pg_link_canary_is_frontend() check failure where calls from
# within this extension resolve to the backend's version (returns false) instead
# of ours (returns true)
if(NOT WIN32 AND NOT APPLE)
target_link_options(${LOADABLE_EXTENSION_NAME} PRIVATE
"-Wl,-Bsymbolic"
)
target_link_options(${LOADABLE_EXTENSION_NAME} PRIVATE "-Wl,-Bsymbolic")
endif()

target_link_libraries(${LOADABLE_EXTENSION_NAME}
OpenSSL::SSL
OpenSSL::Crypto
PostgreSQL::PostgreSQL
${CURL_LIBRARIES})
target_link_libraries(${LOADABLE_EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto
PostgreSQL::PostgreSQL ${CURL_LIBRARIES})
set_property(TARGET ${EXTENSION_NAME} PROPERTY C_STANDARD 99)
set_property(TARGET ${LOADABLE_EXTENSION_NAME} PROPERTY C_STANDARD 99)

if(WIN32)
target_link_libraries(${LOADABLE_EXTENSION_NAME}
wsock32
ws2_32
wldap32
secur32
crypt32)
target_link_libraries(${LOADABLE_EXTENSION_NAME} wsock32 ws2_32 wldap32
secur32 crypt32)
endif()

install(
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ D SELECT * FROM postgres_db.uuids;

For more information on how to use the connector, refer to the [Postgres documentation on the website](https://duckdb.org/docs/extensions/postgres).

### Connection Pooling

By default, the extension opens a new connection whenever none are idle. Behind a transaction-mode pooler (e.g. PgBouncer `pool_mode=transaction`), this can exceed the pooler's own pool size under load and hang. If that applies to you, cap and wait instead:

```sql
SET pg_pool_acquire_mode = 'wait';
SET pg_pool_max_connections = 16; -- ~80-90% of your pooler's pool size

ATTACH 'host=pgbouncer-host port=6432 dbname=mydb' AS postgres_db (TYPE postgres);
```

Note that `SET` statements are global and only apply pre-`ATTACH`. To change pooling on an already-attached database, use `postgres_configure_pool(catalog_name=...)` instead. Leave `force` mode if you connect directly to Postgres or through a session-mode pooler.

### AWS RDS IAM Authentication

The extension supports AWS RDS IAM-based authentication, which allows you to connect to RDS/Aurora PostgreSQL instances using IAM database authentication instead of static passwords. This feature automatically generates temporary authentication tokens using the AWS SDK.
Expand Down
5 changes: 3 additions & 2 deletions create-postgres-tables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ CALL dbgen(sf=0.01, schema='tpch');
CALL dsdgen(sf=0.01, schema='tpcds');
EXPORT DATABASE '${ABS_DIR_PREFIX}/postgresscannertmp';
" | \
$DUCKDB_PATH
$DUCKDB_PATH -unsigned

dropdb --if-exists postgresscanner
createdb postgresscanner

psql -d postgresscanner < ${ABS_DIR_PREFIX}/postgresscannertmp/schema.sql
psql -d postgresscanner < ${ABS_DIR_PREFIX}/postgresscannertmp/load.sql
sed -E "s/,\s*allow_quoted_nulls\s+[^,)]+//g" ${ABS_DIR_PREFIX}/postgresscannertmp/load.sql > ${ABS_DIR_PREFIX}/postgresscannertmp/load_filtered.sql
psql -d postgresscanner < ${ABS_DIR_PREFIX}/postgresscannertmp/load_filtered.sql
rm -rf ${ABS_DIR_PREFIX}/postgresscannertmp

psql -d postgresscanner < test/all_pg_types.sql
Expand Down
2 changes: 1 addition & 1 deletion database-connector
2 changes: 1 addition & 1 deletion duckdb
Submodule duckdb updated 7689 files
1 change: 0 additions & 1 deletion extension_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Extension from this repo
duckdb_extension_load(postgres_scanner
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
DONT_LINK
)

duckdb_extension_load(tpch)
Expand Down
14 changes: 7 additions & 7 deletions scripts/win_resources.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 24afa3db42..d3f04aed2d 100644
index 9dd2ea45d2..a583df2d9a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -130,7 +130,6 @@ if(WIN32 AND NOT MINGW)
@@ -132,7 +132,6 @@ if(WIN32 AND NOT MINGW)
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${RC_DEV_ITERATION}\"")

Expand All @@ -11,14 +11,14 @@ index 24afa3db42..d3f04aed2d 100644

install(
diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt
index 0d26359008..04c5c7f01f 100644
index 7c376be703..956a2df514 100644
--- a/tools/shell/CMakeLists.txt
+++ b/tools/shell/CMakeLists.txt
@@ -77,7 +77,6 @@ if(WIN32 AND NOT MINGW)
@@ -74,7 +74,6 @@ if(WIN32 AND NOT MINGW)
"${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${RC_DEV_ITERATION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_COPYRIGHT_YEAR=\"${DUCKDB_COPYRIGHT_YEAR}\"")
- target_sources(shell PRIVATE rc/duckdb.rc)
endif()

set_target_properties(shell PROPERTIES OUTPUT_NAME duckdb)
# Opt into the Windows Segment Heap to avoid the default NT heap's lock
# contention under multi-threaded allocation (see #24027). CMake merges
# .manifest sources into the linker manifest via mt.exe.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ add_subdirectory(storage)

add_library(
postgres_ext_library OBJECT
postgres_attach.cpp
postgres_aws.cpp
postgres_binary_copy.cpp
postgres_binary_file_reader.cpp
postgres_binary_parser.cpp
postgres_binary_reader.cpp
postgres_connection_string.cpp
postgres_connection.cpp
postgres_copy_from.cpp
postgres_copy_to.cpp
postgres_execute.cpp
postgres_extension.cpp
postgres_filter_pushdown.cpp
postgres_hstore.cpp
postgres_parameters.cpp
postgres_pin_connection.cpp
postgres_query.cpp
postgres_scanner.cpp
postgres_secrets.cpp
Expand Down
7 changes: 4 additions & 3 deletions src/dbconnector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ set(POSTGRES_DBCONNECTOR_PATH

add_library(
postgres_ext_dbconnector OBJECT
${POSTGRES_DBCONNECTOR_PATH}/src/attached/attached_catalog.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/attached/attached_table.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/functions/configure_pool.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/query/query_writer.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/table_scan/filter_pushdown.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/table_scan/filter_util.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/optimizer/aggregate_optimizer.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/optimizer/optimizer_util.cpp
${POSTGRES_DBCONNECTOR_PATH}/src/optimizer/order_by_and_limit_optimizer.cpp)
${POSTGRES_DBCONNECTOR_PATH}/src/optimizer/optimizer_util.cpp)

set(ALL_OBJECT_FILES
${ALL_OBJECT_FILES} $<TARGET_OBJECTS:postgres_ext_dbconnector>
Expand Down
1 change: 1 addition & 0 deletions src/include/postgres_aws.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include <cstdint>
#include "duckdb/main/attached_database.hpp"
#include <string>

#include "duckdb.hpp"
Expand Down
Loading
Loading