You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "Ruilong Huo (JIRA)" <ji...@apache.org> on 2016/08/09 02:22:22 UTC

[jira] [Updated] (HAWQ-989) PL/Python function with psycopg2 cannot connect to hawq itself

     [ https://issues.apache.org/jira/browse/HAWQ-989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruilong Huo updated HAWQ-989:
-----------------------------
    Description: 
For one use case I want to connect to hawq itself from hawq PL/Python function using python psycopg2 library to retrieve some information. However, it errors with "authentication failed for user "gpadmin": invalid authentication method"

{noformat}
DROP FUNCTION IF EXISTS connection_test();
DROP FUNCTION

CREATE OR REPLACE FUNCTION connection_test( ) RETURNS text AS
$$
import psycopg2

try:
    conn = psycopg2.connect("dbname='gptest' user='gpadmin' host='localhost' port=5432")
    return "Connection successful "
except Exception , msg :
    return "Exception: {m}".format(m=msg)
$$
LANGUAGE 'plpythonu' VOLATILE;
CREATE FUNCTION

SELECT * FROM connection_test();
                                      connection_test
--------------------------------------------------------------------------------------------
 Exception: FATAL:  authentication failed for user "gpadmin": invalid authentication method

(1 row)
{noformat}

  was:
For one use case I want to connect to hawq itself from hawq PL/Python function using python psycopg2 library to retrieve some information. However, it errors with "authentication failed for user "gpadmin": invalid authentication method"

{noformat}
DROP FUNCTION IF EXISTS connection_test();
DROP FUNCTION

CREATE OR REPLACE FUNCTION connection_test( ) RETURNS text AS
$$
import psycopg2

try:
    conn = psycopg2.connect("dbname='gptest' user='gpadmin' host='localhost' port=5433")
    return "Connection successful "
except Exception , msg :
    return "Exception: {m}".format(m=msg)
$$
LANGUAGE 'plpythonu' VOLATILE;
CREATE FUNCTION

SELECT * FROM connection_test();
                                      connection_test
--------------------------------------------------------------------------------------------
 Exception: FATAL:  authentication failed for user "gpadmin": invalid authentication method

(1 row)
{noformat}


> PL/Python function with psycopg2 cannot connect to hawq itself
> --------------------------------------------------------------
>
>                 Key: HAWQ-989
>                 URL: https://issues.apache.org/jira/browse/HAWQ-989
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: Core
>            Reporter: Ruilong Huo
>            Assignee: Lei Chang
>
> For one use case I want to connect to hawq itself from hawq PL/Python function using python psycopg2 library to retrieve some information. However, it errors with "authentication failed for user "gpadmin": invalid authentication method"
> {noformat}
> DROP FUNCTION IF EXISTS connection_test();
> DROP FUNCTION
> CREATE OR REPLACE FUNCTION connection_test( ) RETURNS text AS
> $$
> import psycopg2
> try:
>     conn = psycopg2.connect("dbname='gptest' user='gpadmin' host='localhost' port=5432")
>     return "Connection successful "
> except Exception , msg :
>     return "Exception: {m}".format(m=msg)
> $$
> LANGUAGE 'plpythonu' VOLATILE;
> CREATE FUNCTION
> SELECT * FROM connection_test();
>                                       connection_test
> --------------------------------------------------------------------------------------------
>  Exception: FATAL:  authentication failed for user "gpadmin": invalid authentication method
> (1 row)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)