arcapos / luapgsql

Lua binding for PostgreSQL
108 stars 24 forks source link

Feature Request: Streaming Replication Protocol #49

Closed jmealo closed 3 years ago

jmealo commented 6 years ago

Hello,

I'd like to port Lapidus over to Lua and stop wrapping pg_recvlogical by connecting to PostgreSQL directly using the Streaming Replication Protocol.

I'm going to see if I can figure this out as the code is very readable. I only muck around in other people's C code, I don't write much of it from scratch, so should you choose to review/accept it be brutal on my PR (I could use the feedback).

Please let me know if you're interested or have any pointers.

Kudos on luapgsql. I look forward to using it!

daurnimator commented 6 years ago

How did you go with this?

mbalmer commented 6 years ago

Not yet looked deeper at. Isn't it the case that these streaming replication commands are sent to the server using PQexec() and return the result as an ordinary PGresult * ?

mbalmer commented 6 years ago

After looking into the protocol and how data is transferred, I think there is already everything in place to use the streaming protocol. One you setup streaming, the server will return data as COPY data, and that can be handled in luapgsql using getCopyData(). I never tried luapgsql in this way, but I think it should be possible right out of the box.

mbalmer commented 3 years ago

I am closing this issue as will not have time in the foreseeable future to work on this.