Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t92n4-007Q0o-0D for pgsql-admin@arkaria.postgresql.org; Thu, 07 Nov 2024 13:43:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t92n1-00Fl2f-G8 for pgsql-admin@arkaria.postgresql.org; Thu, 07 Nov 2024 13:43:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t92n1-00Fl2X-50 for pgsql-admin@lists.postgresql.org; Thu, 07 Nov 2024 13:43:11 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t92mu-000der-JS for pgsql-admin@lists.postgresql.org; Thu, 07 Nov 2024 13:43:09 +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 4A7Dh2g53414976; Thu, 7 Nov 2024 08:43:02 -0500 From: Tom Lane To: "David G. Johnston" cc: Edwin UY , "pgsql-admin@lists.postgresql.org" Subject: Re: \i and \watch In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Wed, 06 Nov 2024 22:26:53 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3414974.1730986982.1@sss.pgh.pa.us> Date: Thu, 07 Nov 2024 08:43:02 -0500 Message-ID: <3414975.1730986982@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Watch is documented to act on either a non-empty query buffer or the last > sent command. I would expect that whatever the final SQL command present > in x.sql is would be the command that gets watched. If indeed the > preceding select 1 command is watched there would seem to be an > undocumented interaction going on. It looks like there's a separate query_buf for each recursive level of MainLoop(), that is, each level of \i. So maybe the docs need improvement here. (I think the actual behavior is probably fine.) regards, tom lane