Skip to content

Conversation

@fbac
Copy link
Collaborator

@fbac fbac commented Aug 22, 2025

Closes #466

@fbac fbac requested a review from a team as a code owner August 22, 2025 13:41
@graphite-app
Copy link

graphite-app bot commented Aug 22, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@macroscopeapp
Copy link

macroscopeapp bot commented Aug 22, 2025

Create the database only if it does not exist in pkg/db/pgx.go:createNamespace by adding an explicit existence check

  • In pkg/db/pgx.go, replace error-code based duplicate handling with an explicit SELECT EXISTS(...) check against pg_database.
  • Return a distinct error when the existence check query fails and return early when the database already exists.
  • On creation, call CREATE DATABASE only after a false existence check and return a formatted error on failure.
  • Remove unused errors and PostgreSQL error-code handling imports from pkg/db/pgx.go.

📍Where to Start

Start with the createNamespace function in pkg/db/pgx.go.


Macroscope summarized e0d3bef.

@mkysel mkysel closed this Aug 22, 2025
@mkysel mkysel reopened this Aug 22, 2025
@fbac fbac merged commit 953df8d into main Aug 22, 2025
19 checks passed
@fbac fbac deleted the 08-22-GH466 branch August 22, 2025 13:57
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.

Avoid duplicate ERROR database already exists errors

3 participants