pg_hint_plan icon indicating copy to clipboard operation
pg_hint_plan copied to clipboard

Ignore hints in prepared statements with array arguments

Open WinterUnicorn opened this issue 2 years ago • 4 comments

Case to reproduce: We have an issues with prepared statements that use arrays in arguments. In this case pg_hint_plan don't pass preceding sql check. Is it possible to adds '[', ']' symbols into the white list?

prepare test_query(numeric[]) as /*+ MergeJoin(t1 t2) */ with test as (select 1 as x) select t1.* from test t1, test t2 where t1.x=any($1) and t1.x = t2.x;
explain execute test_query(array[1,2,3]); 
-- MergeJoin hint will be ignore because of numeric[]
deallocate test_query;

WinterUnicorn avatar Apr 11 '22 07:04 WinterUnicorn

Dear @horiguti can you review the issue please Questions are welcome

WinterUnicorn avatar May 19 '22 02:05 WinterUnicorn

@Anisimov-ds @rattrayalex @Fzhlib I see that you have committed in this repository. Do you know what contributor can I contact for a discussion or review?

WinterUnicorn avatar May 31 '22 09:05 WinterUnicorn

As you can see from my PR, it was many months before it was reviewed and merged. This is not unheard of in open source.

The person who merged it was @horiguti but I would advise patience 🙂

rattrayalex avatar May 31 '22 13:05 rattrayalex

Related pull request: https://github.com/ossc-db/pg_hint_plan/pull/98

WinterUnicorn avatar Jun 20 '22 05:06 WinterUnicorn

Sorry for the time it took to reply back. I am going to review what you have here. It does not look like a bad idea in itself, still I am wondering about one thing. Shouldn't we treat this as a new feature? From what I can see, this may imply a behavior change for existing users, which may not be wise to backpatch into existing releases.

@rjuju, @MasahikoSawada, @horiguti, please feel free to share your thoughts or just contradict me.

michaelpq avatar Dec 12 '22 05:12 michaelpq

Backpatching it seems a bit scary to me. So +1 to treat this as a new feature.

MasahikoSawada avatar Dec 12 '22 06:12 MasahikoSawada