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

Re: Numeric 508 datatype

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Numeric 508 datatype
Date: 2005-12-02 22:11:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackerspgsql-patches
Michael Fuhr wrote:
> On Fri, Dec 02, 2005 at 04:30:54PM -0500, Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > Wow, check this out:
> > > 	test=> SELECT CAST (pow(10::numeric, 10000) + 1 AS TEXT)
> > > It works fine!  I have all the digits, and the trailing 1.0:
> > > 	000001.0000000000000000
> > > while SELECT pow(10::numeric, 10000) fails.
> > 
> > That's just about as wacky as can be, because numeric_text() is
> > implemented on top of numeric_out() ... there's no way that numeric_out
> > can be delivering the wrong answer if the cast produces the right text.
> > So somewhere between numeric_out and the delivery to the client,
> > something's getting confused.  I think it's time you got out your
> > debugger and started tracing through the backend ...
> Bruce, have you run a process trace on the backend to see if write()
> (or whatever) is writing the correct number of characters?  What
> exactly is your output device and how are you connected to the
> machine that runs the backend (ssh to a remote box from an xterm,
> sitting in front of the box's VT52 serial console, etc.)?
> If you run the query that fails in a standalone backend, do you get
> something like "(typeid = 1700, len = -1, typmod = -1, byval = f)"
> at the end of the line, or is that part truncated too?

I found the cause.  I traced into printf then realized I was not in libc
but port/snprintf.c, and I see 4096 defined for those buffers.  I will
work on a patch to make it dynamic.  At the time I think there was
thought that 4096 was as large as it ever needed to be, but obviously
this was wrong. I think Win32 would see the same failure because it used
port/snprintf.c too.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2005-12-02 22:20:21
Subject: Re: Numeric 508 datatype
Previous:From: Andrew SullivanDate: 2005-12-02 22:07:22
Subject: Re: Please let us know if you will come to the PostgreSQL Anniversary

pgsql-patches by date

Next:From: Tom LaneDate: 2005-12-02 22:14:57
Subject: Patch for gripe about pg_dump -C not dumping database privileges
Previous:From: Michael FuhrDate: 2005-12-02 22:04:23
Subject: Re: Numeric 508 datatype

pgsql-general by date

Next:From: Tony CadutoDate: 2005-12-02 22:18:53
Subject: Re: was a initdb required from 8.1beta3 -> beta4?
Previous:From: Joshua D. DrakeDate: 2005-12-02 22:08:43
Subject: Re: was a initdb required from 8.1beta3 -> beta4?

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