I have the following sql command, i need to escape parentheses in PostgreSQL, how can i do that?
SELECT rua
FROM logradouros
WHERE rua ~* 'Antonio De Sant\'Ana Galvao Av Frei (Av 01 Parte A)'
LIMIT 100;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use backslash to escape parentheses. Note that if standard_conforming_strings parameter is set to off (which is default behaviour up to PostgreSQL 9.1) you need use two backslashes
\\.Generally there are three approaches how to escape parentheses:
'pattern'syntax, which is dependent on standard_conforming_strings settingE'pattern'$$pattern$$or$sometext$pattern$sometext$The first one is standard SQL (especially with standard_conforming_strings), others are PostgreSQL extensions. Choose whatever method you like.
Here you have some examples: