Skip to content

Commit b259a10

Browse files
authored
Merge branch 'main' into test-all-types-duckdb
2 parents 18b655d + 64685a4 commit b259a10

Some content is hidden

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

49 files changed

+810
-280
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install clang-format and ruff
2323
run: python3 -m pip install -r dev_requirements.txt
2424
- name: Run clang-format
25-
run: git clang-format refs/remotes/origin/main --diff
25+
run: find src include -iname '*.hpp' -o -iname '*.h' -o -iname '*.cpp' -o -iname '*.c' | xargs git clang-format --diff origin/main
2626
- name: Run ruff check
2727
run: ruff check --output-format=github .
2828
- name: Run ruff format

.github/workflows/docker.yaml

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Build Docker
22

3+
permissions:
4+
id-token: write
5+
contents: write
6+
37
on:
48
push:
59
tags: ["v*"]
@@ -13,40 +17,114 @@ on:
1317
workflow_dispatch:
1418

1519
jobs:
16-
docker:
17-
name: Build Docker
18-
runs-on: ubuntu-24.04
20+
docker_build:
21+
name: Build Docker image for Postgres ${{ matrix.postgres }} on ${{ matrix.runner }}
1922
strategy:
2023
matrix:
2124
postgres: ["14", "15", "16", "17"]
25+
runner: ["ubuntu-24.04", "ubuntu-24.04-arm"]
2226

