aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-01-19 17:20:32 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-01-19 17:20:56 -0500
commit30a4853cfdc6e1acf93509b543d410bac98535ac (patch)
treed7f3bfbdd98a00e93a2f30f405b9f78803d5768d
parente994d83d5b378f6603fccf452c0888a149837c33 (diff)
downloadpostgresql-30a4853cfdc6e1acf93509b543d410bac98535ac.tar.gz
postgresql-30a4853cfdc6e1acf93509b543d410bac98535ac.zip
Modernize string literal syntax in tutorial example.
Un-double the backslashes in the LIKE patterns, since standard_conforming_strings is now the default. Just to be sure, include a command to set standard_conforming_strings to ON in the example. Back-patch to 9.1, where standard_conforming_strings became the default. Josh Kupershmidt, reviewed by Jeff Janes
-rw-r--r--src/tutorial/syscat.source19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tutorial/syscat.source b/src/tutorial/syscat.source
index 15d58f38cb3..f338b8b1c8b 100644
--- a/src/tutorial/syscat.source
+++ b/src/tutorial/syscat.source
@@ -15,7 +15,11 @@
-- 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)
@@ -32,7 +36,7 @@ SELECT n.nspname, c.relname
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;
@@ -68,7 +72,7 @@ SELECT n.nspname, c.relname, a.attname, format_type(t.oid, null) as typname
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
@@ -86,7 +90,7 @@ SELECT n.nspname, r.rolname, format_type(t.oid, null) as typname
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;
@@ -145,7 +149,7 @@ SELECT n.nspname, p.proname, p.pronargs, format_type(t.oid, null) as return_type
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
@@ -179,6 +183,7 @@ SELECT am.amname, n.nspname, opf.opfname, opr.oprname
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;