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に参加中。完走目指してます。

他のメタコマンドについては以下から読んでください。

\unsetとは

psql変数nameを未設定状態にします(削除します)。

psqlの動作を制御するほとんどの変数は未設定にすることができず、\unsetはそれをデフォルト値に設定するものとして解釈されます。 以下の変数を参照してください。

\unsetについて

試してみた

postgres=# select * from employees where name = :'myvar';
 id | name  | department | salary 
----+-------+------------+--------
  1 | Alice | HR         |  60000
(1 )

postgres=# \unset myvar
postgres=# select * from employees where name = :'myvar';
ERROR:  syntax error at or near ":"
 1: select * from employees where name = :'myvar';

まとめ

\setは頻繁に使うが、\unsetは使ったことない。間違って変数を設定したら使うかも。

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?