'Strange query by oracle_fdw

I am using oracle_fdw 2.2.0devel, PostgreSQL 10.13, Oracle client 18.3.0.0.0

We have a foreign table in Postgres defined as this:

CREATE FOREIGN TABLE public.tickers
(
   ticker_id         INTEGER,
   ticker            VARCHAR,
)
SERVER oracle
OPTIONS (table 'TICKERS', schema 'COMMENTARY', readonly 'true');

This is connecting to as 12c SE database. This works fine, however, I've noticed that the query in Oracle is actually looking like this:

SELECT  
   /*618157932326e692807010156f98ddac*/  
   r2."TICKER_ID",  
   r2."TICKER"  
FROM "COMMENTARY"."TICKERS" r2  
WHERE (upper(r2."TICKER") = upper(:p1))

Why would it automatically be adding the "UPPER" clause? This slows the Oracle query and does not use an index, unless I create a FBI using "upper".

Was wondering if there was some option I'm supposed to disable.......



Solution 1:[1]

The only way that oracle_fdw will generate an Oracle query that uses the upper function is if the original PostgreSQL query already had upper in it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Laurenz Albe