Thread: createlang difficulty.

createlang difficulty.

From
speedboy
Date:
Postgresql 7.1.3

I'm having a problem with createlang.

Commands:

[postgres@boxy postgres]$ createdb test1
Password:                                                   <----- Correct
password
CREATE DATABASE
[postgres@boxy postgres]$ createlang plpgsql test1
Password:                                                   <----- Correct
password (does not say it was incorrect, the first character is upper
case)
Password:                                                   <-----
Incorrect password "something"
psql: Password authentication failed for user 'postgres'
Password:                                                   <-----
Incorrect password "something"
psql: Password authentication failed for user 'postgres'
createlang: language installation failed
[postgres@boxy postgres]$

Logs corresponding to those commands:

2001-10-22 15:15:22 [13115]  DEBUG:  connection: host=[local]
user=postgres database=template1
2001-10-22 15:15:33 [13125]  DEBUG:  connection: host=[local]
user=postgres database=test1
Password authentication failed for user 'postgres'
Password authentication failed for user 'postgres'

pg_hba.conf entry:
local        all                                           crypt

Now again have a look at this (quite interesting):

[postgres@boxy postgres]$ dropdb test1
Password:
DROP DATABASE
[postgres@boxy postgres]$ createdb test1
Password:
CREATE DATABASE
[postgres@boxy postgres]$ createlang -l test1
Password:   Procedural languagesName | Trusted? | Compiler
------+----------+----------
(0 rows)

[postgres@boxy postgres]$ createlang plpgsql test1
Password:
Password:
Password:
Password:
[postgres@boxy postgres]$ createlang -l test1
Password:    Procedural languages Name   | Trusted? | Compiler
---------+----------+----------plpgsql | t        | PL/pgSQL
(1 row)

[postgres@boxy postgres]$

I had to enter the password 4 times for it to create the language.

Thanks.



Re: createlang difficulty.

From
speedboy
Date:
> I just tried it with current sources and got:
> 
>     #$ aspg createlang plpgsql test
>     Password: <- bad password
>     FATAL 1:  Password authentication failed for user "postgres"
>     psql: FATAL 1:  Password authentication failed for user "postgres"
>     
>     createlang: external error
>     #$ aspg createlang plpgsql test
>     Password: <- correct password
>     Password: <- correct password
>     Password: <- correct password
>     Password: <- correct password
> 
> Looks OK to me.

Ok, so it connects four times. From a users perspective that might be
confusing. Is it possible to only prompt once for the password, just an
idea I guess whoever created the program would want that to happen from a
easy to use point of view. I.e. dummy proof?

Thankyou.



Re: createlang difficulty.

From
Bruce Momjian
Date:
> > I just tried it with current sources and got:
> > 
> >     #$ aspg createlang plpgsql test
> >     Password: <- bad password
> >     FATAL 1:  Password authentication failed for user "postgres"
> >     psql: FATAL 1:  Password authentication failed for user "postgres"
> >     
> >     createlang: external error
> >     #$ aspg createlang plpgsql test
> >     Password: <- correct password
> >     Password: <- correct password
> >     Password: <- correct password
> >     Password: <- correct password
> > 
> > Looks OK to me.
> 
> Ok, so it connects four times. From a users perspective that might be
> confusing. Is it possible to only prompt once for the password, just an
> idea I guess whoever created the program would want that to happen from a
> easy to use point of view. I.e. dummy proof?

Uh, yes, connecting once would be ideal.  It currently runs each SQL
query it needs in psql and checks the exit status.  Not sure how to code
that in one psql session.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: createlang difficulty.

From
Bruce Momjian
Date:
I just tried it with current sources and got:
#$ aspg createlang plpgsql testPassword: <- bad passwordFATAL 1:  Password authentication failed for user
"postgres"psql:FATAL 1:  Password authentication failed for user "postgres"createlang: external error#$ aspg createlang
plpgsqltestPassword: <- correct passwordPassword: <- correct passwordPassword: <- correct passwordPassword: <- correct
password

Looks OK to me.

> Postgresql 7.1.3
> 
> I'm having a problem with createlang.
> 
> Commands:
> 
> [postgres@boxy postgres]$ createdb test1
> Password:                                                   <----- Correct
> password
> CREATE DATABASE
> [postgres@boxy postgres]$ createlang plpgsql test1
> Password:                                                   <----- Correct
> password (does not say it was incorrect, the first character is upper
> case)
> Password:                                                   <-----
> Incorrect password "something"
> psql: Password authentication failed for user 'postgres'
> Password:                                                   <-----
> Incorrect password "something"
> psql: Password authentication failed for user 'postgres'
> createlang: language installation failed
> [postgres@boxy postgres]$
> 
> Logs corresponding to those commands:
> 
> 2001-10-22 15:15:22 [13115]  DEBUG:  connection: host=[local]
> user=postgres database=template1
> 2001-10-22 15:15:33 [13125]  DEBUG:  connection: host=[local]
> user=postgres database=test1
> Password authentication failed for user 'postgres'
> Password authentication failed for user 'postgres'
> 
> pg_hba.conf entry:
> local        all                                           crypt
> 
> Now again have a look at this (quite interesting):
> 
> [postgres@boxy postgres]$ dropdb test1
> Password:
> DROP DATABASE
> [postgres@boxy postgres]$ createdb test1
> Password:
> CREATE DATABASE
> [postgres@boxy postgres]$ createlang -l test1
> Password:
>     Procedural languages
>  Name | Trusted? | Compiler
> ------+----------+----------
> (0 rows)
> 
> [postgres@boxy postgres]$ createlang plpgsql test1
> Password:
> Password:
> Password:
> Password:
> [postgres@boxy postgres]$ createlang -l test1
> Password:
>      Procedural languages
>   Name   | Trusted? | Compiler
> ---------+----------+----------
>  plpgsql | t        | PL/pgSQL
> (1 row)
> 
> [postgres@boxy postgres]$
> 
> I had to enter the password 4 times for it to create the language.
> 
> Thanks.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: createlang difficulty.

From
Tom Lane
Date:
speedboy <speedboy@nomicrosoft.org> writes:
> Ok, so it connects four times. From a users perspective that might be
> confusing. Is it possible to only prompt once for the password,

This would require replacing the createlang shell script with a
specialized C program.  (Or, perhaps, adding conditional-execution
capability to psql scripts ... which would be very useful but an
awful lot of work.)

It's unlikely to get to the top of anyone's to-do list any time soon,
because the fact of the matter is that if you have Postgres configured
to demand passwords for administrator connections, you're going to have
lots of problems like this.  createlang is not the only script that
invokes multiple programs --- pg_dumpall is another example that's
going to be even harder to work around.

The better answer is to arrange things so that local connections don't
need passwords.  One fairly portable approach is to run an IDENTD daemon
and use ident auth for TCP connections through 127.0.0.1; then you just
say PGHOST=127.0.0.1 and you're home free.
        regards, tom lane