ossc-db / pg_hint_plan

Extension adding support for optimizer hints in PostgreSQL
Other
674 stars 101 forks source link

Maskout script doesn't work on macOS #181

Open Sanath97 opened 3 months ago

Sanath97 commented 3 months ago

Maskout script used for tests maskout.sh doesn't seems to work on MAC machines. Particularly, issue is with sed command and script fails to mask cost/width values in the query plan. Instead we found below sed seems to work with both macOS and Linux machine(tested on Ubuntu).

sed -E 's/cost=10{7}[\.0-9]+ /cost={inf}..{inf} /;s/cost=[\.0-9]+ /cost=xxx..xxx /;s/width=[0-9]+([^0-9])/width=xxx\1/;s/^ *QUERY PLAN *$/ QUERY PLAN/;s/^--*$/----------------/'

michaelpq commented 2 days ago

Yes, I want to replace the dependency to these two maskout shell scripts to a SQL function able to filter out the output of EXPLAIN, as we do in PostgreSQL for the main regression test suite. I'll see about doing this cleanup in the next few days for the upcoming release.

michaelpq commented 2 days ago

What I am referring here is to have an equivalent of explain_filter() in src/test/regress/sql/explain.sql, just that we'd define it in the init script here.