<commit_before>#!/bin/bash
set -euo pipefail

if [[ "$(id -u)" -eq 0 ]]; then
    su postgres "$0" "$@"
    exit "$?"
fi

. /etc/hades/env
export PATH="/usr/lib/postgresql/${PGVERSION}/bin:${PATH}"
export PGDATA="/var/lib/postgresql/hades"

# Let the hades script configure the database cluster. This might use some
# special arguments to pg_ctl initdb.
hades init-database-cluster

# Create database 'radius' and populate the schema. This enables us point the
# foreign tables to the local running database instance for development.
pg_ctl start -w -s
createdb radius
python3 -m hades.config.generate schema_fdw.sql.j2 | psql --quiet --set=ON_ERROR_STOP=1 --no-psqlrc --single-transaction --file=- radius
pg_ctl stop -s<commit_msg>Improve docker/postgres_fdw script<commit_after>#!/bin/bash
set -euo pipefail

. /etc/hades/env
export PATH="/usr/lib/postgresql/${PGVERSION}/bin:${PATH}"
export PGDATA="/var/lib/postgresql/hades"
source <(python3 -m hades.config.export)

# Run as postgres user
if [[ $(id -u) -eq 0 ]]; then
    exec python3 -m hades.common.su "${HADES_POSTGRESQL_USER}" "$0" "$@"
fi

# Let the hades script configure the database cluster. This might use some
# special arguments to pg_ctl initdb.
hades init-postgres-cluster

# Create database 'radius' and populate the schema. This enables us to point
# the foreign tables to the local running database instance for development.
pg_ctl start -w -s
createdb radius
python3 -m hades.config.generate schema_fdw.sql.j2 | psql --quiet --set=ON_ERROR_STOP=1 --no-psqlrc --single-transaction --file=- radius
pg_ctl stop -s
{'fraction_non_alphanumeric': 0.12507896399241947, 'fraction_numerical': 0.007580543272267846, 'mean_word_length': 4.093247588424437, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5683013', 'n_tokens_mistral': 534, 'n_tokens_neox': 518, 'n_words': 174}