I dump a database from one postgres db using pg_dump and restore to another postgres database (In RDS) using pg_restore. But at that time I forget to using --no-owner. After restoring, I change owner to postgres user. I am using pgvector extension and when I try to set config parameter hnsw.ef_search on database level it gives me error permission denied to set parameter 'hnsw.ef_search'.
Command to set parameter on database level
ALTER DATABASE mydb SET hnsw.ef_search = 500;
Please help me with this issue. Thanks in advance.
PS : when I create new db and try to run same query, it will execute without any error.
You get that error because the shared library for the extension
vector(which isvector.so) is not loaded in the current session. Until the library is loaded,hnsw.ef_searchis not defined and treated as a “placeholder parameter” by PostgreSQL. Only a superuser can useALTER DATABASEto set a value for a placeholder parameter.hnsw.ef_searchgets redefined as a regular parameter as soon asvector.sois loaded in the current session. So you should call a function from the extension,SELECTfrom a table that uses thevectordata type or do something else that causesvector.soto be loaded into the backend process of the current session. Then run yourALTER DATABASEstatement in that same session, and it should succeed.