Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:36:03+00:00 2026-05-24T11:36:03+00:00

I want to do some cross database references in my application. Briefly, i have

  • 0

I want to do some cross database references in my application. Briefly, i have two databases called meta and op. I want to do some select query from meta to a table in op database like below but getting the below error. I tried with password and without password. by the way caixa user is a non-super user and my target server (op db server is having MD5 authentication mode.)

meta=> select * from dblink('dbname=op password=caixa','SELECT op_col from op_table') AS t(op_col varchar);

ERROR: password is required

DETAIL: Non-superuser cannot connect if the server does not request a password.

HINT: Target server’s authentication method must be changed.

What the HINT in the above error message suggests? do i need to change the server’s auth mode? Without changing the server’s auth mode (MD5) can’t i run the above query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:36:04+00:00Added an answer on May 24, 2026 at 11:36 am

    From documentation:

    Only superusers may use dblink_connect to create
    non-password-authenticated connections. If non-superusers need this
    capability, use dblink_connect_u instead.

    and

    dblink_connect_u() is identical to dblink_connect(), except that it
    will allow non-superusers to connect using any authentication method.

    That means your dblink call is using dblink_connect implicitly. Use dblink_connect_u instead or change your auth method to e.g. md5.

    Note that you also need grant execute privilege to caixa role, for example by:

    GRANT EXECUTE ON FUNCTION dblink_connect_u(text) TO caixa;
    GRANT EXECUTE ON FUNCTION dblink_connect_u(text, text) TO caixa;
    

    Working example (after GRANT):

    meta=> SELECT dblink_connect_u('conn1', 'dbname=op');
    meta=> SELECT * FROM dblink('conn1','SELECT op_col from op_table')
                AS t(op_col varchar);
     op_col 
    --------
     aaa
     bbb
     ccc
    (3 rows)
    meta=> SELECT dblink_disconnect('conn1');
    

    EDIT:

    Sorry for slightly misleading answer. Of course you don’t need dblink_connect_u for md5 authenticated
    connection. There is one possibility I see. PostgreSQL has two different connection types: host and local.

    Running:

    psql -h localhost ..

    incorporates host connection, but

    dblink_connect('mycon','dbname=vchitta_op user=caixa password=caixa');

    uses local type, so if you have non-password method for local connection (for example ident method or trust), then it returns

    ERROR:  password is required
    DETAIL:  Non-superuser cannot connect if the server does not request a password.
    HINT:  Target server's authentication method must be changed.
    

    Check

    dblink_connect('mycon','hostaddr=127.0.0.1 dbname=vchitta_op user=caixa password=caixa')

    for host connection. For clarity if possible please post your pg_hba.conf.

    I also checked what about CONNECT privilege on vchitta_op DB, but error message is different:

    REVOKE CONNECT ON DATABASE vchitta_op FROM PUBLIC;
    REVOKE CONNECT ON DATABASE vchitta_op FROM caixa;
    
    SELECT dblink_connect('mycon','dbname=vchitta_op user=caixa password=caixa');
    ERROR:  could not establish connection
    DETAIL:  FATAL:  permission denied for database "vchitta_op"
    DETAIL:  User does not have CONNECT privilege.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application built with Struts 2. It has some issues with Cross-site
I have some application, which makes database requests. I guess it doesn't actually matter,
I have two tables (some so-called dictionaries, only about ~50 entries I presume) that
Let's say I want some instance of String behave differently from other, normal instances
i am new in ssrs i want some sugeestiion from You can i use
TL DR; Want some Java help with connecting to a truly local database (
I'm looking for a cross-platform database engine that can handle databases up hundreds of
I have some data that I've staged in my database as such: RowHeader ColumnHeader
In our last episode ( How I constructed a cross database query in MySQL
I have googled some time now trying to find a good sample application that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.