Skip to content

Conversation

@jgoux
Copy link
Contributor

@jgoux jgoux commented Sep 30, 2024

I implemented a "middleware" which :

  • detects if pg_dump initiated a connection through the application_name=pg_dump in the Startup message.
  • listen to both client and server message to detect and patch the right query results.

The two queries we're interested in are:

I looked at pg_dump code from v15 to v17 and the queries definitions are the same across all these versions so we can safely detect them.

The logic is:

  • We detect the GetExtensions query
  • We wait for its result from which we extract the actual oid of the vector extension and then patch it (using the oid 99999)
  • We then wait for the GetExtensionMembership query
  • We wait for its result and we patch it reusing the actual vector extension oid for a search/replace purpose.

Once pg_dump receives an oid > 16384 for the extensions, it will print the CREATE EXTENSION statements in the dump.

If we use pg_dump to migrate people to the new domain, we will be able to delete this middleware as everyone will be on a patched version of PGlite. 👍

@vercel
Copy link

vercel bot commented Sep 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
postgres-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 8:05am

@jgoux jgoux requested a review from gregnr September 30, 2024 21:36
@jgoux
Copy link
Contributor Author

jgoux commented Oct 1, 2024

@gregnr All comments addressed, merging! 🫡

@jgoux jgoux merged commit 62a4bbc into feat/db-sharing-connectionid Oct 1, 2024
1 check passed
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.

3 participants