Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Problems with money fields.

From: Jason Earl <jearl(at)box100(dot)com>
To: matthew(at)venux(dot)net
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Problems with money fields.
Date: 1999-05-19 03:21:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Apparently a NULL money value is not equal to zero.  That is probably
a good thing.

The select you want for selecting all of the null values is:



   I was wondering if someone could shed some light on money fileds for me.  I
   am having a problem in that a money field plus a null money field equals
   null.  Try this:

   create table test(total money);
   insert into test values('');
   insert into test valuse(NULL);

   select * from test;

   (2 rows)

   select '1'::money + total from test;

   (2 rows)

   Why is the second column blank?  This is really throwing my calculations
   because there are times when $0.00 is different from no value at all.
   Also, how can I get a query of all rows where the money value is NULL?
   This fails:

   select * from test where total = NULL;
   ERROR:  parser: parse error at or near "null"

   and this gives me the rows with $0.00:

   select * from test where total = '';  
   (1 row)

   If I can't query for a money field with a NULL value, why can I insert one?

   Thank you,
   Matthew Hagerty

In response to


pgsql-interfaces by date

Next:From: Hannu KrosingDate: 1999-05-19 08:33:20
Subject: Re: [INTERFACES] Problems with money fields.
Previous:From: Matthew HagertyDate: 1999-05-19 00:39:41
Subject: Problems with money fields.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group