pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yasuo Ohgaki <yasuo_ohgaki@hotmial.com>
Cc: pgsql-general@postgresql.org
Subject: Re: libpq bug? (I guess not)
Date: Tue, 03 Apr 2001 14:45:25 -0400
Message-ID: <6660.986323525@sss.pgh.pa.us> (raw)
In-Reply-To: <9a6r0n$2imr$1@news.tht.net>
References: <9a6r0n$2imr$1@news.tht.net>

"Yasuo Ohgaki" <yasuo_ohgaki@hotmial.com> 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



view thread (3+ messages)

Message-ID: <6660.986323525@sss.pgh.pa.us>
Permalink:  ../6660.986323525@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6660.986323525@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, yasuo_ohgaki@hotmial.com, pgsql-general@postgresql.org
  Subject: Re: libpq bug? (I guess not)
  In-Reply-To: <6660.986323525@sss.pgh.pa.us>
  References: <9a6r0n$2imr$1@news.tht.net> <6660.986323525@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox