I was playing around with DBLINK and I wanted to try it. So I run this simple query
CREATE EXTENSION dblink;
SELECT *
FROM dblink(('dbname=genesis_admin')::text,
('SELECT * FROM user_account')::text);
then to my surprise
[WARNING ] CREATE EXTENSION dblink
ERROR: extension "dblink" already exists
[WARNING ] SELECT * FROM dblink(('dbname=genesis_admin')::text, ('SELECT * FROM user_account')::text)
ERROR: function dblink(text, text) does not exist
LINE 1: SELECT * FROM dblink(('dbname=genesis_admin')::text, ('SELE...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
How can it not be existing if it already exists?
This happens if the function call has just one argument and the function name is the same as the (internal) name of some data type.
The Database although contains the function DBlink (text, text) is therefore unable to find that function. To get this to work, you need to add specific schema to the DBlink function call.
If a qualified function name was given, only functions in the specified schema are considered. If the search path finds multiple functions of identical argument types, only the one appearing earliest in the path is considered. Functions of different argument types are considered on an equal footing regardless of search path position.
I encountered the same error and the reason is that this is because DBLink
gets installed (by default) in Public schema and you have probably modified the search_path to a list that doesn't include public). The Database although contains the function DBlink(text, text)
is therefore unable to find that function.
To get this to work, you need to add specific schema to the DBlink
function call.
SELECT public.dblink(xxx, yyy);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With