public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Edwin UY <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: \i and \watch
Date: Wed, 6 Nov 2024 22:26:53 -0700
Message-ID: <CAKFQuwZvMkCNffV8_X2yeVFJdOaFKwVUEuWcLpsvP-w+YjwBGw@mail.gmail.com> (raw)
In-Reply-To: <CA+wokJ-NAMMVdo52WdwmGN8CasaE026jhRH7yb1MFU2eF=HeEw@mail.gmail.com>
References: <CA+wokJ-NAMMVdo52WdwmGN8CasaE026jhRH7yb1MFU2eF=HeEw@mail.gmail.com>

On Wednesday, November 6, 2024, Edwin UY <[email protected]> wrote:

>
> Is there no way to use \watch to let it run the last script that I just
> run?
>
> When do I do as below:
>
> select 1 ;
> \i x.sql
> \watch 20
>
> It runs select 1 instead.
>
>
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.

In any case, no, you cannot watch a meta-command.  You’d have to resort to
shell scripting the repeated execution of the psql program itself.

David J.


view thread (4+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: \i and \watch
  In-Reply-To: <CAKFQuwZvMkCNffV8_X2yeVFJdOaFKwVUEuWcLpsvP-w+YjwBGw@mail.gmail.com>

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

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