Skip to content

fix: make COPY work on a decoupled view with a vector column - #176

Merged
vyruss merged 2 commits into
mainfrom
fix/copy-vector-decoupled
Dec 5, 2026
Merged

vyruss merged 2 commits into
mainfrom
fix/copy-vector-decoupled

Conversation

@vyruss

@vyruss vyruss commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

COPY into a decoupled view with a vector column fails. Two fixes:

  • Drop OVERRIDING SYSTEM VALUE from the source of a clustered decoupled INSERT. COPY writes that clause, and DuckDB cannot parse it there.
  • Send a real[] constant to DuckDB as '[1,2,3]'. PostgreSQL writes '{1,2,3}', which DuckDB does not read.

No issue tracks this.

Checklist

  • The pull request links a tracking issue.
  • ./run-ci-local.sh passes (gofmt, golangci-lint, shellcheck, hadolint,
    actionlint, build, pg_regress, journey).
  • The change includes unit tests, written before the code, or the Testing
    section explains why it has none.
  • The change includes regression tests in extension/coldfront/test/, or
    the Testing section explains why it has none.
  • The Testing section notes any impact on the integration tests
    (ci/journey.sh and the CI matrix).
  • The change updates README.md and docs/, or the Notes for Reviewers
    explain why it needs no update.
  • The change adds no secrets, and the Risk section covers its security
    impact.
  • A bakery, mesh, or distributed change updates the TLA+ model and re-runs
    TLC (docs/formal/).
  • Author's AI review completed and findings addressed.
  • Commit messages are short and imperative.

Testing

ci/journey.sh: COPY loads a clustered vector table with each row in its nearest cluster, and a vector written under extra_float_digits = 0 keeps every digit. Both fail on main. No pg_regress test: the fix shows only in what DuckDB stores.

Risk

None that the checks miss. No security impact.

How to Revert

Revert the two commits. They change coldfront.c only.

Notes for Reviewers

  • Other array types written as '{...}' are still refused, as docs/supported_types.md says.
  • COPY renders a float under the session's extra_float_digits before this code runs, so a session that lowers the setting still loses digits.
  • No bakery change, so the TLA+ model is untouched.

@vyruss
vyruss requested a review from a team as a code owner December 4, 2026 16:43
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3c32812 and 3c32812.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

ColdFront now rewrites eligible one-dimensional, lower-bound-1 real[] constants into DuckDB-readable list literals during cold-query preparation. It sets extra_float_digits to 3 for preparation, then restores the prior value. Clustered Iceberg INSERT re-emission skips an OVERRIDING clause. Journey checks and documentation cover these paths.

Changes: Decoupled write handling

Layer / File(s) Summary
Prepare real[] literals
extension/coldfront/src/coldfront.c, ci/journey.sh, docs/changelog.md, docs/supported_types.md
Cold-query preparation converts non-NULL, one-dimensional real[] constants with lower bound 1 to bracketed list text and casts them back to real[]. It sets extra_float_digits to 3 during preparation and restores the previous setting. The journey checks vector precision, and the documentation describes the brace-literal exception.
Handle clustered INSERT clauses
extension/coldfront/src/coldfront.c, ci/journey.sh, docs/changelog.md
Clustered Iceberg INSERT re-emission skips the OVERRIDING clause when locating the source. The journey checks COPY and INSERT ... OVERRIDING SYSTEM VALUE rows and their cluster assignments. The changelog records the related write fixes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: dpage, susan-pgedge, imtiazqa

Merge Risk: Minimal · up to 3c328

This change lets COPY and INSERT into clustered decoupled vector tables work and keeps vector precision. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: making COPY work into a decoupled view with a vector column. The raw summary and objectives confirm the fix removes OVERRIDING SYSTEM VALUE from the clustered decouple…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the PR fixes COPY into a decoupled view with a vector column. It names the two changes: dropping OVERRIDING SYSTEM VALUE from the clustered decoupled INSERT source, and sending …
Full details: Title check

Explanation

The title names the main change: making COPY work into a decoupled view with a vector column. The raw summary and objectives confirm the fix removes OVERRIDING SYSTEM VALUE from the clustered decoupled INSERT source and rewrites real[] constants for DuckDB. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states the PR fixes COPY into a decoupled view with a vector column. It names the two changes: dropping OVERRIDING SYSTEM VALUE from the clustered decoupled INSERT source, and sending real[] constants to DuckDB as bracket literals. It also lists the tests in ci/journey.sh and the known limits. It is clearly related to the changeset, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 69d50ce and 3c32812.

Files selected for processing: 4

  • ci/journey.sh
  • docs/changelog.md
  • docs/supported_types.md
  • extension/coldfront/src/coldfront.c

Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@markwkm markwkm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fixes look good to me.

@vyruss
vyruss merged commit 6bacab5 into main Dec 5, 2026
11 checks passed
@vyruss
vyruss deleted the fix/copy-vector-decoupled branch December 5, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants