Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
LimitFounder
New Member

Redshift DirectQuery locate() error

I'm trying to connect to AWS Redshift, with built-in connector, in DirectQuery mode.

I'm using a custom SQL code (simple SELECT * FROM ... ) due to performance reasons.

 

Everything is working fine, until I would like to use a filter like this:

LimitFounder_0-1784035167465.png

 

PowerBI ends up with the following error message:
Underlying Error: QueryUserError
More details: OLE DB or ODBC error: [DataSource.Error] ODBC: ERROR [42883] [Redshift][ODBC Driver][Server]42883:ERROR: function locate("unknown", character varying) does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.

 

Any ideas how to solve this?

Thank you in advance!

 

5 REPLIES 5
v-kathullac
Community Support
Community Support

Hi @LimitFounder   ,

 

Thank you for reaching out to Microsoft Fabric Community Forum,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?


Regards,

Chaithanya

v-kathullac
Community Support
Community Support

Hi @LimitFounder ,

Thank you for sharing your findings and the workaround. We're glad to hear that creating the following user-defined function on the Amazon Redshift side resolved the issue:

CREATE OR REPLACE FUNCTION public.locate(varchar, varchar)
RETURNS integer
IMMUTABLE
AS $$ SELECT POSITION($1 IN $2) $$
LANGUAGE sql;

Regarding your question, this is not a documented or officially recommended Microsoft solution. Rather, it is a valid workaround that resolves the issue in your Redshift environment by providing compatibility for the LOCATE() function referenced in the generated query.

If the workaround meets your requirements, it is reasonable to continue using it. Otherwise, we recommend monitoring future Power BI Desktop and Amazon Redshift ODBC driver updates for any changes related to SQL translation or compatibility.

Thank you for sharing your solution it may also benefit other users who encounter similar behavior.

 

Thanks,

Chaithanya.

Thanks for reaching out Chaithanya!

Even if this UDF is working now, I don't think that PowerBI should work like this. It is sending a MySQL function to Redshift, which should not be the case.

I've filed a ticket for MS with this, and will update this thread once I received an answer.

Hi @LimitFounder  , 

Thank you for the update.

We're glad to know your case is now with the appropriate support team. We hope the issue will be  resolved soon.

If you need any further assistance from our side or have any additional questions, please feel free to reach out. We'll be happy to assist you.

 

Thanks,

Chaithanya.

 

LimitFounder
New Member

Solved with a user defined function on Redshift side:

CREATE OR REPLACE FUNCTION public.locate(varchar, varchar)
RETURNS integer
IMMUTABLE
AS $$ SELECT POSITION($1 IN $2) $$
LANGUAGE sql;

But I'm still wondering if this was the offical way to solve this... ?!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors