Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is that possible to create a fake postgresql server using postgres-protocol ? #942

Open
prx0 opened this issue Aug 24, 2022 · 4 comments
Open

Comments

@prx0
Copy link

prx0 commented Aug 24, 2022

Hi,
I would like to create a fake postgresql server which will be able to respond to any postgresql client. (even psql) Such project already exists https://pkg.go.dev/github.com/jackc/pgproto3/[email protected]#section-readme

I would like to know if the current state of posgres-protocol give me everything I need for making a fake postgresql server. I'm not sure that the crate was designed for this. The backend-module give me nothing to handle startup message (but I've a function for sending startup message, that's not really what I'm looking for) to I think I've to read the buffer myself in order to analyse what I have from my client.

Thank you very much!

@sfackler
Copy link
Owner

postgres-protocol currently only handles serialization of frontend messages and deserialization of backend messages, while a server implementation would need the opposite. I'd be happy to take a PR adding that support in though.

@prx0
Copy link
Author

prx0 commented Aug 25, 2022

I'd be happy to take a PR adding that support in though.

It could be great! I will check how pg Message flow works and I'll try to do something in order to add serialization of backend message and deserialization of frontend message.

@prx0
Copy link
Author

prx0 commented Aug 26, 2022

I've worked on this #946
Still in work in progress currently.

@sunng87
Copy link

sunng87 commented Feb 7, 2023

hi @prx0 I have a library pgwire allows you to do that. The library uses postgres-types from rust-postgres

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

No branches or pull requests

3 participants