def tablespace_create(name, location, options=None, owner=None, user=None,
                      host=None, port=None, maintenance_db=None, password=None,
                      runas=None):
    owner_query = ''
    options_query = ''
    if owner:
        owner_query = 'OWNER "{0}"'.format(owner)
        # should come out looking like: 'OWNER postgres'
    if options:
        optionstext = ['{0} = {1}'.format(k, v) for k, v in options.items()]
        options_query = 'WITH ( {0} )'.format(', '.join(optionstext))
        # should come out looking like: 'WITH ( opt1 = 1.0, opt2 = 4.0 )'
    query = 'CREATE TABLESPACE "{0}" {1} LOCATION \'{2}\' {3}'.format(name,
                                                                owner_query,
                                                                location,
                                                                options_query)

    # Execute the command
    ret = _psql_prepare_and_run(['-c', query],
                                user=user, host=host, port=port,
                                maintenance_db=maintenance_db,
                                password=password, runas=runas)
    return ret['retcode'] == 0
Adds a tablespace to the Postgres server.
dataset/ETHPy150Open saltstack/salt/salt/modules/postgres.py/tablespace_create