Raghavendra Reddy <raghavendrar@aztec.soft.net> writes:
> While inserting numeric data type into a table can you please let me
> know how you are storing the value in the database.
From src/include/utils/numeric.h:
/** The Numeric data type stored in the database** NOTE: by convention, values in the packed form have been stripped
of*all leading and trailing zero digits (where a "digit" is of base NBASE).* In particular, if the value is zero, there
willbe no digits at all!* The weight is arbitrary in that case, but we normally set it to zero.*/
typedef struct NumericData
{ int32 varlen; /* Variable size (std varlena header) */ int16 n_weight; /* Weight of 1st
digit */ uint16 n_sign_dscale; /* Sign + display scale */ char n_data[1]; /* Digits (really array
ofNumericDigit) */
} NumericData;
See also the comments at the top of src/backend/utils/adt/numeric.c.
regards, tom lane