Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: add \x slash command as alias for \set display_format=records #56706

Closed
erikgrinaker opened this issue Nov 15, 2020 · 1 comment · Fixed by #56829
Closed

sql: add \x slash command as alias for \set display_format=records #56706

erikgrinaker opened this issue Nov 15, 2020 · 1 comment · Fixed by #56829
Labels
O-community Originated from the community

Comments

@erikgrinaker
Copy link
Contributor

erikgrinaker commented Nov 15, 2020

psql has a \x [on|off|auto] slash command to switch between table and record output:

test=# SELECT 1, 2, 3;
 ?column? | ?column? | ?column? 
----------+----------+----------
        1 |        2 |        3
(1 row)

test=# \x
Expanded display is on.
test=# SELECT 1, 2, 3;
-[ RECORD 1 ]
?column? | 1
?column? | 2
?column? | 3

cockroach sql supports the same output formats, but uses \set display_format=records instead:

root@:26257/defaultdb> SELECT 1, 2, 3;
  ?column? | ?column? | ?column?
-----------+----------+-----------
         1 |        2 |        3
(1 row)

Time: 0ms total (execution 0ms / network 0ms)

root@:26257/defaultdb> \set display_format=records
root@:26257/defaultdb> SELECT 1, 2, 3;
-[ RECORD 1 ]
?column? | 1
?column? | 2
?column? | 3

Time: 0ms total (execution 0ms / network 0ms)

I propose adding \x as an alias for toggling between records and table, and supporting the optional on and off parameters (but not auto in the first iteration).

@blathers-crl
Copy link

blathers-crl bot commented Nov 15, 2020

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I have CC'd a few people who may be able to assist you:

  • @tim-o (member of the technical support engineering team)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-oncall labels Nov 15, 2020
erikgrinaker added a commit to erikgrinaker/cockroach that referenced this issue Nov 17, 2020
`psql` has a `\x` command to toggle extended output for results. CRDB
already supports this output format via `\set display_format=records`.
This commit adds `\x [on|off]` to toggle between `records` and `table`
display formats.

The `auto` option from `psql` to automatically enable extended output
depending on the result width is not supported, only `on` and `off`.

Resolves cockroachdb#56706.

Release note (cli change): A `\x [on|off]` command has been added to
toggle the `records` display format, following `psql` behavior.
craig bot pushed a commit that referenced this issue Nov 20, 2020
56829: cli: add \x command to toggle records display format r=knz a=erikgrinaker

`psql` has a `\x` command to toggle extended output for results. CRDB
already supports this output format via `\set display_format=records`.
This commit adds `\x [on|off]` to toggle between `records` and `table`
display formats.

The `auto` option from `psql` to automatically enable extended output
depending on the result width is not supported, only `on` and `off`.

Resolves #56706.

Release note (cli change): A `\x [on|off]` command has been added to
toggle the `records` display format, following `psql` behavior.

Also adds support for `yes` and `no` as boolean options for slash commands as a separate commit, following `psql`.


56840: util, server: fix memory detection with non-root cgroups r=darinpp a=darinpp

The cgroup information is constructed by looking at `/proc/self/cgroup`,
matching with the mount point in `/proc/self/mountinfo`
and then inpsecting the `memory.stat` file. The matching between the
cgroup and the mount point was working only in case that the mount and
the cgroup are exact match relative to cgroup NS. This is however
inadequate as while true for the docker case, it isn't true in the general
case. In this example determining the cgroup memory limit isn't possible:
```
cgcreate -t $USER:$USER -a $USER:$USER -g memory:crdb_test
echo 3999997952 > /sys/fs/cgroup/memory/crdb_test/memory.limit_in_bytes
cgexec -g memory:crdb_test ./cockroach start-single-nod
```
To address this, this patch instead constructs the expected
relative path of the cgroup's memory info by starting with the
mount path and then adding the cgroup.

Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
Co-authored-by: Darin Peshev <[email protected]>
@craig craig bot closed this as completed in 07ecb7f Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-community Originated from the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant