Skip to content

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