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: cdb_service_quota_info
return_type: SETOF cdb_dataservices_client.service_quota_info
return_type: SETOF service_quota_info
multi_row: true
multi_field: true
params:
@ -387,5 +387,5 @@
- name: cdb_enough_quota
return_type: BOOLEAN
params:
- { name: service, type: cdb_dataservices_client.service_type }
- { name: service, type: TEXT }
- { name: input_size, type: NUMERIC }

View File

@ -91,7 +91,7 @@ $$ LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_enough_quota(
username TEXT,
orgname TEXT,
service_ cdb_dataservices_server.service_type,
service_ TEXT,
input_size NUMERIC)
returns BOOLEAN AS $$
DECLARE
@ -99,7 +99,7 @@ returns BOOLEAN AS $$
BEGIN
SELECT * INTO params
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);
END
$$ LANGUAGE plpgsql;