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

  • SEARCH
  • Home
  • 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 8652145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:14:28+00:00 2026-06-12T14:14:28+00:00

I am trying to figure out a query with postgres, and Im not sure

  • 0

I am trying to figure out a query with postgres, and Im not sure its cause I am used to mysql and postgres doesn’t have a LIKE query. Or what my deal is. Either way I know its not working and I have no idea why not. Can someone help me out point me in the right direction? I mean ultimately I am trying to make a Zend Database version of this query but, this is the core query I am working with to try and make before I attempt to use zend db class to build it.

SELECT 
    org.orgid, 
    org.roleid, 
    users.userid, 
    users.email, 
    users.first_name, 
    users.last_name, 
    users.contact_id, 
    users.state, 
    users.ts, 
    users.altemail, 
    users.unboundid, 
    users.blocked 
FROM mapping AS org 
INNER JOIN my_users AS users ON org.userid = users.userid
WHERE (org.orgid = 'generated-id')
AND (org.roleid LIKE 'partner-%');



ERROR:  operator does not exist: roles ~~ unknown
LINE 17: AND (org.roleid LIKE 'partner-%');
                          ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
  • 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-06-12T14:14:30+00:00Added an answer on June 12, 2026 at 2:14 pm

    Change

    AND (org.roleid LIKE 'partner-%');
    

    to

    AND (org.roleid::text LIKE 'partner-%');
    

    Evidently you are working on the textual representation of the roleid. this seems like it should work fine except your data types do not match. By casting to text you ensure that they do.

    Note that one important ramification is that indexes on roleid will be useless for such a comparison because they operation is not directly compatible with the type. This shouldn’t be a problem since orgid can still use an index but it is something to think about. If you want to fix that, you may want to use table methods or other functions to break this down for you. You can then index function output.

    For example you could use a table method as like so:

    CREATE FUNCTION is_partner(mapping) returns bool language sql immutable as $$
        SELECT $1.roleid::text LIKE 'partner-%';
    $$;
    

    You could then index it with:

    CREATE INDEX mapping_is_partner_idx ON mapping (is_partner(mapping));
    

    You could then change that join condition from

    AND (org.roleid LIKE 'partner-%');
    

    to

    AND org.is_partner;
    

    Note in this case, org is necessary and cannot be added implicitly since it changes org.is_oartner to is_partner(org) using class.method notation.

    Hope this helps.

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

Sidebar

Related Questions

I'm trying to figure out the best query to accomplish the following. I have
I've been trying to figure out how I can make a query with MySQL
I'm trying to figure out how to write a MySQL query that will return
I'm trying to figure out two things: Can Xpath be used to query a
I have a problem trying to figure out a LINQ query for the following.
I have been going crazy trying to figure out how to query a php
I'm trying to figure out how to work out this query. I have a
I have this query that i've been trying to figure out how to convert
I am trying to figure out a complex (at least for me!) mysql query
I'm trying to figure out why my query isn't working, but it doesn't make

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.