Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b94cfb

Browse files
committed
Modernize string literal syntax in tutorial example.
Un-double the backslashes in the LIKE patterns, sincestandard_conforming_strings is now the default. Just to be sure, includea 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
1 parent9f10f7d commit4b94cfb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/tutorial/syscat.source

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
-- Sets the schema search path to pg_catalog first, so that we do not
1616
-- need to qualify every system object
1717
--
18-
SET SEARCH_PATH TO pg_catalog;
18+
SET search_path TO pg_catalog;
19+
20+
-- The LIKE pattern language requires underscores to be escaped, so make
21+
-- sure the backslashes are not misinterpreted.
22+
SET standard_conforming_strings TO on;
1923

2024
--
2125
-- lists the names of all database owners and the name of their database(s)
@@ -32,7 +36,7 @@ SELECT n.nspname, c.relname
3236
FROM pg_class c, pg_namespace n
3337
WHERE c.relnamespace=n.oid
3438
and c.relkind = 'r' -- not indices, views, etc
35-
and n.nspname not like 'pg\\_%' -- not catalogs
39+
and n.nspname not like 'pg\_%' -- not catalogs
3640
and n.nspname != 'information_schema' -- not information_schema
3741
ORDER BY nspname, relname;
3842

@@ -68,7 +72,7 @@ SELECT n.nspname, c.relname, a.attname, format_type(t.oid, null) as typname
6872
pg_attribute a, pg_type t
6973
WHERE n.oid = c.relnamespace
7074
and c.relkind = 'r' -- no indices
71-
and n.nspname not like 'pg\\_%' -- no catalogs
75+
and n.nspname not like 'pg\_%' -- no catalogs
7276
and n.nspname != 'information_schema' -- no information_schema
7377
and a.attnum > 0 -- no system att's
7478
and not a.attisdropped -- no dropped columns
@@ -86,7 +90,7 @@ SELECT n.nspname, r.rolname, format_type(t.oid, null) as typname
8690
and t.typnamespace = n.oid
8791
and t.typrelid = 0 -- no complex types
8892
and t.typelem = 0 -- no arrays
89-
and n.nspname not like 'pg\\_%' -- no built-in types
93+
and n.nspname not like 'pg\_%' -- no built-in types
9094
and n.nspname != 'information_schema' -- no information_schema
9195
ORDER BY nspname, rolname, typname;
9296

@@ -145,7 +149,7 @@ SELECT n.nspname, p.proname, p.pronargs, format_type(t.oid, null) as return_type
145149
FROM pg_namespace n, pg_proc p,
146150
pg_language l, pg_type t
147151
WHERE p.pronamespace = n.oid
148-
and n.nspname not like 'pg\\_%' -- no catalogs
152+
and n.nspname not like 'pg\_%' -- no catalogs
149153
and n.nspname != 'information_schema' -- no information_schema
150154
and p.prolang = l.oid
151155
and p.prorettype = t.oid
@@ -179,6 +183,7 @@ SELECT am.amname, n.nspname, opf.opfname, opr.oprname
179183
ORDER BY nspname, amname, opfname, oprname;
180184

181185
--
182-
-- Reset the search path
186+
-- Reset the search path and standard_conforming_strings to their defaults
183187
--
184-
RESET SEARCH_PATH;
188+
RESET search_path;
189+
RESET standard_conforming_strings;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp