diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-08-08 22:13:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-08 22:13:02 +0200 |
| commit | 3189a93cebbd5d8fbda8f251786918820156acec (patch) | |
| tree | 6c2d836b13e8cb97f881f4533540cbbb14eaf28a /django/db/backends/postgresql | |
| parent | c754bdc45bdcd9b2a03d4e3e10ea2a742456de91 (diff) | |
Refs #23766 -- Added tests for CursorWrapper.callproc().
Thanks Tim Graham for the review.
Diffstat (limited to 'django/db/backends/postgresql')
| -rw-r--r-- | django/db/backends/postgresql/features.py | 16 | ||||
| -rw-r--r-- | django/db/backends/postgresql/schema.py | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py index 0f291a6586..647fb9dc7f 100644 --- a/django/db/backends/postgresql/features.py +++ b/django/db/backends/postgresql/features.py @@ -33,6 +33,22 @@ class DatabaseFeatures(BaseDatabaseFeatures): can_clone_databases = True supports_temporal_subtraction = True supports_slicing_ordering_in_compound = True + create_test_procedure_without_params_sql = """ + CREATE FUNCTION test_procedure () RETURNS void AS $$ + DECLARE + V_I INTEGER; + BEGIN + V_I := 1; + END; + $$ LANGUAGE plpgsql;""" + create_test_procedure_with_int_param_sql = """ + CREATE FUNCTION test_procedure (P_I INTEGER) RETURNS void AS $$ + DECLARE + V_I INTEGER; + BEGIN + V_I := P_I; + END; + $$ LANGUAGE plpgsql;""" @cached_property def has_select_for_update_skip_locked(self): diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index 1e505a2134..20cea3f249 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -20,6 +20,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): # dropping it in the same transaction. sql_delete_fk = "SET CONSTRAINTS %(name)s IMMEDIATE; ALTER TABLE %(table)s DROP CONSTRAINT %(name)s" + sql_delete_procedure = 'DROP FUNCTION %(procedure)s(%(param_types)s)' + def quote_value(self, value): return psycopg2.extensions.adapt(value) |
