Re: [GENERAL] How to set decimal(7,2)? - Mailing list pgsql-general

From Jose' Soares
Subject Re: [GENERAL] How to set decimal(7,2)?
Date
Msg-id 35F918A4.82AB3E3B@sferacarta.com
Whole thread Raw
In response to How to set decimal(7,2)?  ("sim" <sim@infomatch.com>)
List pgsql-general
sim wrote:
>
> How come when I try to set a variable as decimal(7,2), it
> automatically complains that decimal(7,2) is not acceptable; however,
> decimal(7,0) is okay? It changes to float4  by itself?
>
> thanks.

From man pgbuiltin:

<DELETED>
       There  are  some data types defined by SQL/92 syntax which
       are mapped directly into native Postgres types. Note  that
       the "exact numerics" decimal and numeric have fully imple­
       mented syntax but currently (PostgreSQL v6.3) support only
       a limited range of the values allowed by SQL/92.

List of SQL/92 types
  POSTGRES Type  SQL/92 Type              Meaning
  char(n)        character(n)             fixed-length character string
  varchar(n)     character varying(n)     variable-length character
string
  float4/8       float(p)                 floating-point number with
precision p
  float8         double precision         double-precision
floating-point number
  float8         real                     double-precision
floating-point number
  int2           smallint                 signed two-byte integer
  int4           int                      signed 4-byte integer
  int4           integer                  signed 4-byte integer
  int4           decimal(p,s)             exact numeric for p <= 9, s =
0
  int4           numeric(p,s)             exact numeric for p == 9, s =
0
  timestamp      timestamp with time zone date/time
  timespan       interval                 general-use time span


                      Jose'

pgsql-general by date:

Previous
From: "Jose' Soares"
Date:
Subject: Re: [GENERAL] Is it possible to drop a column?
Next
From: yogesh@ncbs.tifrbng.res.in (Yogesh Bhanu)
Date:
Subject: ...