Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

features.py 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from django.db.backends.base.features import BaseDatabaseFeatures
  2. from django.db.utils import InterfaceError
  3. from django.utils.functional import cached_property
  4. class DatabaseFeatures(BaseDatabaseFeatures):
  5. allows_group_by_selected_pks = True
  6. can_return_id_from_insert = True
  7. can_return_ids_from_bulk_insert = True
  8. has_real_datatype = True
  9. has_native_uuid_field = True
  10. has_native_duration_field = True
  11. can_defer_constraint_checks = True
  12. has_select_for_update = True
  13. has_select_for_update_nowait = True
  14. has_select_for_update_of = True
  15. uses_savepoints = True
  16. can_release_savepoints = True
  17. supports_tablespaces = True
  18. supports_transactions = True
  19. can_introspect_autofield = True
  20. can_introspect_ip_address_field = True
  21. can_introspect_small_integer_field = True
  22. can_distinct_on_fields = True
  23. can_rollback_ddl = True
  24. supports_combined_alters = True
  25. nulls_order_largest = True
  26. closed_cursor_error_class = InterfaceError
  27. has_case_insensitive_like = False
  28. requires_sqlparse_for_splitting = False
  29. greatest_least_ignores_nulls = True
  30. can_clone_databases = True
  31. supports_temporal_subtraction = True
  32. supports_slicing_ordering_in_compound = True
  33. create_test_procedure_without_params_sql = """
  34. CREATE FUNCTION test_procedure () RETURNS void AS $$
  35. DECLARE
  36. V_I INTEGER;
  37. BEGIN
  38. V_I := 1;
  39. END;
  40. $$ LANGUAGE plpgsql;"""
  41. create_test_procedure_with_int_param_sql = """
  42. CREATE FUNCTION test_procedure (P_I INTEGER) RETURNS void AS $$
  43. DECLARE
  44. V_I INTEGER;
  45. BEGIN
  46. V_I := P_I;
  47. END;
  48. $$ LANGUAGE plpgsql;"""
  49. supports_over_clause = True
  50. supports_aggregate_filter_clause = True
  51. supported_explain_formats = {'JSON', 'TEXT', 'XML', 'YAML'}
  52. validates_explain_options = False # A query will error on invalid options.
  53. @cached_property
  54. def is_postgresql_9_5(self):
  55. return self.connection.pg_version >= 90500
  56. has_select_for_update_skip_locked = is_postgresql_9_5
  57. has_brin_index_support = is_postgresql_9_5
  58. has_jsonb_agg = is_postgresql_9_5
  59. has_gin_pending_list_limit = is_postgresql_9_5