LoginSignup
8
1

More than 3 years have passed since last update.

[PostgreSQL] column "" does not exist の解決法

Posted at

概要

postgresqlの操作にはpgadminを使用しているのだが以下のqueryを実行したところErrorが発生した。

select * from users
where email like "%@%";
error
ERROR:  column "%@%" does not exist
LINE 2: where email like "%@%";
                         ^
SQL state: 42703
Character: 38

カラムの条件で"%@%"を指定しているのになんでってなった。

結論

どうやら " は列名を指定するときに使うらしい。
レコードを選択するときは列名と混同しないように ' を使わなければいけなかったのだ。
以下のクエリに変更したところ無事に動かすことができた。
めでたしめでたし。

select * from users
where email like '%@%';

参考文献

PostgreSQL - WHERE clause not working - Column name not found [duplicate]

8
1
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
8
1