pgvecto.rs
pgvecto.rs copied to clipboard
Container image ignores additional shared_preload_libraries added via postgresql.conf
In the dockerfile, psql is started with CMD ["postgres" "-c" "shared_preload_libraries=vectors.so" "-c" "search_path=\"$user\", public, vectors"].
When adding shared_preload_libraries like pg_stat_statements to postgresql.conf, these settings are ignored.
postgresql.conf:
#local_preload_libraries = ''
#session_preload_libraries = ''
shared_preload_libraries = 'vectors.so,pg_stat_statements'
#jit_provider = 'llvmjit' # JIT library to use
output of pg_settings:
However it is possible to overwrite this in Kubernetes by specifying:
args:
- "postgres"
- "-c"
- "shared_preload_libraries=vectors.so,pg_stat_statements"
- "-c"
- "search_path=\"$user\", public, vectors"
in your stateful set or deployment.
After that, all libraries are loaded:
EDIT: args were not complete
@VoVAllen Should it be expected?
I didn't see what we can fix here. Probably mention it in the documentations should be enough? If we put it in the postgresql.conf, then use -c vectors.so will overrider that. Only one will work.
We could just remove -c ... -c ... in dockerfile. But users have to read documentation before using the image (it sounds weird that users could use it without reading documentation).
How about using entrypoint and cmd in dockerfile: https://spacelift.io/blog/docker-entrypoint-vs-cmd
ENTRYPOINT ['postgres']
CMD ["-c" "shared_preload_libraries=vectors.so" "-c" "search_path=\"$user\", public, vectors"]
I have encountered this problem when I was configuring the container on my NAS:
The solution is simple, just execute psql -U postgres -c 'ALTER SYSTEM SET shared_preload_libraries = "vectors.so"' and restart the container, but I remember this wasn't happened in 0.1.x.