jeroenrinzema/psql-wire ? reverse-engineered prompt

Reverse engineered prompt

Build me a small Go library that lets me spin up a PostgreSQL compatible server with very little code.

I want to be able to start listening on a host and port, accept normal Postgres client connections, and handle the basic wire protocol so existing database tools and drivers can connect. It should support simple query handling, prepared statements, binding, executing, closing, cancel requests, and error responses, plus a clean way to write rows and complete results back to the client. Please include a few easy examples that show how to return results from a query handler, and how to store and read custom session attributes for each connection.

If you need to look up current docs online while wiring up the protocol details, go ahead. Keep the API straightforward and hackable, since I may want to use it for a toy database, a honeypot, or to test client integrations.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab