def METHOD_NAME():
    """Provide a clean temporary PostgreSQL server/database.
    If the environment variable `INDICO_TEST_DATABASE_URI` is set, this fixture
    will do nothing and simply return the connection string from that variable
    """
    # Use existing database
    if 'INDICO_TEST_DATABASE_URI' in os.environ:
        yield os.environ['INDICO_TEST_DATABASE_URI']
        return
    db_name = 'test'
    # Ensure we have initdb and a recent enough postgres version
    try:
        version_output = subprocess.check_output(['initdb', '--version'], text=True)
    except Exception as e:
        pytest.skip(f'Could not retrieve PostgreSQL version: {e}')
    pg_version = list(map(int, re.match(r'initdb \(PostgreSQL\) ((?:\d+\.?)+)', version_output).group(1).split('.')))
    if pg_version[0] < 9 or (pg_version[0] == 9 and pg_version[1] < 6):
        pytest.skip(f'PostgreSQL version is too old: {version_output}')
    # Prepare server instance and a test database
    temp_dir = tempfile.mkdtemp(prefix='indicotestpg.')
    postgres_args = f'-h "" -k "{temp_dir}"'
    try:
        silent_check_call(['initdb', '--encoding', 'UTF8', temp_dir])
        silent_check_call(['pg_ctl', '-D', temp_dir, '-w', '-o', postgres_args, 'start'])
        silent_check_call(['createdb', '-h', temp_dir, db_name])
        silent_check_call(['psql', '-h', temp_dir, db_name, '-c', 'CREATE EXTENSION unaccent;'])
        silent_check_call(['psql', '-h', temp_dir, db_name, '-c', 'CREATE EXTENSION pg_trgm;'])
    except Exception as e:
        shutil.rmtree(temp_dir)
        pytest.skip(f'Could not init/start PostgreSQL: {e}')
    yield f'postgresql:///{db_name}?host={temp_dir}'
    try:
        silent_check_call(['pg_ctl', '-D', temp_dir, '-m', 'immediate', 'stop'])
    except Exception as e:
        # If it failed for any reason, try killing it
        try:
            with open(os.path.join(temp_dir, 'postmaster.pid')) as f:
                pid = int(f.readline().strip())
                os.kill(pid, signal.SIGKILL)
            pytest.skip(f'Could not stop postgresql; killed it instead: {e}')
        except Exception as e:
            pytest.skip(f'Could not stop/kill postgresql: {e}')
    finally:
        shutil.rmtree(temp_dir)