SUM PROBLEM...

Lists: pgsql-admin
From: Hal Lynch <hal(at)cc(dot)usu(dot)edu>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: postgresql authentication
Date: 2002-05-01 19:55:21
Message-ID: 5EB5B512-5D3D-11D6-98A1-0050E490FD5B@cc.usu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

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


From: Jean-Michel POURE <jm(dot)poure(at)freesurf(dot)fr>
To: Hal Lynch <hal(at)cc(dot)usu(dot)edu>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgresql authentication
Date: 2002-05-01 22:09:40
Message-ID: 200205020009.40294.jm.poure@freesurf.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

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


From: Hal Lynch <hal(at)cc(dot)usu(dot)edu>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgresql authentication
Date: 2002-05-01 22:43:26
Message-ID: D992E025-5D54-11D6-98A1-0050E490FD5B@cc.usu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin


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.


From: David Stanaway <david(at)stanaway(dot)net>
To: Sonia Sanchez Diaz <sonny(at)piaget(dot)dgsca(dot)unam(dot)mx>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: SUM PROBLEM...
Date: 2002-05-09 16:25:07
Message-ID: 1020961507.6259.57.camel@ciderbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

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


From: Sonia Sanchez Diaz <sonny(at)piaget(dot)dgsca(dot)unam(dot)mx>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: SUM PROBLEM...
Date: 2002-05-09 17:48:16
Message-ID: Pine.SGI.4.10.10205091043130.215963-100000@piaget.dgsca.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin


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