mirror of
https://github.com/saltstack-formulas/postgres-formula.git
synced 2025-04-16 01:30:25 +00:00
properly quote identifiers with double quotes. This is rarely necessary.
This commit is contained in:
parent
278c2e4ce8
commit
45887735c6
1 changed files with 7 additions and 7 deletions
|
@ -185,9 +185,9 @@ def tablespace_create(name, location, owner=None, user=None, host=None, port=Non
|
||||||
|
|
||||||
salt '*' postgres_ext.tablespace_create tablespacename '/path/datadir'
|
salt '*' postgres_ext.tablespace_create tablespacename '/path/datadir'
|
||||||
'''
|
'''
|
||||||
query = 'CREATE TABLESPACE {0} LOCATION \'{1}\''.format(name, location)
|
query = 'CREATE TABLESPACE "{0}" LOCATION \'{1}\''.format(name, location)
|
||||||
if owner is not None:
|
if owner is not None:
|
||||||
query += ' OWNER \'{1}\''.format(owner)
|
query += ' OWNER "{1}"'.format(owner)
|
||||||
|
|
||||||
# Execute the command
|
# Execute the command
|
||||||
ret = _psql_prepare_and_run(['-c', query],
|
ret = _psql_prepare_and_run(['-c', query],
|
||||||
|
@ -214,16 +214,16 @@ def tablespace_alter(name, user=None, host=None, port=None, maintenance_db=None,
|
||||||
queries = []
|
queries = []
|
||||||
|
|
||||||
if new_name:
|
if new_name:
|
||||||
queries.append('ALTER TABLESPACE {} RENAME TO {}'.format(
|
queries.append('ALTER TABLESPACE "{}" RENAME TO "{}"'.format(
|
||||||
name, new_name))
|
name, new_name))
|
||||||
if new_owner:
|
if new_owner:
|
||||||
queries.append('ALTER TABLESPACE {} OWNER TO {}'.format(
|
queries.append('ALTER TABLESPACE "{}" OWNER TO "{}"'.format(
|
||||||
name, new_owner))
|
name, new_owner))
|
||||||
if set_option:
|
if set_option:
|
||||||
queries.append('ALTER TABLESPACE {} SET ({} = {})'.format(
|
queries.append('ALTER TABLESPACE "{}" SET ({} = {})'.format(
|
||||||
name, set_option[0], set_option[1]))
|
name, set_option[0], set_option[1]))
|
||||||
if reset_option:
|
if reset_option:
|
||||||
queries.append('ALTER TABLESPACE {} RESET ({})'.format(
|
queries.append('ALTER TABLESPACE "{}" RESET ({})'.format(
|
||||||
name, reset_option))
|
name, reset_option))
|
||||||
|
|
||||||
for query in queries:
|
for query in queries:
|
||||||
|
@ -245,7 +245,7 @@ def tablespace_remove(name, user=None, host=None, port=None,
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
salt '*' postgres_ext.tablespace_remove tsname
|
salt '*' postgres_ext.tablespace_remove tsname
|
||||||
'''
|
'''
|
||||||
query = 'DROP TABLESPACE {}'.format(name)
|
query = 'DROP TABLESPACE "{}"'.format(name)
|
||||||
ret = _psql_prepare_and_run(['-c', query],
|
ret = _psql_prepare_and_run(['-c', query],
|
||||||
user=user,
|
user=user,
|
||||||
host=host,
|
host=host,
|
||||||
|
|
Loading…
Add table
Reference in a new issue