← Back
Editing: creation.cpython-311.pyc
� �|�e � �N � d dl Z d dlmZ d dlmZ d dlmZ G d� de� � ZdS )� N)� errorcodes)�BaseDatabaseCreation)�strip_quotesc �B � � e Zd Zd� Zd d�Zd� Zd� Zd � fd� Zd d�Z� xZ S )�DatabaseCreationc �@ � | j j � |� � S )N)� connection�ops� quote_name)�self�names �H/usr/lib/python3/dist-packages/django/db/backends/postgresql/creation.py�_quote_namezDatabaseCreation._quote_name s � ���"�-�-�d�3�3�3� Nc � � d}|r|d� |� � z }|r+|d� | � |� � � � z }|od|z S )N� z ENCODING '{}'z TEMPLATE {}�WITH)�formatr )r �encoding�template�suffixs r �_get_database_create_suffixz,DatabaseCreation._get_database_create_suffix sf � ���� 8��&�-�-�h�7�7�7�F�� H��n�+�+�D�,<�,<�X�,F�,F�G�G�G�F��)�&�6�/�)r c � � | j j d }|d � J d� � �| � |d |� d� � �� � S )N�TEST� COLLATIONzHPostgreSQL does not support collation setting at database creation time.�CHARSET�TEMPLATE)r r )r � settings_dictr �get)r � test_settingss r �sql_table_creation_suffixz*DatabaseCreation.sql_table_creation_suffix se � ���5�f�=� ��[�)�1�1�V� 2�1�1� �/�/�"�9�-�"�&�&�z�2�2� 0� � � r c �v � |� dt |� � g� � |� � � d uS )Nz7SELECT 1 FROM pg_catalog.pg_database WHERE datname = %s)�executer �fetchone)r �cursor� database_names r �_database_existsz!DatabaseCreation._database_exists s9 � ����P�S_�`m�Sn�Sn�Ro�p�p�p���� � ��,�,r Fc �t �� |r| � ||d � � rd S t � � � |||� � d S # t $ re}t |j dd� � t j k r-| � d|z � � t j d� � n |s� Y d }~d S Y d }~d S d }~ww xY w)N�dbname�pgcoder z+Got an error creating the test database: %s� )r'