X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F3CB5475458 for ; Thu, 3 Apr 2003 04:11:52 -0500 (EST) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id DA255474E44 for ; Thu, 3 Apr 2003 04:11:45 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Thu Apr 03 11:11:46 2003 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id LAA01728; Thu, 3 Apr 2003 11:11:45 +0200 (METDST) Message-ID: <3E8BFAD1.40107@rodos.fzk.de> Date: Thu, 03 Apr 2003 11:11:45 +0200 From: Christoph Haller User-Agent: Mozilla/5.0 (X11; U; HP-UX 9000/780; en-US; rv:1.3) Gecko/20030321 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Cc: frankie@ucr.com.hk Subject: Re: Segmentation Fault Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-12.1 required=5.0 tests=BAYES_10,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/13 X-Sequence-Number: 3952 > > I want to ask what does the error message mean by > "0x40023abb in resetPQExpBuffer () from /usr/local/pgsql/lib/libpq.so.3"? > I got this message using GDB to trace the program. > (Segmentation fault occurswhen run the program directly.) > > I reviewed the program many times, and found this is only to happen when > I call the `ctime()' or `time()' in a program function. > > code fragment FYI > --8<------------------------ > // `res = PQexec(conn, sql)' here.. > ... > ... > } > else if (!strcmp(PQfname(res, i), SYNCTIME_FIELD_NAME)) > { > // puts("7"); > //char chP[30]; > printf("timer=%ld\n", time(timer)); // <====== without this line, the > program works > // printf("%s", ctime(time(NULL))); > // printf("%s", asctime(localtime(&timer))); > sprintf(tmp, "'1999-12-11 09:50:58'::timestamp, "); I would like to see the declaration of the "timer" variable. Is it "time_t"? Then you should code "&timer" as in localtime(&timer). Is it "time_t *"? Then, did you alloc'd memory? Regards, Christoph