public inbox for [email protected]  
help / color / mirror / Atom feed
Documentation for numeric/decimal type does not say that precision can be specified without scale
2+ messages / 2 participants
[nested] [flat]

* Documentation for numeric/decimal type does not say that precision can be specified without scale
@ 2018-03-11 17:58  PG Doc comments form <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2018-03-11 17:58 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/static/datatype.html
Description:

The documentation for the numeric/decimal type does not say that the
precision parameter can be specified without specifying a scale, e.g.
numeric(10) is valid.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Documentation for numeric/decimal type does not say that precision can be specified without scale
@ 2018-03-11 18:04  Tom Lane <[email protected]>
  parent: PG Doc comments form <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-03-11 18:04 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

=?utf-8?q?PG_Doc_comments_form?= <[email protected]> writes:
> The documentation for the numeric/decimal type does not say that the
> precision parameter can be specified without specifying a scale, e.g.
> numeric(10) is valid.

Where are you looking exactly?  What I see under 8.1.2 is

    Both the maximum precision and the maximum scale of a numeric column
    can be configured. To declare a column of type numeric use the syntax:
    
        NUMERIC(precision, scale)

    The precision must be positive, the scale zero or
    positive. Alternatively:
    
        NUMERIC(precision)

    selects a scale of 0. Specifying:
    
        NUMERIC

    without any precision or scale creates a column in which numeric
    values of any precision and scale can be stored, up to the
    implementation limit on precision. A column of this kind will not
    coerce input values to any particular scale, whereas numeric columns
    with a declared scale will coerce input values to that scale. (The SQL
    standard requires a default scale of 0, i.e., coercion to integer
    precision. We find this a bit useless. If you're concerned about
    portability, always specify the precision and scale explicitly.)


			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-03-11 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 17:58 Documentation for numeric/decimal type does not say that precision can be specified without scale PG Doc comments form <[email protected]>
2018-03-11 18:04 ` Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox