Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
POSTGRES 🐘- combine LIKE with exception(E') literal

I'm trying to match a certain text that includes a single quote (i.e. 'company's report...') normally I would have used the E' literal + ' or double single quotes. but when it gets to using the LIKE '%' operator, things got complicated. what is the best approach to match a text with a single quote?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can use Dollar-quoted String Constants at Lexical Structure

Your condition should be something like below;

select * from atable
where afield like $$Dianne's %$$
over 4 years ago · Santiago Trujillo Relatório

0

You can escape single quote with another single quote. Example:

WHERE column LIKE 'RSNboim''s'

From https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS

To include a single-quote character within a string constant, write two adjacent single quotes, e.g., 'Dianne''s horse'. Note that this is not the same as a double-quote character (").

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda