| 2729 | |
| 2730 | |
| 2731 | def _detect_server_capabilities(server_version, connection_settings): |
| 2732 | if hasattr(connection_settings, 'padb_revision'): |
| 2733 | # Amazon Redshift detected. |
| 2734 | advisory_locks = False |
| 2735 | notifications = False |
| 2736 | plpgsql = False |
| 2737 | sql_reset = True |
| 2738 | sql_close_all = False |
| 2739 | jit = False |
| 2740 | sql_copy_from_where = False |
| 2741 | elif hasattr(connection_settings, 'crdb_version'): |
| 2742 | # CockroachDB detected. |
| 2743 | advisory_locks = False |
| 2744 | notifications = False |
| 2745 | plpgsql = False |
| 2746 | sql_reset = False |
| 2747 | sql_close_all = False |
| 2748 | jit = False |
| 2749 | sql_copy_from_where = False |
| 2750 | elif hasattr(connection_settings, 'crate_version'): |
| 2751 | # CrateDB detected. |
| 2752 | advisory_locks = False |
| 2753 | notifications = False |
| 2754 | plpgsql = False |
| 2755 | sql_reset = False |
| 2756 | sql_close_all = False |
| 2757 | jit = False |
| 2758 | sql_copy_from_where = False |
| 2759 | else: |
| 2760 | # Standard PostgreSQL server assumed. |
| 2761 | advisory_locks = True |
| 2762 | notifications = True |
| 2763 | plpgsql = True |
| 2764 | sql_reset = True |
| 2765 | sql_close_all = True |
| 2766 | jit = server_version >= (11, 0) |
| 2767 | sql_copy_from_where = server_version.major >= 12 |
| 2768 | |
| 2769 | return ServerCapabilities( |
| 2770 | advisory_locks=advisory_locks, |
| 2771 | notifications=notifications, |
| 2772 | plpgsql=plpgsql, |
| 2773 | sql_reset=sql_reset, |
| 2774 | sql_close_all=sql_close_all, |
| 2775 | sql_copy_from_where=sql_copy_from_where, |
| 2776 | jit=jit, |
| 2777 | ) |
| 2778 | |
| 2779 | |
| 2780 | def _extract_stack(limit=10): |