X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 89663475C3D for ; Thu, 3 Apr 2003 06:28:04 -0500 (EST) Received: from localhost.localdomain (unknown [217.207.14.249]) by postgresql.org (Postfix) with ESMTP id 88068475458 for ; Thu, 3 Apr 2003 06:28:03 -0500 (EST) Received: from JAMES (host213-123-251-124.in-addr.btopenworld.com [213.123.251.124]) by localhost.localdomain (8.12.6/8.11.6) with SMTP id h33BM4kC018287 for ; Thu, 3 Apr 2003 12:22:07 +0100 Message-ID: <000401c2f9d3$ee3c9a80$6600a8c0@JAMES> From: "James Williamson" To: References: <3E8C19B5.6050106@rodos.fzk.de> Subject: Re: Segmentation Fault Date: Thu, 3 Apr 2003 12:26:54 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Status: No, hits=-19.1 required=5.0 tests=BAYES_20,ORIGINAL_MESSAGE,QUOTED_EMAIL_TEXT,REFERENCES 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/17 X-Sequence-Number: 3956 ----- Original Message ----- From: "Christoph Haller" > > > > Oh, I'm so sorry.... > > I've made a stupid mistake... and this mistake is at the cost of 3 days > > work. > > The segmentation fault is totally irrelevant to the time functions in > > previous thread. > > > Keep your head. > AFAICT segmentation faults are every C programmer's nightmare > and best known for hard to find. I know of people searching for > mistakes even longer and I've seen mistakes more stupid than yours. > > > > > Here I have one more question, is there any debugging tools other > than GDB? > > I'm not quite used to it, debugging segmentation fault is really a > pain. :-( > > Have you looked at efence, purify and valgrind? Regards, James Williamson www.nameonthe.net Tel: +44 208 7415453 Fax: + 44 208 7411615 > I don't know of one. I'm using xdb on HP-UX, which is quite similar I > suppose. > I've found it useful when trying to track down, do not trace, but let it > simply run > within the debugger and then use the "down" command to find your code area. > There is also a function called memorymap(int show_stats) which often > detects > memory faults before the operating systems does. > > > len =strlen(PQgetvalue(res, 0, i)) * 2 + 1; // <========= > Why not using PQgetlength(res, 0, i)? > > PQescapeString(tmp2, PQgetvalue(res, 0, i), len); // <========= > One last question: > Why are you using PQescapeString on PQgetvalue? > > The doc says: > If you want to include strings that have been received from a source > that is not trustworthy (for example, because a random user entered > them), you cannot directly include them in SQL queries for security > reasons. Instead, you have to quote special characters that are > otherwise interpreted by the SQL parser. > > So PQgetvalue is trustworthy. There should be no need to call > PQescapeString, > except you were using a binary cursor. But if you were using one, then why > would you want to escape the result instead of just using a normal cursor? > > Regards, Christoph > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >