summaryrefslogtreecommitdiff
path: root/src/tutorial
diff options
context:
space:
mode:
authorPavan Deolasee2015-05-05 09:19:18 +0000
committerPavan Deolasee2015-05-05 09:19:18 +0000
commit73fa25c67cbfa24c03e28c96bf356f2592671730 (patch)
tree10ded7e26abd78d93658cb72fc5cb9d4672eff2a /src/tutorial
parentda4d108859bcd7a308ca75aba54281e32968822c (diff)
parent4a9ab6d8619817f9e3989c99b65140e19041dab7 (diff)
Merge branch 'XL_MASTER_MERGE_9_4' into XL_NEW_MASTER
Conflicts: src/test/regress/expected/aggregates.out src/test/regress/expected/create_index.out src/test/regress/expected/inherit.out src/test/regress/expected/join.out src/test/regress/expected/window.out src/test/regress/expected/with.out
Diffstat (limited to 'src/tutorial')
-rw-r--r--src/tutorial/Makefile2
-rw-r--r--src/tutorial/README2
-rw-r--r--src/tutorial/complex.c5
-rw-r--r--src/tutorial/complex.source2
-rw-r--r--src/tutorial/syscat.source21
5 files changed, 18 insertions, 14 deletions
diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile
index b180da5103..16dc390f71 100644
--- a/src/tutorial/Makefile
+++ b/src/tutorial/Makefile
@@ -5,7 +5,7 @@
#
# By default, this builds against an existing PostgreSQL installation
# (the one identified by whichever pg_config is first in your path).
-# Within a configured source tree, you can say "gmake NO_PGXS=1 all"
+# Within a configured source tree, you can say "make NO_PGXS=1 all"
# to build using the surrounding source tree.
#
# IDENTIFICATION
diff --git a/src/tutorial/README b/src/tutorial/README
index ce9d733c70..b137cdfad3 100644
--- a/src/tutorial/README
+++ b/src/tutorial/README
@@ -7,7 +7,7 @@ This directory contains SQL tutorial scripts. To look at them, first do a
% make
to compile all the scripts and C files for the user-defined functions
and types. (make needs to be GNU make --- it may be named something
-different on your system, often gmake)
+different on your system, often 'gmake')
Then, run psql with the -s (single-step) flag:
% psql -s
diff --git a/src/tutorial/complex.c b/src/tutorial/complex.c
index edae0065c7..922784004e 100644
--- a/src/tutorial/complex.c
+++ b/src/tutorial/complex.c
@@ -73,8 +73,7 @@ complex_out(PG_FUNCTION_ARGS)
Complex *complex = (Complex *) PG_GETARG_POINTER(0);
char *result;
- result = (char *) palloc(100);
- snprintf(result, 100, "(%g,%g)", complex->x, complex->y);
+ result = psprintf("(%g,%g)", complex->x, complex->y);
PG_RETURN_CSTRING(result);
}
@@ -140,7 +139,7 @@ complex_add(PG_FUNCTION_ARGS)
* It's essential that the comparison operators and support function for a
* B-tree index opclass always agree on the relative ordering of any two
* data values. Experience has shown that it's depressingly easy to write
- * unintentionally inconsistent functions. One way to reduce the odds of
+ * unintentionally inconsistent functions. One way to reduce the odds of
* making a mistake is to make all the functions simple wrappers around
* an internal three-way-comparison function, as we do here.
*****************************************************************************/
diff --git a/src/tutorial/complex.source b/src/tutorial/complex.source
index bbb8c1104a..4328ada822 100644
--- a/src/tutorial/complex.source
+++ b/src/tutorial/complex.source
@@ -5,7 +5,7 @@
-- use this new type.
--
--
--- Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+-- Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
-- Portions Copyright (c) 1994, Regents of the University of California
--
-- src/tutorial/complex.source
diff --git a/src/tutorial/syscat.source b/src/tutorial/syscat.source
index 15d58f38cb..232b7efa5d 100644
--- a/src/tutorial/syscat.source
+++ b/src/tutorial/syscat.source
@@ -4,7 +4,7 @@
-- sample queries to the system catalogs
--
--
--- Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+-- Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
-- Portions Copyright (c) 1994, Regents of the University of California
--
-- 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;