cockroachdb / cockroachdb/cockroach

cli: support \watch meta command with the optional iterations counter

Open
#97,573 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**

PG now has support for `\watch` meta command https://www.postgresql.org/message-id/flat/CAAhFRxiZ2-n_L1ErMm9AZjgmUK%3DqS6VHb%2B0SaMn8sqqbhF7How%40mail.gmail.com

Cockroach has support for `-watch` flag but it is assumed the user is not logged into the command line. Would be good to support an inline watch command.

**Describe the solution you'd like**

I should be able to issue `> select now() \watch 2;` and have the `select now()` execute twice.

**Describe alternatives you've considered**

`cockroach sql -watch ...`

**Additional context**
Add any other context or screenshots about the feature request here.

Jira issue: CRDB-24765

Contributor guide

Open the contributing guide

Research direction

Start by tracing the CockroachDB SQL CLI handling for meta commands and the existing -watch flag. Confirm how an inline \watch command with an optional iteration count should execute the preceding select now() statement, and verify that the requested number of executions occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.