Float / Numeric ?

From: Rudi Starcevic <rudi(at)oasis(dot)net(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Float / Numeric ?
Date: 2002-07-22 00:06:00
Message-ID: 3D3B4C68.1040500@oasis.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Folks,

I have an ecommerce application I'm writing and I'm not sure / undecided
on a
particular way to store shipping rates in PostgreSQL

In this application a user may set the shipping rate per item.

So I have 3 fields - local,state and international.
A forth field, shipping_type (varchar), holds a value 'dollars' or
'percent'.

My twisted logic says a user may say this item has 10 perent shipping to
add or 10 dollars to add.
This means the shipping rate my be either dollars or percent and can be
set on a per item basis.

For the 3 fields I'm not sure which is best to use - Float or Numeric ?

My application language is ColdFusion and PHP.

I'd like to ask which data type would be the better choice.
At this stage I'm using Float to represent a value that may be either
dollars or percent.

Perhaps this technique, using a varchar as a type of switch
(shipping_type) , is incorrect / silly / stupid / not robust enough or
just plain wrong.

Do you think this is OK and if so which would you use - Floast or Numeric ?
Thanks for your time.
Cheers
Rudi.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel Stüwe 2002-07-22 00:50:12 "no wait" in locks
Previous Message mark carew 2002-07-21 00:11:25 7.3 features and enhancements