aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/advanced.source
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-02-28 23:37:10 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-02-28 23:37:10 +0000
commit5b3e78afe3b207e5db91853f03a90f37e0fdb35f (patch)
tree9904735ba334a92da8f276e042cd3be7d1c7b53c /src/tutorial/advanced.source
parentbc58c5867df7d9ab3277e0ae1399d5dabb0308a8 (diff)
downloadpostgresql-5b3e78afe3b207e5db91853f03a90f37e0fdb35f.tar.gz
postgresql-5b3e78afe3b207e5db91853f03a90f37e0fdb35f.zip
From: Darren King <darrenk@insightdist.com>
Seem to remember someone posting to one of the lists a while back that the tutorial code wouldn't compile and/or run. Found four problems with it that will let it run. 1. Tutorial makefile had a recursive use of DLOBJS. 2. Some tutorial needed semi-colons added to many statements. 3. Complex tutorial didn't clean up after itself. 4. Advanced had a time-travel example. Commented it out and put a line pointing the user to contrib/spi/README.
Diffstat (limited to 'src/tutorial/advanced.source')
-rw-r--r--src/tutorial/advanced.source38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/tutorial/advanced.source b/src/tutorial/advanced.source
index 6e4c7f1e9bd..0139a943ab5 100644
--- a/src/tutorial/advanced.source
+++ b/src/tutorial/advanced.source
@@ -7,7 +7,7 @@
--
-- Copyright (c) 1994, Regents of the University of California
--
--- $Id: advanced.source,v 1.1.1.1 1996/07/09 06:22:34 scrappy Exp $
+-- $Id: advanced.source,v 1.2 1998/02/28 23:37:08 scrappy Exp $
--
---------------------------------------------------------------------------
@@ -25,21 +25,21 @@ CREATE TABLE cities (
name text,
population float8,
altitude int -- (in ft)
-)
+);
CREATE TABLE capitals (
state char2
) INHERITS (cities);
-- now, let's populate the tables
-INSERT INTO cities VALUES ('San Francisco', 7.24E+5, 63)
-INSERT INTO cities VALUES ('Las Vegas', 2.583E+5, 2174)
-INSERT INTO cities VALUES ('Mariposa', 1200, 1953)
+INSERT INTO cities VALUES ('San Francisco', 7.24E+5, 63);
+INSERT INTO cities VALUES ('Las Vegas', 2.583E+5, 2174);
+INSERT INTO cities VALUES ('Mariposa', 1200, 1953);
-INSERT INTO capitals VALUES ('Sacramento', 3.694E+5, 30, 'CA')
-INSERT INTO capitals VALUES ('Madison', 1.913E+5, 845, 'WI')
+INSERT INTO capitals VALUES ('Sacramento', 3.694E+5, 30, 'CA');
+INSERT INTO capitals VALUES ('Madison', 1.913E+5, 845, 'WI');
-SELECT * FROM cities
+SELECT * FROM cities;
SELECT * FROM capitals;
-- like before, a regular query references rows of the base table only
@@ -59,25 +59,27 @@ WHERE c.altitude > 500;
-----------------------------
-- Time Travel:
-- this feature allows you to run historical queries.
+-- removed for v6.3, but possible using triggers.
+-- see contrib/spi/README for more information.
-----------------------------
-- first, let's make some changes to the cities table (suppose Mariposa's
-- population grows 10% this year)
-UPDATE cities
-SET population = population * 1.1
-WHERE name = 'Mariposa';
+-- UPDATE cities
+-- SET population = population * 1.1
+-- WHERE name = 'Mariposa';
-- the default time is the current time ('now'):
-SELECT * FROM cities WHERE name = 'Mariposa';
+-- SELECT * FROM cities WHERE name = 'Mariposa';
-- we can also retrieve the population of Mariposa ever has. ('epoch' is the
-- earliest time representable by the system)
-SELECT name, population
-FROM cities['epoch', 'now'] -- can be abbreviated to cities[,]
-WHERE name = 'Mariposa';
+-- SELECT name, population
+-- FROM cities['epoch', 'now'] -- can be abbreviated to cities[,]
+-- WHERE name = 'Mariposa';
----------------------
@@ -96,7 +98,7 @@ CREATE TABLE sal_emp (
INSERT INTO sal_emp VALUES (
'Bill',
'{10000,10000,10000,10000}',
- '{{"meeting", "lunch"}, {}}')
+ '{{"meeting", "lunch"}, {}}');
INSERT INTO sal_emp VALUES (
'Carol',
@@ -120,6 +122,6 @@ SELECT sal_emp.schedule[1:2][1:1] FROM sal_emp WHERE
-- clean up (you must remove the children first)
-DROP TABLE sal_emp
-DROP TABLE capitals
+DROP TABLE sal_emp;
+DROP TABLE capitals;
DROP TABLE cities;