Received: from sss.pgh.pa.us ([216.151.103.158]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f33IjeK13186 for ; Tue, 3 Apr 2001 14:45:40 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.3/8.11.3) with ESMTP id f33IjQw06663; Tue, 3 Apr 2001 14:45:26 -0400 (EDT) To: "Yasuo Ohgaki" cc: pgsql-general@postgresql.org Subject: Re: libpq bug? (I guess not) In-reply-to: <9a6r0n$2imr$1@news.tht.net> References: <9a6r0n$2imr$1@news.tht.net> Comments: In-reply-to "Yasuo Ohgaki" message dated "Sun, 01 Apr 2001 18:05:24 +0900" Date: Tue, 03 Apr 2001 14:45:25 -0400 Message-ID: <6660.986323525@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200104/136 X-Sequence-Number: 7212 "Yasuo Ohgaki" writes: > I have a PHP code to execute query like > $db = pg_pconnect('db=my_db host=localhost user=username'); > $query = "INSERT INTO new_user (username, email, ............) VALUES ('ABC', > 'foo@example.com', ..........);"; > pg_exec($db, $query); // Execute query using database connection $db. > in my script. The script seems executing the query 4 times whenever it's called, > since I get 4 newly inserted records everytime execute the script. You could get some more info about what's happening by turning on query logging in the postmaster (start postmaster with -d2, and be sure NOT to use -S). But I'll bet that some way or other, PHP is submitting the same query multiple times. I have some recollection that pg_pconnect() doesn't behave very well; you might need to avoid that in favor of a plain connect. Check the archives for discussion of pconnect. regards, tom lane