Fix explain plan and show tables for usage in psql scripts