Do not enforce types for params #302

As types are tied to a schema, they don't get along very well with
pl/proxy. Do not use them for the service_type.
This commit is contained in:
Rafa de la Torre 2016-11-24 18:38:31 +01:00
parent 0d92eb4ba8
commit 9c6eabc59e
2 changed files with 4 additions and 4 deletions

View File

@ -378,7 +378,7 @@
- { name: aggregate_type, type: text, default: 'NULL' } - { name: aggregate_type, type: text, default: 'NULL' }
- name: cdb_service_quota_info - name: cdb_service_quota_info
return_type: SETOF cdb_dataservices_client.service_quota_info return_type: SETOF service_quota_info
multi_row: true multi_row: true
multi_field: true multi_field: true
params: params:
@ -387,5 +387,5 @@
- name: cdb_enough_quota - name: cdb_enough_quota
return_type: BOOLEAN return_type: BOOLEAN
params: params:
- { name: service, type: cdb_dataservices_client.service_type } - { name: service, type: TEXT }
- { name: input_size, type: NUMERIC } - { name: input_size, type: NUMERIC }

View File

@ -91,7 +91,7 @@ $$ LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota( CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota(
username TEXT, username TEXT,
orgname TEXT, orgname TEXT,
service_ cdb_dataservices_server.service_type, service_ TEXT,
input_size NUMERIC) input_size NUMERIC)
returns BOOLEAN AS $$ returns BOOLEAN AS $$
DECLARE DECLARE
@ -99,7 +99,7 @@ returns BOOLEAN AS $$
BEGIN BEGIN
SELECT * INTO params SELECT * INTO params
FROM cdb_dataservices_server.cdb_service_quota_info(username, orgname) AS p FROM cdb_dataservices_server.cdb_service_quota_info(username, orgname) AS p
WHERE p.service = service_; WHERE p.service = service_::cdb_dataservices_server.service_type;
RETURN params.soft_limit OR ((params.used_quota + input_size) <= params.monthly_quota); RETURN params.soft_limit OR ((params.used_quota + input_size) <= params.monthly_quota);
END END
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;