我尝试在运行在Docker容器中的Postgres上安装
根据https://dev59.com/2afja4cB1Zd3GeqP3Ow6#51797554,我尝试了以下操作: docker-compose.yml
pg_cron
,但出现了错误could not access file "pg_cron": No such file or directory
。有什么解决方法吗?根据https://dev59.com/2afja4cB1Zd3GeqP3Ow6#51797554,我尝试了以下操作: docker-compose.yml
version: '3.7'
services:
pg:
container_name: pg-container
image: postgres:11.5
environment:
POSTGRES_DB: "pgdb"
POSTGRES_USER: "pguser"
POSTGRES_PASSWORD: "pgpass"
volumes:
- ./:/docker-entrypoint-initdb.d
- pgstorage
ports:
- "5432:5432"
volumes:
pgstorage:
002-setup.sh
#!/bin/sh
# Remove last line "shared_preload_libraries='citus'"
sed -i '$ d' ${PGDATA}/postgresql.conf
cat <<EOT >> ${PGDATA}/postgresql.conf
shared_preload_libraries='pg_cron'
cron.database_name='${POSTGRES_DB:-postgres}'
EOT
# Required to load pg_cron
pg_ctl restart
003-main.sql
CREATE EXTENSION pg_cron;