Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQcac-0000jZ-V3 for pgsql-sql@arkaria.postgresql.org; Thu, 08 Oct 2020 20:32:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kQcab-0005BF-Rv for pgsql-sql@arkaria.postgresql.org; Thu, 08 Oct 2020 20:32:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQcab-0005B8-LF for pgsql-sql@lists.postgresql.org; Thu, 08 Oct 2020 20:32:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQcaU-0001D4-RW for pgsql-sql@lists.postgresql.org; Thu, 08 Oct 2020 20:32:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 098KWStI2624733; Thu, 8 Oct 2020 16:32:28 -0400 From: Tom Lane To: p.sun.fun@gmail.com cc: pgsql-sql@lists.postgresql.org Subject: Re: libpq CREATE DATABASE operation from multiple treads In-reply-to: References: <390804abe88e4e9da9049f6e05c841783acaca47.camel@gmail.com> <2623291.1602187023@sss.pgh.pa.us> Comments: In-reply-to p.sun.fun@gmail.com message dated "Thu, 08 Oct 2020 15:04:24 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2624731.1602189148.1@sss.pgh.pa.us> Date: Thu, 08 Oct 2020 16:32:28 -0400 Message-ID: <2624732.1602189148@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk p.sun.fun@gmail.com writes: > Thanks for the quick response. In the function that I execute in each > thread, I create a new PGconn at the beginning. I expect that every > function caller (thread) should use a unique PGconn. I would not expect > that PGconn can be shared between threads. The documentation explicitly > says that. In that case you need to probe a little deeper. What error message(s) are you getting? Is there anything relevant in the server's log? regards, tom lane