0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

初めに

Qiita Engineer Festa 2024に参加中。完走目指してます。
他のメタコマンドについては以下から読んでください。

\aとは

現在のテーブルの出力形式が「揃えない」になっていれば「揃える」に、 「揃える」になっていれば「揃えない」に設定します。 このコマンドは後方互換性を保持するためにあります。 より一般的な解決策は\psetを参照してください。

\aについて

試してみた

usersテーブルの出力結果を見比べてみた。

main=# select * from users;
 id |  name   | age 
----+---------+-----
  1 | Alice   |  30
  2 | Bob     |  25
  3 | Charlie |  35
  4 | Diana   |  30
(4 rows)

main=# \a
Output format is unaligned.

main=# select * from users;
id|name|age
1|Alice|30
2|Bob|25
3|Charlie|35
4|Diana|30
(4 rows)
main=# \a
Output format is aligned.

main=# select * from users;
 id |  name   | age 
----+---------+-----
  1 | Alice   |  30
  2 | Bob     |  25
  3 | Charlie |  35
  4 | Diana   |  30
(4 rows)

まとめ

アンアラインドモードはエクスポートして他のツールなどで利用する際に便利とのことだが、その時はCSVにしちゃうよな〜と思ったり。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?