已尝试设置search_path为public仍无法解决Heroku Connect中get_xmlbinary()函数不存在错误怎么办?
Hey there, let's work through this frustrating error you're facing with Heroku Connect. I've helped a few folks troubleshoot this exact issue, so here's what you need to check and fix:
First, install the
xml2PostgreSQL extension
Theget_xmlbinary()function lives in thexml2extension, which isn't installed by default in Heroku Postgres. To add it, fire up a psql session to your Heroku database:heroku pg:psql -a your-app-nameThen run this command inside the psql shell:
CREATE EXTENSION IF NOT EXISTS xml2;This will install the extension into the
publicschema (by default) and make the function available.Double-check your
search_path(with a twist)
You triedSET search_path TO public;, but if thexml2extension ended up in another schema (likepg_catalog—though rare), you'll need to include it. Run this to confirm where the function lives:SELECT proname, nspname FROM pg_proc WHERE proname = 'get_xmlbinary';If it shows up in
pg_catalog, update your search path to include both schemas:SET search_path TO public, pg_catalog;To make this permanent for your Heroku Connect user, you can alter the user's search path:
ALTER ROLE your-heroku-connect-user SET search_path TO public, pg_catalog;Verify Heroku Connect has access to the function
Ensure the database user that Heroku Connect uses has permission to executeget_xmlbinary(). You can grant access with:GRANT EXECUTE ON FUNCTION get_xmlbinary() TO your-heroku-connect-user;Restart Heroku Connect
Sometimes Heroku Connect caches database schema information. After installing the extension and adjusting permissions, head to your Heroku Dashboard, find the Heroku Connect add-on, and restart it. This forces it to pick up the new function.
If you still run into issues, double-check that the extension installed successfully by running \dx in psql to list all installed extensions—you should see xml2 listed there.
内容的提问来源于stack exchange,提问作者Prasad

