# Global matchsubs
-- start_matchsubs
# Ignore Warning messages
m/^WARNING:.*/
s/WARNING/GP_IGNORE: WARNING/

# psql 9 changes now shows username on connection. Ignore the added username.
m/^You are now connected to database/
s/ as user ".+"//

# Ignore path with NOTICE
m/^psql.*NOTICE/
s/^psql.*NOTICE/NOTICE/

# Strip out psql path when we have comments enabled in the output, psql -a
m/^psql.*ERROR/
s/^psql.*ERROR/ERROR/

# Remove code locations eg "(xact.c:1458)" to "(xact.c:xxx)"
m/(ERROR|WARNING|CONTEXT|NOTICE):\s+/
s/\.c\:\d+\)/\.c\:xxx\)/

# Lower case error type
m/(ERROR|WARNING):\s+/
s/\:  Type/\:  type/

# Remove timing information when \timing is set
m/^Time: \d+.*/
s/^Time: \d+.*//

#entry db information eg "localhost:5432 pid=12345"
m/entry db.*pid.*/
s/entry db.*pid.*/entryDbPidInfo/

#For the temp table during exchange partition
m/pg_temp_\d+/
s/pg_temp_\d+/pg_temp/

m/^psql:.* WARNING|INFO|ERROR/
s/^psql:.* (WARNING|INFO|ERROR)/$1/

# Ignore diffs in sql comments
# Does not consider all forms of comments. For eg: block comments, comments at the end of a line
# This will suffice to ignore any metadata added to sql in the form of comments.
m/^--.*/
s/^--.*//

# replace the default hint with a generic log-dir and host
m/Check the PXF logs located in the.*/
s/Check the PXF logs located in the.*/Check the PXF logs located in the 'logs-dir' directory on host 'mdw' or 'set client_min_messages=LOG' for additional details./

# suppress the HINT: line (Greenplum 5 does not render the HINT)
m/HINT:  .*/
s/.*//g

# rename DETAIL (from GP5) to CONTEXT (in GP6+)
m/DETAIL/
s/DETAIL/CONTEXT/

# treat foreign table error messages as if they were from external table
m/Foreign table.*/
s/Foreign table/External table/
m/FOREIGN TABLE.*/
s/FOREIGN TABLE/EXTERNAL TABLE/

# rename record (FDW) to line (exttable)
m/, record \d+ of/
s/, record/, line/

# rename resource (FDW) to file (exttable)
m/, resource/
s/, resource/, file/

# syntax mismatch error is different between exttable with GP6 and fdw with GP7
m/invalid input syntax for type/
s/invalid input syntax for type/invalid input syntax for/

# ignore resource queue notice for GP6
m/NOTICE: resource queue required – using default resource queue.*/
s/.*//g

-- end_matchsubs
