From 4b72af34ecbea3919494f63c99d4da2caafbeb18 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Thu, 23 Jun 2016 18:22:11 +0200 Subject: [PATCH] Fixes to be able to install the extension --- .../125_data_observatory_table_augment.sql | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/server/extension/sql/125_data_observatory_table_augment.sql b/server/extension/sql/125_data_observatory_table_augment.sql index 0c96d78..e3d6cfa 100644 --- a/server/extension/sql/125_data_observatory_table_augment.sql +++ b/server/extension/sql/125_data_observatory_table_augment.sql @@ -1,40 +1,20 @@ CREATE TYPE cdb_dataservices_server.ds_fdw_metadata as (schemaname text, tabname text, servername text); CREATE TYPE cdb_dataservices_server.ds_return_metadata as (colnames text[], coltypes text[]); - CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_ConnectUserTable(username text, useruuid text, input_schema text, dbname text, table_name text) RETURNS ds_fdw_metadata AS $$ - ---- quota/checks and internal call to function - --TODO: need username and orgname + # TODO: need username and orgname + return plpy.execute("SELECT * FROM _OBS_ConnectUserTable('{0}'::text, '{1}'::text, '{2}'::text, '{3}'::text, '{4}'::text)" + .format(username, useruuid, input_schema, dbname, table_name)) $$ LANGUAGE plpythonu; -CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetReturnMetadata(params json) -RETURNS ds_return_metadata AS $$ - ---- quota/checks and internal call to function - --TODO: need username and orgname -$$ LANGUAGE plpythonu; - -CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetAugmentedColumns(table_schema text, table_name text, params json) -RETURNS SETOF record AS $$ - ---- quota/checks and internal call to function - --TODO: need username and orgname -$$ LANGUAGE plpythonu; - - -CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_DisconnectUserTable(table_schema text, table_name text, servername text) -RETURNS boolean AS $$ - ---- quota/checks and internal call to function - --TODO: need username and orgname -$$ LANGUAGE plpythonu; - - CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_ConnectUserTable(username text, useruuid text, input_schema text, dbname text, table_name text) RETURNS ds_fdw_metadata AS $$ CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname); SELECT cdb_observatory._OBS_ConnectUserTable(username text, useruuid text, input_schema text, dbname text, host text, table_name text); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_GetReturnMetadata(params json) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetReturnMetadata(params json) RETURNS ds_return_metadata AS $$ CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname); SELECT cdb_observatory._OBS_GetReturnMetadata(params json); @@ -43,11 +23,11 @@ $$ LANGUAGE plproxy; CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_GetProcessedData(table_schema text, table_name text, params json) RETURNS SETOF record AS $$ CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname); - SELECT cdb_observatory._OBS_GetReturnMetadata(params json); + TARGET cdb_observatory.OBS_GetProcessedData; $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_dataservices_server._OBS_DisconnectUserTable(table_schema text, table_name text, servername text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.OBS_DisconnectUserTable(table_schema text, table_name text, servername text) RETURNS boolean AS $$ CONNECT cdb_dataservices_server._obs_server_conn_str(username, orgname); SELECT cdb_observatory._OBS_DisconnectUserTable(table_schema text, table_name text, servername text);