22--
33-- complex.sql-
44-- This file shows how to create a new user-defined type and how to
5- -- usethem .
5+ -- usethis new type .
66--
77--
88-- Copyright (c) 1994, Regents of the University of California
99--
10- -- $Id: complex.source,v 1.1.1.1 1996/07/09 06 :22:34 scrappy Exp $
10+ -- $Id: complex.source,v 1.2 1996/12/28 02 :22:07 momjian Exp $
1111--
1212---------------------------------------------------------------------------
1313
@@ -105,7 +105,7 @@ SELECT a + '(1.0,1.0)'::complex AS aa,
105105
106106-----------------------------
107107-- Creating aggregate functions
108- --you can also define aggregate functions. The syntax issome what
108+ --you can also define aggregate functions. The syntax issomewhat
109109--cryptic but the idea is to express the aggregate in terms of state
110110--transition functions.
111111-----------------------------
@@ -122,8 +122,8 @@ SELECT complex_sum(a) FROM test_complex;
122122
123123-------------------------------------------------------------------------------
124124-- ATTENTION! ATTENTION! ATTENTION! --
125- -- YOU MAY SKIP THE SECTION BELOW ON INTERFACING WITHINDICIES . YOU DON'T --
126- -- NEED THE FOLLOWING IF YOU DON'T USEINDICIES WITH NEW DATA TYPES. --
125+ -- YOU MAY SKIP THE SECTION BELOW ON INTERFACING WITHINDICES . YOU DON'T --
126+ -- NEED THE FOLLOWING IF YOU DON'T USEINDICES WITH NEW DATA TYPES. --
127127-------------------------------------------------------------------------------
128128
129129SELECT 'READ ABOVE!' AS STOP;
@@ -239,7 +239,8 @@ INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
239239 and proname = 'complex_abs_cmp';
240240
241241-- now, we can define a btree index on complex types. First, let's populate
242- -- the table (THIS DOESN'T ACTUALLY WORK. YOU NEED MANY MORE TUPLES.)
242+ -- the table. Note that postgres needs many more tuples to start using the
243+ -- btree index during selects.
243244INSERT INTO test_complex VALUES ('(56.0,-22.5)', '(-43.2,-0.07)')
244245INSERT INTO test_complex VALUES ('(-91.9,33.6)', '(8.6,3.0)');
245246
@@ -248,4 +249,4 @@ CREATE INDEX test_cplx_ind ON test_complex
248249
249250SELECT * from test_complex where a = '(56.0,-22.5)';
250251SELECT * from test_complex where a < '(56.0,-22.5)';
251- SELECT * from test_complex where a > '(56.0,-22.5)';
252+ SELECT * from test_complex where a > '(56.0,-22.5)';