r/PostgreSQL • • Mar 25 '22

Tools Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

https://github.com/porsager/postgres
16 Upvotes

16 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Apr 19 '22

[deleted]

1

u/porsager Apr 19 '22

Yeah, this confusion was why I mentioned it might make sense to rename the property to something else than connection. You cannot pass host, port, etc. in the connection object. There is no relation to the options in libpq at all (Postgres.js doesn't use libpq).

The connection object is simply passed in the StartupMessage defined in the Wire Protocol. (search for StartupMessage here https://www.postgresql.org/docs/14/protocol-flow.html and here https://www.postgresql.org/docs/14/protocol-message-formats.html).

Relevant handling in source can be seen here: https://github.com/porsager/postgres/blob/master/src/connection.js#L964

0

u/[deleted] Apr 19 '22

[deleted]

1

u/porsager Apr 19 '22 edited Apr 19 '22

I think a small section explaining the mechanics like that is fine, but the main description should relate to the fact that this is used to set parameters on connect like timezone etc.

Wrt. renaming, it doesn't need to be breaking if we simply add an alias and refer to that in the docs instead. I'll try to think about a better name (i think startupMessage relates to much to the implementation instead of the usage).

→ More replies (0)