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

ecpg: unstable INSERT operation

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: ecpg: unstable INSERT operation
Date: 2001-08-07 10:20:49
Message-ID: 200108071020.f77AKnC33747@hub.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Edward Pilipczuk (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: unstable INSERT operation 

Long Description
Frequently INSERT operation causes backend crash (with SIGSEGV) or the parser reports: error [-400] 'ERROR:  parser: parse error at or near "^Y"' in line xxx. 

Sample Code
 Table definition:
 Table "rdr_meas"
 Attribute |           Type           |                       Modifier
-----------+--------------------------+------------------------------------------
 seq       | integer                  | not null default nextval('rdr_meas_serial_seq'::text)
 name      | character(8)             | not null
 loc       | character(8)             | not null
 ts        | timestamp with time zone | not null
 devstat   | integer                  | not null
 meastat   | integer                  | not null
 relative  | real                     |
 level     | real                     |
 ullage    | real                     |
 levelrate | real                     |
 volume    | real                     |
Index: rdr_meas_pkey

Embedded code:
...............
long sql_checkresult()
{
  
  if ( sqlca.sqlcode ) {
    sprintf( buf, "%s [%d] %s", sqlca.sqlcode<0?"error":"warning", 
	     sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc );
    error_hndlr( WARN_SQL, MSG_SQL, buf );
  };
  return( sqlca.sqlcode );
}
...............
int db_savemeas( rdr, ms )
{
...............
  sprintf(buf,"INSERT: '%.8s'%.8s'%.32s' %08x/%08x %f %f %f %f %f",
	  name, loc, 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, :ts, :devstat, :meastat, :relative, :level, :ullage, :rate, :volume ) ;
  dbg_message( __FILE__, __LINE__, DBG_DBI, MSG_SQL, "Inserted!" );	
  if( sql_checkresult() == 0 ) {
    exec sql COMMIT;
    exec sql SELECT seq INTO :seq FROM rdr_meas ORDER BY seq DESC LIMIT 1;
    if( sql_checkresult() == 0 ) {
      sprintf(buf,"Data record #%d stored and committed.", seq );
      dbg_message( __FILE__, __LINE__, DBG_DBI, MSG_SQL, buf );
      return( seq );
    };
  };

..............
error_handler and dbg_mesage produces the following types of entries in syslog:

...: DEBUG(dbi.pgc/760) SQL: INSERT: 'NR3     'Swedwood'2001-08-06 23:22:08' 00000000/00001000 35.978611 0.841900 1.498100 -0.000002 4.132665
...: DEBUG(dbi.pgc/767) SQL: Inserted!
...: Error condition occured: WARNING: Data base SQL exec error.
...: -- SQL: error [-400] 'ERROR:  parser: parse error at or near "^Y"' in line xxx.

Some times appears that the ecpg program abnormally terminates with the following trace logged by the parent process: signal #17=SGCHLD, existstatus of the child process (SIGSEGV in HEX) is presented here as a value returned by waitpid:

...: DEBUG(radnew.c/129) TASK:  SIGNAL #17 catched.
...: DEBUG(radnew.c/203) TASK:  Child process abnormally terminated, exitstatus=0000000b



No file was uploaded with this report


pgsql-bugs by date

Next:From: Tom LaneDate: 2001-08-07 13:33:24
Subject: Re: =?iso-8859-2?B?T2Rwb3bs7zog?=Re: backend don't use index when querying by indexed column
Previous:From: Win BauschDate: 2001-08-07 09:47:38
Subject: ecpg 2.8.0: at <connection name> problem

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