Skip to content

Commit 50b5d4b

Browse files
committed
Add mention of function CREATE INDEX usage.
1 parent 0c9790e commit 50b5d4b

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed

doc/src/sgml/ref/create_index.sgml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.27 2002/03/22 19:20:38 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.28 2002/04/11 23:20:04 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -76,9 +76,10 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
7676
<term><replaceable class="parameter">acc_method</replaceable></term>
7777
<listitem>
7878
<para>
79-
The name of the access method to be used for
80-
the index. The default access method is <literal>BTREE</literal>.
81-
<application>PostgreSQL</application> provides four access methods for indexes:
79+
The name of the access method to be used for the index. The
80+
default access method is <literal>BTREE</literal>.
81+
<application>PostgreSQL</application> provides four access
82+
methods for indexes:
8283

8384
<variablelist>
8485
<varlistentry>
@@ -225,26 +226,27 @@ ERROR: Cannot create index: 'index_name' already exists.
225226
</para>
226227

227228
<para>
228-
In the second syntax shown above, an index is defined
229-
on the result of a user-specified function
230-
<replaceable class="parameter">func_name</replaceable> applied
231-
to one or more columns of a single table.
232-
These <firstterm>functional indexes</firstterm>
233-
can be used to obtain fast access to data
234-
based on operators that would normally require some
235-
transformation to apply them to the base data.
229+
In the second syntax shown above, an index is defined on the result
230+
of a user-specified function <replaceable
231+
class="parameter">func_name</replaceable> applied to one or more
232+
columns of a single table. These <firstterm>functional
233+
indexes</firstterm> can be used to obtain fast access to data based
234+
on operators that would normally require some transformation to apply
235+
them to the base data. For example, a functional index on
236+
<literal>upper(col)</> would allow the clause
237+
<literal>WHERE upper(col) = 'JIM'</> to use an index.
236238
</para>
237239

238240
<para>
239-
<application>PostgreSQL</application> provides B-tree, R-tree, hash, and GiST access methods for
240-
indexes. The B-tree access method is an implementation of
241-
Lehman-Yao high-concurrency B-trees. The R-tree access method
242-
implements standard R-trees using Guttman's quadratic split algorithm.
243-
The hash access method is an implementation of Litwin's linear
244-
hashing. We mention the algorithms used solely to indicate that all
245-
of these access methods are fully dynamic and do not have to be
246-
optimized periodically (as is the case with, for example, static hash
247-
access methods).
241+
<application>PostgreSQL</application> provides B-tree, R-tree, hash,
242+
and GiST access methods for indexes. The B-tree access method is an
243+
implementation of Lehman-Yao high-concurrency B-trees. The R-tree
244+
access method implements standard R-trees using Guttman's quadratic
245+
split algorithm. The hash access method is an implementation of
246+
Litwin's linear hashing. We mention the algorithms used solely to
247+
indicate that all of these access methods are fully dynamic and do
248+
not have to be optimized periodically (as is the case with, for
249+
example, static hash access methods).
248250
</para>
249251

250252
<para>
@@ -338,18 +340,18 @@ ERROR: Cannot create index: 'index_name' already exists.
338340

339341
<para>
340342
An <firstterm>operator class</firstterm> can be specified for each
341-
column of an index. The operator class identifies the operators to
342-
be used by the index for that column. For example, a B-tree index on
343+
column of an index. The operator class identifies the operators to be
344+
used by the index for that column. For example, a B-tree index on
343345
four-byte integers would use the <literal>int4_ops</literal> class;
344346
this operator class includes comparison functions for four-byte
345-
integers. In practice the default operator class for the field's
346-
data type is usually sufficient. The main point of having operator classes
347+
integers. In practice the default operator class for the field's data
348+
type is usually sufficient. The main point of having operator classes
347349
is that for some data types, there could be more than one meaningful
348-
ordering. For example, we might want to sort a complex-number data type
349-
either by absolute value or by real part. We could do this by defining
350-
two operator classes for the data type and then selecting the proper
351-
class when making an index. There are also some operator classes with
352-
special purposes:
350+
ordering. For example, we might want to sort a complex-number data
351+
type either by absolute value or by real part. We could do this by
352+
defining two operator classes for the data type and then selecting
353+
the proper class when making an index. There are also some operator
354+
classes with special purposes:
353355

354356
<itemizedlist>
355357
<listitem>

src/backend/commands/command.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.172 2002/04/02 08:51:50 inoue Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.173 2002/04/11 23:20:04 momjian Exp $
1212
*
1313
* NOTES
1414
* The PerformAddAttribute() code, like most of the relation
@@ -604,10 +604,10 @@ AlterTableAlterColumnDropNotNull(Oid myrelid,
604604
elog(ERROR, "ALTER TABLE: Cannot alter system attribute \"%s\"",
605605
colName);
606606

607-
/*
607+
/*
608608
* Check that the attribute is not in a primary key
609609
*/
610-
610+
611611
/* Loop over all indices on the relation */
612612
indexoidlist = RelationGetIndexList(rel);
613613

@@ -986,9 +986,9 @@ AlterTableAlterColumnFlags(Oid myrelid,
986986
elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table",
987987
RelationGetRelationName(rel));
988988

989-
/*
989+
/*
990990
* we allow statistics case for system tables
991-
*/
991+
*/
992992
if (*flagType != 'S' &&
993993
!allowSystemTableMods
994994
&& IsSystemRelationName(RelationGetRelationName(rel)))
@@ -1911,7 +1911,7 @@ LockTableCommand(LockStmt *lockstmt)
19111911
/*
19121912
* CREATE SCHEMA
19131913
*/
1914-
void
1914+
void
19151915
CreateSchemaCommand(CreateSchemaStmt *stmt)
19161916
{
19171917
const char *schemaName = stmt->schemaname;
@@ -1976,13 +1976,13 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
19761976
Node *parsetree = (Node *) lfirst(parsetree_item);
19771977
List *querytree_list,
19781978
*querytree_item;
1979-
1979+
19801980
querytree_list = parse_analyze(parsetree, NULL);
1981-
1981+
19821982
foreach(querytree_item, querytree_list)
19831983
{
19841984
Query *querytree = (Query *) lfirst(querytree_item);
1985-
1985+
19861986
/* schemas should contain only utility stmts */
19871987
Assert(querytree->commandType == CMD_UTILITY);
19881988
/* do this step */

0 commit comments

Comments
 (0)