Re: \i and \watch

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Edwin UY <edwin(dot)uy(at)gmail(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: \i and \watch
Date: 2024-11-07 05:26:53
Message-ID: CAKFQuwZvMkCNffV8_X2yeVFJdOaFKwVUEuWcLpsvP-w+YjwBGw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wednesday, November 6, 2024, Edwin UY <edwin(dot)uy(at)gmail(dot)com> 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.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Edwin UY 2024-11-07 07:49:56 Re: \i and \watch
Previous Message Edwin UY 2024-11-07 05:09:55 \i and \watch