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

pgmoneta_ext_promote() #26

Open
jesperpedersen opened this issue Nov 25, 2024 · 9 comments
Open

pgmoneta_ext_promote() #26

jesperpedersen opened this issue Nov 25, 2024 · 9 comments
Assignees
Labels
feature New feature

Comments

@jesperpedersen
Copy link
Member

Add a function that basically calls

SELECT * FROM pg_promote()

-- requires SUPERUSER -- and return the true/false value

@jesperpedersen jesperpedersen added the feature New feature label Nov 25, 2024
@jesperpedersen
Copy link
Member Author

@GuChad369 Can you take this one ?

@jesperpedersen
Copy link
Member Author

@jesperpedersen
Copy link
Member Author

Any way to do it is ok

@GuChad369
Copy link
Contributor

sure

@GuChad369
Copy link
Contributor

The pg_promote() function can only be executed when the server is in recovery mode. Do we need to verify if the server is in recovery mode and return an appropriate message if it is not.

@jesperpedersen
Copy link
Member Author

Yes, you can do that -- a simple bool back and forth is ok

@jesperpedersen
Copy link
Member Author

I mean, the message can be displayed in the client calling the function

@GuChad369
Copy link
Contributor

In PostgreSQL, a warning message is already displayed if the server is not in recovery mode. Below is an example of a custom extension function call and its direct output.

postgres=# SELECT pgmoneta_ext_promote();
ERROR:  recovery is not in progress
HINT:  Recovery control functions can only be executed during recovery.
postgres=# SELECT * FROM pg_promote();
ERROR:  recovery is not in progress
HINT:  Recovery control functions can only be executed during recovery.

@jesperpedersen
Copy link
Member Author

Yeah, that is enough for debugging - the client for the extension just need to know false or true

GuChad369 added a commit to GuChad369/pgmoneta_ext that referenced this issue Nov 30, 2024
GuChad369 added a commit to GuChad369/pgmoneta_ext that referenced this issue Nov 30, 2024
GuChad369 added a commit to GuChad369/pgmoneta_ext that referenced this issue Nov 30, 2024
GuChad369 added a commit to GuChad369/pgmoneta_ext that referenced this issue Nov 30, 2024
GuChad369 added a commit to GuChad369/pgmoneta_ext that referenced this issue Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants