Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:55:07+00:00 2026-05-26T00:55:07+00:00

I am trying to retrieve the contact names based on the keyed search string.

  • 0

I am trying to retrieve the contact names based on the keyed search string. It performs good for the English alphabets and behaves strangely for special chars such as _,/,\,%

My query in the function is similar to

SELECT contact_name FROM contacts WHERE LOWER(contact_name) LIKE LOWER('_McDonald%') ORDER BY LOWER(contact_name) ASC LIMIT 1;

It looks like, during searching, it retrieves all the contact names instead of the desired. The similar bizarre happens for the above mentioned special chars. I need to support these. How do I educate postgres to consider these chars? Please guide me.

Thanks and Regards,
Siva.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:55:08+00:00Added an answer on May 26, 2026 at 12:55 am

    Just to complete the picture:

    You can also use the ESCAPE clause to specify the character for escaping the wildcards. This is useful if you’d like to include e.g. a \ in your search string.

    SELECT contact_name 
    FROM contacts 
    WHERE LOWER(contact_name) LIKE LOWER('@_McDonald%') ESCAPE '@'
    ORDER BY LOWER(contact_name) ASC 
    LIMIT 1;
    

    Btw: I would recommend to turn on the configuration option standard_conforming_strings to avoid confusion (Haes’ answer avoids this problem by using the E' syntax).
    Since 9.1 this is the default mode anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve contact names given the contact phone number. I made
I'm trying to retrieve the contact's name, phone number, and address from the android
I am developing a phonebook app. I am trying to retrieve contact picture. At
I'm trying to retrieve both the display names and the phone numbers of all
I'm trying to write a program that creates an address book with contact names,
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I am trying to retrieve a user on Sharepoint's user photo through the WSS
I'm trying to retrieve a file from a server using SFTP (as opposed to
I'm trying to retrieve an XML stream from a URL. For most URLs my
I am trying to retrieve the attribute name and type that exist in an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.