Skip to content

fix(pg-topo): accept repeated if not exists creates (CLI-3194) - #611

Open
7ttp wants to merge 9 commits into
mainfrom
7ttp/cli-3194-pg-topo-repeated-create-schema-if-not-exists
Open

7ttp wants to merge 9 commits into
mainfrom
7ttp/cli-3194-pg-topo-repeated-create-schema-if-not-exists

Conversation

@7ttp

@7ttp 7ttp commented Nov 25, 2026

Copy link
Copy Markdown
Member

TL;DR

stops pgdelta schema lint failing when each schema file repeats create schema if not exists.

whats broken?

declarative layouts often open every file with create schema if not exists app; so each file loads on its own. pg-topo flagged every copy as a DUPLICATE_PRODUCER and every statement using it as ambiguous, so lint failed on files Postgres loads fine.

now fixed by:

identical create … if not exists statements now count as one object, so nothing is reported and anything using it runs after every copy. a plain create next to an if not exists one, or two that differ, still report the duplicate.

ref:

@7ttp 7ttp self-assigned this Nov 25, 2026
@7ttp
7ttp requested a review from a team as a code owner November 25, 2026 18:18
@7ttp
7ttp requested a review from Coly010 November 25, 2026 18:18
@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca937d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@supabase/pg-topo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T10:32:44.425287Z ca937d0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/supabase/pg-toolbelt/@supabase/pg-delta@611
npm i https://pkg.pr.new/supabase/pg-toolbelt/@supabase/pg-topo@611

commit: ca937d0

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99e484d64d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

7ttp added 2 commits November 26, 2026 00:01
…ttp/cli-3194-pg-topo-repeated-create-schema-if-not-exists

# Conflicts:
#	packages/pg-topo/src/graph/build-graph.ts
#	packages/pg-topo/test/diagnostics.test.ts

@jgoux jgoux left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fix works: identical repeated create … if not exists statements no longer report DUPLICATE_PRODUCER, and statements that differ still do. Requesting one change: the fan-out makes the graph grow as copies × consumers. Details are inline.

@7ttp
7ttp requested review from Coly010 and jgoux November 27, 2026 10:03

This branch has not been deployed

No deployments
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.

pg-topo: repeated create schema if not exists is reported as DUPLICATE_PRODUCER

3 participants