pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is this valid?
2+ messages / 2 participants
[nested] [flat]

* Is this valid?
@ 2002-08-12 23:26  Wei Weng <wweng@kencast.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Wei Weng @ 2002-08-12 23:26 UTC (permalink / raw)
  To: pgsql-interfaces

I am not sure if this is the right mailing list I talk to. Please let me
know if I had violated any unwritten rules. :)

I have a global variable PGconn* m_pgconn that is the connection handle
for connecting to the postgresql database. Can I access/use the handle
from multiple threads? Say I have a thread that does some insertion
through this handle/database connection(m_pgconn) and also another
thread that do some insertion *on the same table* through this
handle(m_pgconn), will that break?

Thanks

-- 
Wei Weng
Network Software Engineer
KenCast Inc.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Is this valid?
@ 2002-08-13 00:50  Rick Gregory <rgregory@gbgsoft.com>
  parent: Wei Weng <wweng@kencast.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Rick Gregory @ 2002-08-13 00:50 UTC (permalink / raw)
  To: Wei Weng <wweng@kencast.com>; pgsql-interfaces

No, what you want to do is not thread safe.

Only 1 thread should access a Pgconn object.

See:
http://www2.ca.postgresql.org/users-lounge/docs/7.0/postgres/libpq-threading
.htm


Rick Gregory

-----Original Message-----
From: pgsql-interfaces-owner@postgresql.org
[mailto:pgsql-interfaces-owner@postgresql.org]On Behalf Of Wei Weng
Sent: Monday, August 12, 2002 7:26 PM
To: pgsql-interfaces@postgresql.org
Subject: [INTERFACES] Is this valid?

I am not sure if this is the right mailing list I talk to. Please let me
know if I had violated any unwritten rules. :)

I have a global variable PGconn* m_pgconn that is the connection handle
for connecting to the postgresql database. Can I access/use the handle
from multiple threads? Say I have a thread that does some insertion
through this handle/database connection(m_pgconn) and also another
thread that do some insertion *on the same table* through this
handle(m_pgconn), will that break?

Thanks

--
Wei Weng
Network Software Engineer
KenCast Inc.



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-08-13 00:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-12 23:26 Is this valid? Wei Weng <wweng@kencast.com>
2002-08-13 00:50 ` Rick Gregory <rgregory@gbgsoft.com>

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