CartoDB / cartodb-postgresql

PostgreSQL extension for CartoDB
BSD 3-Clause "New" or "Revised" License
111 stars 52 forks source link

Retrieve target PG and postgis versions #383

Closed rafatower closed 4 years ago

rafatower commented 4 years ago

Using the proposal from Algunenano, I added just a public function that is meant to be augmented with more info.

Here the interface

CDB_Federated_Server_Diagnostics(internal_server name) returns jsonb
rafatower commented 4 years ago

Example usage (not included in the tests, as they can return json keys in different order):

SELECT cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback');
            cdb_federated_server_diagnostics            
--------------------------------------------------------
 {"server_version": "11.3", "postgis_version": "2.5.1"}
(1 row)
rafatower commented 4 years ago

Thanks! I'll add the foreign server options before closing this, but wanna do the latency stuff in the separate ticket.

rafatower commented 4 years ago

Added server_options to the mix:

SELECT cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback');
                                                                                          cdb_federated_server_diagnostics                                                                                           
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"server_options": {"host": "localhost", "port": "5432", "updatable": "false", "extensions": "postgis", "fetch_size": "1000", "use_remote_estimate": "true"}, "server_version": "11.3", "postgis_version": "2.5.1"}
(1 row)

I think this is now ready for review and merge.

rafatower commented 4 years ago

@Algunenano you just need to look at the last commit https://github.com/CartoDB/cartodb-postgresql/pull/383/commits/d76e3ccc3e30358bd8bf2442ad0e4e917c58f248 and I can merge it into branch federated_function