varcharにLIKE
オプションを使用して'
が含まれている場合に検索します。テキストで「 '」を検索するPostgres
私はそれが
select *
from table
where field like '%'%'
が、少し違うようなものだと思います。
varcharにLIKE
オプションを使用して'
が含まれている場合に検索します。テキストで「 '」を検索するPostgres
私はそれが
select *
from table
where field like '%'%'
が、少し違うようなものだと思います。
単一引用符をエスケープについて答える:
ドル引用符記号を使用することができます。
select * from table where field like $thing$%'%$thing$;
または引用符の前にEを使用します。
select * from table where field like e'%\'%'
または2つの単一引用符:
select * from table where field like '%''%'
https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html
最初の2つの解決策は非標準SQLであり、Postgresにのみ適用されることに注意してください。 –
申し訳ありません - 私は他のタグに気付かなかった。私の悪い –
'select * from table where $ thing $% '$ $ thing $'?.. –