Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
lib
/
python3
/
dist-packages
/
django
/
db
/
backends
/
postgresql
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: creation.cpython-310.pyc
o 3�a � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)� errorcodes)�BaseDatabaseCreation)�strip_quotesc sJ e Zd Zdd� Zddd�Zdd� Zdd � Zd� fdd� Zdd d�Z� Z S )�DatabaseCreationc C s | j j�|�S )N)� connection�ops� quote_name)�self�name� r �H/usr/lib/python3/dist-packages/django/db/backends/postgresql/creation.py�_quote_name s zDatabaseCreation._quote_nameNc C s: d}|r|d� |�7 }|r|d� | �|��7 }|od| S )N� z ENCODING '{}'z TEMPLATE {}�WITH)�formatr )r �encoding�template�suffixr r r �_get_database_create_suffix s z,DatabaseCreation._get_database_create_suffixc C s8 | j jd }|d d u sJ 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_settingsr r r �sql_table_creation_suffix s ��z*DatabaseCreation.sql_table_creation_suffixc C s |� dt|�g� |�� d uS )Nz7SELECT 1 FROM pg_catalog.pg_database WHERE datname = %s)�executer �fetchone)r �cursor� database_namer r r �_database_exists s z!DatabaseCreation._database_existsFc s� z|r| � ||d �rW d S t� �|||� W d S tyL } z(t|jdd�tjkr7| �d| � t � d� n |s:� W Y d }~d S W Y d }~d S d }~ww )N�dbname�pgcoder z+Got an error creating the test database: %s� )r! �super�_execute_create_test_db� Exception�getattr� __cause__r �DUPLICATE_DATABASE�log�sys�exit)r r � parameters�keepdb�e�� __class__r r r&