Thread: postgresql authentication

postgresql authentication

From
Hal Lynch
Date:
I want to require users to authenticate themselves by entering
a username and/or password when:

    using the psql command

    connecting to a database using the perl interface module.

I am doing this on my 7.1.2 system.

I am trying to do this on my 7.2.1 system.

I have used creatuser and pg_password.

my pg_hba.conf file has the following line:

local    all        password passwd

"select * from pg_shadow;" and "select * from pg_user;" shows
the users I have added but "psql template1" still does not
require a username and/or password.

I have checked the pertinent (I think) parts of the book
"PostgreSQL Introduction and Concepts"  and the administrators guide
on the web site.

Can some kind soul give me a clue how to do it, or where to look
for instructions?

hal


Re: postgresql authentication

From
Jean-Michel POURE
Date:
Le Mercredi 1 Mai 2002 21:55, Hal Lynch a écrit :
> Can some kind soul give me a clue how to do it, or where to look
> for instructions?

Did you restart PostgreSQL service to reload pg_hba.conf?
"service postgresql restart"

Just my two cents,
Jean-Michel POURE

Re: postgresql authentication

From
Hal Lynch
Date:
On Wednesday, May 1, 2002, at 04:09 PM, Jean-Michel POURE wrote:
> Did you restart PostgreSQL service to reload pg_hba.conf?
> "service postgresql restart"

Of course not?! :^}

Thanks, worked like a charm.

hal, the simple.


SUM PROBLEM...

From
Sonia Sanchez Diaz
Date:
Hy!

I have one money type field and I need to plus it, but when I run the
query I get a negative answer!

But I don't have negative numbers into this field...???

What's up here??

The query is:

select sum(field) from table;

and the answer is:

field
--------
-$5,083,598.58

Regards!

Sonny





Re: SUM PROBLEM...

From
David Stanaway
Date:
On Thu, 2002-05-09 at 12:48, Sonia Sanchez Diaz wrote:
>
> Hy!
>
> I have one money type field and I need to plus it, but when I run the
> query I get a negative answer!
>
> But I don't have negative numbers into this field...???
>
> What's up here??
>
> The query is:
>
> select sum(field) from table;
>
> and the answer is:
>
> field
> --------
> -$5,083,598.58


Sounds like you are getting an overflow.
http://www.postgresql.org/idocs/index.php?datatype-money.html
Type Name    Storage    Description    Range
money        4 bytes    Fixed-precision    -21474836.48 to +21474836.47

NB: Its use is deprecated

Try using numeric:
http://www.postgresql.org/idocs/index.php?datatype.html#DATATYPE-NUMERIC-DECIMAL

I am not sure how you can convert the date to numeric, as on my database
(7.2.1) you cannot cast from money to numeric, or float (float would be
a bad idea for storage of monetary data).

 select sum(m::numeric) from foo;
ERROR:  Cannot cast type 'money' to 'numeric'

Maybe someone else could chime in at this point. : )

--
David Stanaway

Attachment