27+
runs-on: ${{ matrix.runner }}
28+
29+
env:
30+
BUILDKIT_PROGRESS: plain
31+
POSTGRES_VERSION: ${{ matrix.postgres }}
32+
outputs:
33+
branch_tag: ${{ steps.params.outputs.branch_tag }}
34+
target_repo: ${{ steps.params.outputs.target_repo }}
2335
steps:
2436
- name: Login to Docker Hub
2537
uses: docker/login-action@v3
2638
with:
2739
username: pgduckdb
2840
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
2942
- name: Checkout pg_duckdb extension code
3043
uses: actions/checkout@v4
3144
with:
3245
submodules: "recursive"
33-
- name: Set env
46+
47+
- name: Compute job parameters
48+
id: params
3449
run: |
35-
echo "POSTGRES_VERSION=${{ matrix.postgres }}" >> $GITHUB_ENV
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
50+
# Tag is XX-YYYYY-<branch>-latest so 16 + branch name length
51+
# since maximum docker tag is 128 characters, we need to truncate the branch name to 112
52+
BRANCH=$(echo "${{ github.head_ref || github.ref_name }}" \
53+
| sed 's/[^a-zA-Z0-9\-\.]/-/g' \
54+
| cut -c 1-112 | tr '[:upper:]' '[:lower:]' \
55+
| sed -e 's/-*$//')
56+
57+
# Set platform depending on which runner we're using
58+
if [ "${{ matrix.runner }}" = "ubuntu-24.04" ]; then
59+
PLATFORM=amd64
60+
else
61+
PLATFORM=arm64
62+
fi
63+
64+
# If main or tag, then push to `pgduckdb/pgduckdb`
65+
git fetch --tags --force
66+
if [ "$BRANCH" = "main" ] || git rev-parse --verify $BRANCH^{tag} > /dev/null 2>&1; then
67+
TARGET_REPO='pgduckdb/pgduckdb'
68+
else
69+
TARGET_REPO='pgduckdb/ci-builds'
70+
fi
71+
72+
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
73+
echo "branch_tag=$BRANCH" >> "$GITHUB_OUTPUT"
74+
echo "target_repo=$TARGET_REPO" >> "$GITHUB_OUTPUT"
75+
echo "latest_image=pgduckdb/ci-builds:${{ matrix.postgres }}-${PLATFORM}-${BRANCH}-latest" >> "$GITHUB_OUTPUT"
76+
77+
- name: Attempt to pull previous image
78+
run: |
79+
docker pull ${{ steps.params.outputs.latest_image }} || true
80+
docker pull moby/buildkit:buildx-stable-1
81+
3882
- name: Set up Docker buildx
3983
uses: docker/setup-buildx-action@v3
4084
with:
41-
platforms: linux/amd64,linux/arm64
85+
platforms: linux/${{ steps.params.outputs.platform }}
86+
4287
- name: docker bake
4388
uses: docker/bake-action@v5
4489
with:
4590
targets: pg_duckdb_${{ matrix.postgres }}
4691
push: true
4792
set: |
48-
*.platform=linux/amd64,linux/arm64
49-
*.cache-to=type=gha,mode=max
50-
*.cache-from=type=gha
51-
postgres.tags=pgduckdb/pgduckdb:${{ matrix.postgres }}-${{ github.sha }}
52-
${{ !contains(github.ref_name, '/') && format('postgres.tags=pgduckdb/pgduckdb:{0}-{1}', matrix.postgres, github.ref_name) || '' }}
93+
*.platform=linux/${{ steps.params.outputs.platform }}
94+
*.cache-from=type=registry,ref=${{ steps.params.outputs.latest_image }}
95+
*.cache-from=type=gha,scope=${{ github.workflow }}
96+
*.cache-to=type=gha,mode=max,scope=${{ github.workflow }}
97+
postgres.tags=pgduckdb/ci-builds:${{ matrix.postgres }}-${{ steps.params.outputs.platform }}-${{ github.sha }}
98+
postgres.tags=${{ steps.params.outputs.latest_image }}
99+
100+
docker_merge:
101+
name: Merge Docker image for Postgres ${{ matrix.postgres }}
102+
strategy:
103+
matrix:
104+
postgres: ["14", "15", "16", "17"]
105+
106+
runs-on: ubuntu-24.04
107+
needs: docker_build
108+
steps:
109+
- name: Login to Docker Hub
110+
uses: docker/login-action@v3
111+
with:
112+
username: pgduckdb
113+
password: ${{ secrets.DOCKERHUB_TOKEN }}
114+
115+
- name: Merge images
116+
run: |
117+
docker pull --platform linux/amd64 pgduckdb/ci-builds:${{ matrix.postgres }}-amd64-${{ github.sha }}
118+
docker pull --platform linux/arm64 pgduckdb/ci-builds:${{ matrix.postgres }}-arm64-${{ github.sha }}
119+
120+
BRANCH="${{ needs.docker_build.outputs.branch_tag }}"
121+
TARGET_REPO="${{ needs.docker_build.outputs.target_repo }}"
122+
123+
echo "Will push merged image to '${TARGET_REPO}'."
124+
docker buildx imagetools create \
125+
--tag ${TARGET_REPO}:${{ matrix.postgres }}-${BRANCH} \
126+
--tag pgduckdb/ci-builds:${{ matrix.postgres }}-${{ github.sha }} \
127+
pgduckdb/ci-builds:${{ matrix.postgres }}-amd64-${{ github.sha }} \
128+
pgduckdb/ci-builds:${{ matrix.postgres }}-arm64-${{ github.sha }}
129+
130+
docker buildx imagetools inspect pgduckdb/ci-builds:${{ matrix.postgres }}-${{ github.sha }}

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
# 0.3.1 (2025-02-13)
2+
3+
## Fixed
4+
5+
- Fixed CI so docker images are built and pushed to Docker Hub for tags. ([#589])
6+
7+
[#589]: https://github.com/duckdb/pg_duckdb/pull/589
8+
9+
# 0.3.0 (2025-02-13)
10+
11+
## Added
12+
13+
- Support using Postgres indexes and reading from partitioned tables. ([#477])
14+
- The `AS (id bigint, name text)` syntax is no longer supported when using `read_parquet`, `iceberg_scan`, etc. The new syntax is as follows: ([#531])
15+
16+
```sql
17+
SELECT * FROM read_parquet('file.parquet');
18+
SELECT r['id'], r['name'] FROM read_parquet('file.parquet') r WHERE r['age'] > 21;
19+
```
20+
21+
- Add a `duckdb.query` function which allows using DuckDB query syntax in Postgres. ([#531])
22+
- Support the `approx_count_distinct` DuckDB aggregate. ([#499])
23+
- Support the `bytea` (aka blob), `uhugeint`,`jsonb`, `timestamp_ns`, `timestamp_ms`, `timestamp_s` & `interval` types. ([#511], [#525], [#513], [#534], [(#573)])
24+
- Support DuckDB [json functions and aggregates](https://duckdb.org/docs/data/json/json_functions.html). ([#546])
25+
- Add support for the `duckdb.allow_community_extensions` setting.
26+
- We have an official logo! 🎉 ([#575])
27+
28+
## Changed
29+
30+
- Update to DuckDB 1.2.0. ([#548])
31+
- Allow executing `duckdb.raw_query`, `duckdb.cache_info`, `duckdb.cache_delete` and `duckdb.recycle_db` as non-superusers. ([#572])
32+
- Only sync MotherDuck catalogs when there is DuckDB query activity. ([#582])
33+
34+
## Fixed
35+
36+
- Correctly parse parameter lists in `COPY` commands. This allows using `PARTITION_BY` as one of the `COPY` options. ([#465])
37+
- Correctly read cache metadata for files larger than 4GB. ([#494])
38+
- Fix bug in parameter handling for prepared statements and PL/pgSQL functions. ([#491])
39+
- Fix comparisons and operators on the `timestamp with timezone` field by enabling DuckDB its `icu` extension by default. ([#512])
40+
- Allow using `read_parquet` functions when not using superuser privileges. ([#550])
41+
- Fix some case insensitivity issues when reading from Postgres tables. ([#563])
42+
- Fix case where cancel requests (e.g. triggered by pressing Ctrl+C in `psql`) would be ignored ([#548], [#584], [#587])
43+
44+
[#477]: https://github.com/duckdb/pg_duckdb/pull/477
45+
[#531]: https://github.com/duckdb/pg_duckdb/pull/531
46+
[#499]: https://github.com/duckdb/pg_duckdb/pull/499
47+
[#511]: https://github.com/duckdb/pg_duckdb/pull/511
48+
[#525]: https://github.com/duckdb/pg_duckdb/pull/525
49+
[#513]: https://github.com/duckdb/pg_duckdb/pull/513
50+
[#534]: https://github.com/duckdb/pg_duckdb/pull/534
51+
[#573]: https://github.com/duckdb/pg_duckdb/pull/573
52+
[#546]: https://github.com/duckdb/pg_duckdb/pull/546
53+
[#575]: https://github.com/duckdb/pg_duckdb/pull/575
54+
[#548]: https://github.com/duckdb/pg_duckdb/pull/548
55+
[#572]: https://github.com/duckdb/pg_duckdb/pull/572
56+
[#582]: https://github.com/duckdb/pg_duckdb/pull/582
57+
[#465]: https://github.com/duckdb/pg_duckdb/pull/465
58+
[#494]: https://github.com/duckdb/pg_duckdb/pull/494
59+
[#491]: https://github.com/duckdb/pg_duckdb/pull/491
60+
[#512]: https://github.com/duckdb/pg_duckdb/pull/512
61+
[#550]: https://github.com/duckdb/pg_duckdb/pull/550
62+
[#563]: https://github.com/duckdb/pg_duckdb/pull/563
63+
[#584]: https://github.com/duckdb/pg_duckdb/pull/584
64+
[#587]: https://github.com/duckdb/pg_duckdb/pull/587
65+
166
# 0.2.0 (2024-12-10)
267

368
## Added

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ USER postgres
2727
# Selectively copy the files that we need. Sadly we need separate COPY commands
2828
# for each directory, because docker puts only the contents of the source
2929
# directory into the target directory, and not the directory itself too.
30-
COPY --chown=postgres:postgres Makefile Makefile.global pg_duckdb.control .
30+
COPY --chown=postgres:postgres Makefile Makefile.global pg_duckdb.control ./
3131
COPY --chown=postgres:postgres .git/modules/third_party/duckdb/HEAD .git/modules/third_party/duckdb/HEAD
3232
COPY --chown=postgres:postgres sql sql
3333
COPY --chown=postgres:postgres src src

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OBJS += $(subst .c,.o, $(C_SRCS))
1313
# set to `make` to disable ninja
1414
DUCKDB_GEN ?= ninja
1515
# used to know what version of extensions to download
16-
DUCKDB_VERSION = v1.1.3
16+
DUCKDB_VERSION = v1.2.0
1717
# duckdb build tweaks
1818
DUCKDB_CMAKE_VARS = -DBUILD_SHELL=0 -DBUILD_PYTHON=0 -DBUILD_UNITTESTS=0
1919
# set to 1 to disable asserts in DuckDB. This is particularly useful in combinition with MotherDuck.
@@ -119,7 +119,7 @@ lintcheck:
119119
ruff check
120120

121121
format:
122-
git clang-format origin/main
122+
find src include -iname '*.hpp' -o -iname '*.h' -o -iname '*.cpp' -o -iname '*.c' | xargs git clang-format origin/main
123123
ruff format
124124

125125
format-all:

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<p align="center">
2-
<img width="500" src="logo.png" alt="temporary logo" />
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="logo-dark.svg">
4+
<img width="800" src="logo-light.svg" alt="pg_duckdb logo" />
5+
</picture>
36
</p>
47

5-
0.2.0 release is here 🎉 Please [try](#installation) it out!
8+
0.3.0 release is here 🎉 Please [try](#installation) it out!
69

710
# pg_duckdb: Official Postgres extension for DuckDB
811

@@ -19,9 +22,9 @@ See our [official documentation][docs] for further details.
1922
- If DuckDB cannot support the query for any reason, execution falls back to Postgres.
2023
- Read and Write support for object storage (AWS S3, Azure, Cloudflare R2, or Google GCS):
2124
- Read parquet, CSV and JSON files:
22-
- `SELECT n FROM read_parquet('s3://bucket/file.parquet') AS (n int)`
23-
- `SELECT n FROM read_csv('s3://bucket/file.csv') AS (n int)`
24-
- `SELECT n FROM read_json('s3://bucket/file.json') AS (n int)`
25+
- `SELECT * FROM read_parquet('s3://bucket/file.parquet')`
26+
- `SELECT r['id'], r['name'] FROM read_csv('s3://bucket/file.csv') r`
27+
- `SELECT count(*) FROM read_json('s3://bucket/file.json')`
2528
- You can pass globs and arrays to these functions, just like in DuckDB
2629
- Enable the DuckDB Iceberg extension using `SELECT duckdb.install_extension('iceberg')` and read Iceberg files with `iceberg_scan`.
2730
- Enable the DuckDB Delta extension using `SELECT duckdb.install_extension('delta')` and read Delta files with `delta_scan`.
@@ -32,8 +35,8 @@ See our [official documentation][docs] for further details.
3235

3336
```sql
3437
COPY (
35-
SELECT count(*), name
36-
FROM read_parquet('s3://bucket/file.parquet') AS (name text)
38+
SELECT count(*), r['name']
39+
FROM read_parquet('s3://bucket/file.parquet') r
3740
GROUP BY name
3841
ORDER BY count DESC
3942
) TO 's3://bucket/results.parquet';
@@ -149,9 +152,8 @@ Querying data stored in Parquet, CSV, JSON, Iceberg and Delta format can be done
149152
3. Perform analytics on your data.
150153

151154
```sql
152-
SELECT SUM(price) AS total, item_id
153-
FROM read_parquet('s3://your-bucket/purchases.parquet')
154-
AS (price float, item_id int)
155+
SELECT SUM(r['price']) AS total, r['item_id']
156+
FROM read_parquet('s3://your-bucket/purchases.parquet') r
155157
GROUP BY item_id
156158
ORDER BY total DESC
157159
LIMIT 100;

0 commit comments

Comments
 (0)