Re: Bug #640: ECPG: inserting float numbers

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: edx(at)astercity(dot)net
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #640: ECPG: inserting float numbers
Date: 2002-06-10 19:57:15
Message-ID: 200206101957.g5AJvFv11439@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Has this been addressed? Can you supply a reproducable example?

---------------------------------------------------------------------------

Edward Pilipczuk wrote:
> On Monday, 22 April 2002 18:41, you wrote:
> > Edward (edx(at)astercity(dot)net) reports a bug with a severity of 1
> > The lower the number the more severe it is.
> >
> > Short Description
> > ECPG: inserting float numbers
> >
> > Long Description
> > Inserting records with single precision real variables having small value
> > (range 1.0e-6 or less) frequently results in errors in ECPG translations
> > putting into resulted sql statement unexpected characters => see fragments
> > of sample code and ECPGdebug log where after value of rate variable the
> > unexpected character '^A' appears
> >
> > Sample Code
> > /* fragment of the program code */
> > exec sql begin declare section;
> > /* ... */
> > float rate; /* level change rate */
> > /* ... */
> > exec sql end declare section;
> > /* ... */
> > sprintf(buf,"INSERT: %.8s.%.8s @%.32s -> %08x/%08x %f %f %f %f %f", loc,
> > name, ts, devstat, meastat, relative, level, ullage, rate, volume );
> > dbg_message( __FILE__, __LINE__, DBG_DBI, MSG_SQL, buf );
> > exec sql INSERT INTO rdr_meas ( name, loc, ts, devstat, meastat, relative,
> > level, ullage, levelrate, volume ) VALUES ( :name, :loc, 'now', :devstat,
> > :meastat, :relative, :level, :ullage, :rate, :volume ) ; /* ... */
> > ---
> > The above produces in ECPG debug :
> > ...
> > [2782]: ECPGexecute line 1042: QUERY: insert into rdr_meas ( name , loc ,
> > ts , devstat , meastat , relative , level , ullage , levelrate ,
> > volume ) values ( 'NR1 ' , 'Swedwood' , 'now' , 0 , 4096 ,
> > 37.388961791992 , 0.71039032936096 , 1.1896096467972 , -5.5060195336409e-06
> > ^A , 3.4871203899384 ) on connection radar [2782]: ECPGexecute line 1042:
> > Error: ERROR: parser: parse error at or near "^A" [2782]: raising sqlcode
> > -400 in line 1042, ''ERROR: parser: parse error at or near "^A"' in line
> > 1042.'.
> >
> >
> > No file was uploaded with this report
> >
> ----------
> I am fighting with this bug on "PostgreSQL 7.2 on i686-pc-linux-gnu, compiled
> by GCC 2.96". It appears also on 7.1.x, which was reported previously
> (see buglist -> ecpg: unstable INSERT operation) on August 2001.
> The temporary workaround I apllied here is "if" statement before INSERT:
> if( fabs( rate ) < 1.0e-3 ) rate = 0.0;
>
> Edward
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephen R. van den Berg 2002-06-10 21:58:33 Referential integrity problem postgresql 7.2 ?
Previous Message vikas p verma 2002-06-10 19:10:14 PostGres Doubt

Browse pgsql-hackers by date

  From Date Subject
Next Message vikas p verma 2002-06-10 20:09:57 PostGres Doubt
Previous Message Lamar Owen 2002-06-10 19:54:13 Re: Project scheduling issues (was Re: Per tuple overhead,