X-Original-To: pgsql-interfaces@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 800E1925297 for ; Mon, 26 May 2003 12:30:20 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 22980-05 for ; Mon, 26 May 2003 12:30:19 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id A513B925203 for ; Mon, 26 May 2003 12:30:18 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4QGUHU6002073; Mon, 26 May 2003 12:30:17 -0400 (EDT) To: "Dietmar May" Cc: pgsql-interfaces@postgresql.org Subject: Re: Race condition with libpq In-reply-to: <008401c3239e$1cd6ccf0$fb02a8c0@muskrat> References: <008401c3239e$1cd6ccf0$fb02a8c0@muskrat> Comments: In-reply-to "Dietmar May" message dated "Mon, 26 May 2003 11:47:29 -0400" Date: Mon, 26 May 2003 12:30:16 -0400 Message-ID: <2072.1053966616@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/71 X-Sequence-Number: 4189 "Dietmar May" writes: > Would I be right in guessing (from your comments) that if PQexec issues a > command that does not return a result set, that it executes it > asynchronously? PQexec is synchronous. Connection closure is not, though: there is no response from the backend (and hardly could be). > That's the only way that I could see this could fail -- because my code > can't issue a CREATE DATABASE until after the PQexec("DROP DATABASE") has > returned. You're missing the point. It's the DROP that's failing, not the CREATE, and it's failing because the old backend is still connected to the victim database. > I guess I had misread the first statement as meaning "you can drop the > template1 database and have a cluster that doesn't contain a database called > template1"; but this is apparently not a valid interpretation, since PGsql > seems to use template1 for many internal operations. It is not used for any "internal" operations. It is conventionally present so that clients have a standard place to connect to. regards, tom lane