-- Sets the schema search path to pg_catalog first, so that we do not
 -- need to qualify every system object
 --
-SET SEARCH_PATH TO pg_catalog;
+SET search_path TO pg_catalog;
+
+-- The LIKE pattern language requires underscores to be escaped, so make
+-- sure the backslashes are not misinterpreted.
+SET standard_conforming_strings TO on;
 
 --
 -- lists the names of all database owners and the name of their database(s)
   FROM pg_class c, pg_namespace n
   WHERE c.relnamespace=n.oid
     and c.relkind = 'r'                   -- not indices, views, etc
-    and n.nspname not like 'pg\\_%'       -- not catalogs
+    and n.nspname not like 'pg\_%'       -- not catalogs
     and n.nspname != 'information_schema' -- not information_schema
   ORDER BY nspname, relname;
 
        pg_attribute a, pg_type t
   WHERE n.oid = c.relnamespace
     and c.relkind = 'r'     -- no indices
-    and n.nspname not like 'pg\\_%' -- no catalogs
+    and n.nspname not like 'pg\_%' -- no catalogs
     and n.nspname != 'information_schema' -- no information_schema
     and a.attnum > 0        -- no system att's
     and not a.attisdropped   -- no dropped columns
     and t.typnamespace = n.oid
     and t.typrelid = 0   -- no complex types
     and t.typelem = 0    -- no arrays
-    and n.nspname not like 'pg\\_%' -- no built-in types
+    and n.nspname not like 'pg\_%' -- no built-in types
     and n.nspname != 'information_schema' -- no information_schema
   ORDER BY nspname, rolname, typname;
 
   FROM pg_namespace n, pg_proc p,
        pg_language l, pg_type t
   WHERE p.pronamespace = n.oid
-    and n.nspname not like 'pg\\_%' -- no catalogs
+    and n.nspname not like 'pg\_%' -- no catalogs
     and n.nspname != 'information_schema' -- no information_schema
     and p.prolang = l.oid
     and p.prorettype = t.oid
   ORDER BY nspname, amname, opfname, oprname;
 
 --
--- Reset the search path
+-- Reset the search path and standard_conforming_strings to their defaults
 --
-RESET SEARCH_PATH;
+RESET search_path;
+RESET standard_conforming_strings;