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 CLI Exec in SQL. #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

SeinoYuki
Copy link

Hi,

I'm working to support CLI executer in SQL.

This is accomplished with a function.
Nothing special.
Just return the result of the pg_statsinfo command as a record.

An example is as follows.

postgres=# select statsinfo.cli_exec('-r All -h localhost -d postgres -p 5432 -U postgres');
                                                                                                                cli_exec                                                                                                                
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ---------------------------------------------                                                                                                                                                                                         +
 STATSINFO Report (host: host01, port: 5432)                                                                                                                                                                                     +
 ---------------------------------------------                                                                                                                                                                                         +
                                                                                                                                                                                                                                       +
 ----------------------------------------                                                                                                                                                                                              +
 /* Summary */                                                                                                                                                                                                                         +
 ----------------------------------------                                                                                                                                                                                              +
 Database System ID   : 7199845336452441890                                                                                                                                                                                            +
 Host                 : host01                                                                                                                                                                                                   +
 Port                 : 5432                                                                                                                                                                                                           +
 PostgreSQL Version   : 14.7                                                                                                                                                                                                           +
 Snapshot Begin       : 2023-02-14 12:19:50                                                                                                                                                                                            +
 Snapshot End         : 2023-02-14 12:20:00                                                                                                                                                                                            +
 Snapshot Duration    : 00:00:10                                                                                                                                                                                                       +
 Total Database Size  : 10 MiB                                                                                                                                                                                                         +
 Total Commits        : 999                                                                                                                                                                                                            +
 Total Rollbacks      : 0                                                                                                                                                                                                              +
                                                                                                                                                                                                                                       +
 /** Alert **/                                                                                                                                                                                                                         +
~~~

Regards,

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.

1 participant