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

Add get_os_pid/1 function #270

Merged
merged 2 commits into from Mar 14, 2022
Merged

Conversation

seriyps
Copy link
Member

@seriyps seriyps commented Mar 3, 2022

It's similar to SELECT pg_backend_pid(), but does not need network roundtrip and can be called even when thefre is an asynchronous query is still running.

@seriyps seriyps force-pushed the add-get_os_pid-function branch 2 times, most recently from d1aaf6a to 26ff983 Compare March 3, 2022 14:54
src/epgsql.erl Outdated
%%
%% Similar to `SELECT pg_get_pid()', but does not need network roundtrips.
-spec get_os_pid(connection()) -> integer().
get_os_pid(C) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it confusing the terminology around os since this call will be executed from a process within the BEAM that is potentially living in another machine compared to the PG server.
How about renaming it to pg_backend_pid?

Copy link
Member Author

@seriyps seriyps Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I'd prefer get_backend_pid though, because epgsql is already about postgres. And in Postgres's SQL it's called pg_backend_pid to show that it is not from SQL standard, but Postgres vendor-specific I believe.

@seriyps seriyps merged commit 7abe38b into epgsql:devel Mar 14, 2022
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.

None yet

3 participants