From 027f144e390afa6f189270e8c2a2a56c0a88f646 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 13 Jan 2001 23:58:55 +0000 Subject: [PATCH] Terminology cleanup: class -> table, instance -> row, attribute -> column, etc. --- doc/src/sgml/admin.sgml | 4 +- doc/src/sgml/advanced.sgml | 49 ++++--- doc/src/sgml/array.sgml | 8 +- doc/src/sgml/extend.sgml | 34 ++--- doc/src/sgml/indices.sgml | 2 +- doc/src/sgml/inherit.sgml | 20 +-- doc/src/sgml/intro.sgml | 4 +- doc/src/sgml/libpq++.sgml | 4 +- doc/src/sgml/libpq.sgml | 10 +- doc/src/sgml/page.sgml | 12 +- doc/src/sgml/plsql.sgml | 16 +-- doc/src/sgml/programmer.sgml | 4 +- doc/src/sgml/query.sgml | 195 +++++++++++++------------- doc/src/sgml/ref/alter_table.sgml | 4 +- doc/src/sgml/ref/cluster.sgml | 12 +- doc/src/sgml/ref/copy.sgml | 8 +- doc/src/sgml/ref/create_index.sgml | 4 +- doc/src/sgml/ref/create_operator.sgml | 4 +- doc/src/sgml/ref/create_rule.sgml | 4 +- doc/src/sgml/ref/create_type.sgml | 6 +- doc/src/sgml/ref/create_view.sgml | 6 +- doc/src/sgml/ref/createuser.sgml | 4 +- doc/src/sgml/ref/delete.sgml | 4 +- doc/src/sgml/ref/drop_type.sgml | 4 +- doc/src/sgml/ref/dropuser.sgml | 4 +- doc/src/sgml/ref/insert.sgml | 4 +- doc/src/sgml/ref/select.sgml | 10 +- doc/src/sgml/ref/select_into.sgml | 4 +- doc/src/sgml/ref/unlisten.sgml | 11 +- doc/src/sgml/ref/update.sgml | 4 +- doc/src/sgml/ref/vacuum.sgml | 8 +- doc/src/sgml/syntax.sgml | 64 ++++----- doc/src/sgml/tutorial.sgml | 4 +- doc/src/sgml/user.sgml | 4 +- doc/src/sgml/xaggr.sgml | 6 +- doc/src/sgml/xfunc.sgml | 28 ++-- doc/src/sgml/xindex.sgml | 48 +++---- doc/src/sgml/xtypes.sgml | 2 +- 38 files changed, 300 insertions(+), 323 deletions(-) diff --git a/doc/src/sgml/admin.sgml b/doc/src/sgml/admin.sgml index 304580eb81..f2ec6ea620 100644 --- a/doc/src/sgml/admin.sgml +++ b/doc/src/sgml/admin.sgml @@ -1,5 +1,5 @@ @@ -35,7 +35,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.28 2000/11/24 17:44:21 developed originally in the UC Berkeley Computer Science Department, pioneered many of the object-relational concepts now becoming available in some commercial databases. - It provides SQL92/SQL3 language support, + It provides SQL92/SQL99 language support, transaction integrity, and type extensibility. PostgreSQL is an open-source descendant of this original Berkeley code. diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml index dcfe90eec3..dc3731b989 100644 --- a/doc/src/sgml/advanced.sgml +++ b/doc/src/sgml/advanced.sgml @@ -1,5 +1,5 @@ @@ -22,14 +22,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.20 2001/01/05 06:34:15 tg Inheritance - Let's create two classes. The capitals class contains + Let's create two tables. The capitals table contains state capitals that are also cities. Naturally, the - capitals class should inherit from cities. + capitals table should inherit from cities. CREATE TABLE cities ( name text, - population float, + population real, altitude int -- (in ft) ); @@ -38,20 +38,19 @@ CREATE TABLE capitals ( ) INHERITS (cities); - In this case, an instance of capitals inherits all - attributes (name, population, and altitude) from its - parent, cities. The type of the attribute name is + In this case, a row of capitals inherits all + columns (name, population, and altitude) from its + parent, cities. The type of the column name is text, a native Postgres type for variable length - ASCII strings. The type of the attribute population is - float, a native Postgres - type for double precision + ASCII strings. The type of the column population is + real, a type for single precision floating point numbers. State capitals have an extra - attribute, state, that shows their state. + column, state, that shows their state. In Postgres, - a class can inherit from zero or more other classes, - and a query can reference either all instances of a - class or all instances of a class plus all of its + a table can inherit from zero or more other tables, + and a query can reference either all rows of a + table or all rows of a tables plus all of its descendants. @@ -109,7 +108,7 @@ SELECT name, altitude Here the ONLY before cities indicates that the query should - be run over only the cities table, and not classes below cities in the + be run over only the cities table, and not tables below cities in the inheritance hierarchy. Many of the commands that we have already discussed -- SELECT, UPDATE and DELETE -- @@ -122,7 +121,7 @@ SELECT name, altitude In previous versions of Postgres, the default was not to get access to child tables. This was found to be error prone and is also in violation of SQL99. Under the old - syntax, to get the sub-classes you append "*" to the table name. + syntax, to get the sub-tables you append "*" to the table name. For example SELECT * from cities*; @@ -147,11 +146,11 @@ SET SQL_Inheritance TO OFF; One of the tenets of the relational model is that the - attributes of a relation are atomic. + columns of a table are atomic. Postgres does not - have this restriction; attributes can themselves contain + have this restriction; columns can themselves contain sub-values that can be accessed from the query - language. For example, you can create attributes that + language. For example, you can create columns that are arrays of base types. @@ -159,26 +158,26 @@ SET SQL_Inheritance TO OFF; Arrays - Postgres allows attributes of an - instance to be defined + Postgres allows columns of a + row to be defined as fixed-length or variable-length multi-dimensional arrays. Arrays of any base type or user-defined type can be created. To illustrate their use, we first create a - class with arrays of base types. + table with arrays of base types. CREATE TABLE SAL_EMP ( name text, - pay_by_quarter int4[], + pay_by_quarter integer[], schedule text[][] ); - The above query will create a class named SAL_EMP with + The above query will create a table named SAL_EMP with a text string (name), a one-dimensional - array of int4 + array of integer (pay_by_quarter), which represents the employee's salary by quarter and a two-dimensional array of text diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml index 427a3956cd..0de9bd97fb 100644 --- a/doc/src/sgml/array.sgml +++ b/doc/src/sgml/array.sgml @@ -1,5 +1,5 @@ @@ -14,10 +14,10 @@ This must become a chapter on array behavior. Volunteers? - thomas 1998-01-12 - Postgres allows attributes of a class + Postgres allows columns of a table to be defined as variable-length multi-dimensional arrays. Arrays of any built-in type or user-defined type - can be created. To illustrate their use, we create this class: + can be created. To illustrate their use, we create this table: CREATE TABLE sal_emp ( @@ -29,7 +29,7 @@ CREATE TABLE sal_emp ( - The above query will create a class named sal_emp with + The above query will create a table named sal_emp with a text string (name), a one-dimensional array of int4 (pay_by_quarter), which represents the employee's salary by quarter, and a two-dimensional array of text diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index 9044aab613..4c27897f4e 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -1,5 +1,5 @@ @@ -44,15 +44,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter about databases, tables, columns, etc., in what are commonly known as system catalogs. (Some systems call this the data dictionary). The catalogs appear to the - user as classes, like any other, but the DBMS stores + user as tables like any other, but the DBMS stores its internal bookkeeping in them. One key difference between Postgres and standard relational systems is that Postgres stores much more information in its catalogs -- not only information about tables and columns, but also information about its types, functions, access - methods, and so on. These classes can be modified by + methods, and so on. These tables can be modified by the user, and since Postgres bases its internal operation - on these classes, this means that Postgres can be + on these tables, this means that Postgres can be extended by users. By comparison, conventional database systems can only be extended by changing hardcoded procedures within the DBMS or by loading modules @@ -87,13 +87,13 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter by the user and only understands the behavior of such types to the extent that the user describes them. Composite types are created whenever the user creates a - class. EMP is an example of a composite type. + table. EMP is an example of a composite type. Postgres stores these types in only one way (within the - file that stores all instances of the class) but the + file that stores all rows of a table) but the user can "look inside" at the attributes of these types from the query language and optimize their retrieval by (for example) defining indices on the attributes. @@ -119,7 +119,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter reference. All system catalogs have names that begin with pg_. - The following classes contain information that may be + The following tables contain information that may be useful to the end user. (There are many other system catalogs, but there should rarely be a reason to query them directly.) @@ -141,11 +141,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter pg_class - classes + tables pg_attribute - class attributes + table columns pg_index @@ -195,10 +195,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter The Reference Manual gives a more detailed explanation - of these catalogs and their attributes. However, + of these catalogs and their columns. However, shows the major entities and their relationships - in the system catalogs. (Attributes that do not refer + in the system catalogs. (Columns that do not refer to other entities are not shown unless they are part of a primary key.) This diagram is more or less incomprehensible until you @@ -216,13 +216,13 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter some of these join queries (which are often three- or four-way joins) more understandable, because you will be able to see that the - attributes used in the queries form foreign keys - in other classes. + columns used in the queries form foreign keys + in other tables. - Many different features (classes, attributes, + Many different features (tables, columns, functions, types, access methods, etc.) are tightly integrated in this schema. A simple create command may modify many of these catalogs. @@ -241,15 +241,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.8 2000/12/26 00:10:37 peter Nearly every catalog contains some reference to - instances in one or both of these classes. For + rows in one or both of these tables. For example, Postgres frequently uses type signatures (e.g., of functions and operators) to - identify unique instances of other catalogs. + identify unique rows of other catalogs. - There are many attributes and relationships that + There are many columns and relationships that have obvious meanings, but there are many (particularly those that have to do with access methods) that do not. The relationships between diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml index 9623ec05c1..ca472da29c 100644 --- a/doc/src/sgml/indices.sgml +++ b/doc/src/sgml/indices.sgml @@ -35,7 +35,7 @@ For a functional index, an index is defined on the result of a function applied - to one or more attributes of a single class. + to one or more columns of a single table. This is a single-column index (namely, the function result) even if the function uses more than one input field. Functional indices can be used to obtain fast access to data diff --git a/doc/src/sgml/inherit.sgml b/doc/src/sgml/inherit.sgml index 37cd94c586..562a5dfccc 100644 --- a/doc/src/sgml/inherit.sgml +++ b/doc/src/sgml/inherit.sgml @@ -1,14 +1,14 @@ Inheritance - Let's create two classes. The capitals class contains + Let's create two tables. The capitals table contains state capitals which are also cities. Naturally, the - capitals class should inherit from cities. + capitals table should inherit from cities. CREATE TABLE cities ( @@ -22,7 +22,7 @@ CREATE TABLE capitals ( ) INHERITS (cities); - In this case, an instance of capitals inherits all + In this case, a row of capitals inherits all attributes (name, population, and altitude) from its parent, cities. The type of the attribute name is text, a native Postgres type for variable length @@ -30,9 +30,9 @@ CREATE TABLE capitals ( float, a native Postgres type for double precision floating point numbers. State capitals have an extra attribute, state, that shows their state. In Postgres, - a class can inherit from zero or more other classes, - and a query can reference either all instances of a - class or all instances of a class plus all of its + a table can inherit from zero or more other tables, + and a query can reference either all rows of a + table or all rows of a table plus all of its descendants. @@ -90,7 +90,7 @@ SELECT name, altitude Here the ONLY before cities indicates that the query should - be run over only cities and not classes below cities in the + be run over only cities and not tables below cities in the inheritance hierarchy. Many of the commands that we have already discussed -- SELECT, UPDATE and DELETE -- @@ -99,7 +99,7 @@ SELECT name, altitude In some cases you may wish to know which table a particular tuple - originated from. There is a system attribute called + originated from. There is a system column called TABLEOID in each table which can tell you the originating table: @@ -153,7 +153,7 @@ SELECT name, altitude In previous versions of Postgres, the default was not to get access to child tables. This was found to be error prone and is also in violation of SQL99. Under the old - syntax, to get the sub-classes you append "*" to the table name. + syntax, to get the sub-tables you append "*" to the table name. For example SELECT * from cities*; diff --git a/doc/src/sgml/intro.sgml b/doc/src/sgml/intro.sgml index cddd648f29..bdc1e935a0 100644 --- a/doc/src/sgml/intro.sgml +++ b/doc/src/sgml/intro.sgml @@ -1,5 +1,5 @@ @@ -44,7 +44,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/intro.sgml,v 1.12 2000/09/29 20:21:34 peter extend the system: - classes + tables inheritance types functions diff --git a/doc/src/sgml/libpq++.sgml b/doc/src/sgml/libpq++.sgml index 97ef1ba856..c1ae073465 100644 --- a/doc/src/sgml/libpq++.sgml +++ b/doc/src/sgml/libpq++.sgml @@ -1,5 +1,5 @@ @@ -353,7 +353,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.22 2000/12/26 00:10: Tuples - Returns the number of tuples (instances) in the query result. + Returns the number of tuples (rows) in the query result. int PgDatabase::Tuples() diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 93abf2d3e9..faf40a8e13 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -810,7 +810,7 @@ when you want to know the status from the latest operation on the connection. PQntuples - Returns the number of tuples (instances) + Returns the number of tuples (rows) in the query result. int PQntuples(const PGresult *res); @@ -2042,7 +2042,7 @@ main() PQclear(res); /* - * fetch instances from the pg_database, the system catalog of + * fetch rows from the pg_database, the system catalog of * databases */ res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from pg_database"); @@ -2067,7 +2067,7 @@ main() printf("%-15s", PQfname(res, i)); printf("\n\n"); - /* next, print out the instances */ + /* next, print out the rows */ for (i = 0; i < PQntuples(res); i++) { for (j = 0; j < nFields; j++) @@ -2315,7 +2315,7 @@ main() PQclear(res); /* - * fetch instances from the pg_database, the system catalog of + * fetch rows from the pg_database, the system catalog of * databases */ res = PQexec(conn, "DECLARE mycursor BINARY CURSOR FOR select * from test1"); diff --git a/doc/src/sgml/page.sgml b/doc/src/sgml/page.sgml index 2bf48e899e..761386c799 100644 --- a/doc/src/sgml/page.sgml +++ b/doc/src/sgml/page.sgml @@ -10,7 +10,7 @@ A description of the database file default page format. This section provides an overview of the page format used by Postgres -classes. User-defined access methods need not use this page format. +tables. User-defined access methods need not use this page format. @@ -18,13 +18,13 @@ In the following explanation, a byte is assumed to contain 8 bits. In addition, the term item -refers to data that is stored in Postgres classes. +refers to data that is stored in Postgres tables. -The following table shows how pages in both normal Postgres classes - and Postgres index -classes (e.g., a B-tree index) are structured. +The following table shows how pages in both normal Postgres tables + and Postgres indices +(e.g., a B-tree index) are structured. Sample Page Layout @@ -141,7 +141,7 @@ access method. The last 2 bytes of the page header, encode the page size and information on the internal fragmentation of the page. Page size is stored in each page because frames in the buffer pool may be subdivided into equal sized pages on a frame by -frame basis within a class. The internal fragmentation information is +frame basis within a table. The internal fragmentation information is used to aid in determining when page reorganization should occur. diff --git a/doc/src/sgml/plsql.sgml b/doc/src/sgml/plsql.sgml index 30097c8128..a035121c53 100644 --- a/doc/src/sgml/plsql.sgml +++ b/doc/src/sgml/plsql.sgml @@ -1,5 +1,5 @@ @@ -181,12 +181,12 @@ END; -name class%ROWTYPE; +name table%ROWTYPE; - Declares a row with the structure of the given class. Class must be - an existing table- or view name of the database. The fields of the row + Declares a row with the structure of the given table. table must be + an existing table or view name of the database. The fields of the row are accessed in the dot notation. Parameters to a function can be composite types (complete table rows). In that case, the corresponding identifier $n will be a rowtype, but it @@ -281,7 +281,7 @@ RENAME oldname TO newname; - class.field%TYPE + table.field%TYPE @@ -292,12 +292,12 @@ RENAME oldname TO newname; same function, that is visible at this point. - class is the name of an existing table + table is the name of an existing table or view where field is the name of an attribute. - Using the class.field%TYPE + Using the table.field%TYPE causes PL/pgSQL to look up the attributes definitions at the first call to the function during the lifetime of a backend. Have a table with a char(20) attribute and some PL/pgSQL functions @@ -307,7 +307,7 @@ RENAME oldname TO newname; char(40) and restores the data. Ha - he forgot about the functions. The computations inside them will truncate the values to 20 characters. But if they are defined using the - class.field%TYPE + table.field%TYPE declarations, they will automagically handle the size change or if the new table schema defines the attribute as text type. diff --git a/doc/src/sgml/programmer.sgml b/doc/src/sgml/programmer.sgml index 73be6e4a2e..7c2190ba82 100644 --- a/doc/src/sgml/programmer.sgml +++ b/doc/src/sgml/programmer.sgml @@ -1,5 +1,5 @@ @@ -35,7 +35,7 @@ PostgreSQL Programmer's Guide. developed originally in the UC Berkeley Computer Science Department, pioneered many of the object-relational concepts now becoming available in some commercial databases. - It provides SQL92/SQL3 language support, + It provides SQL92/SQL99 language support, transaction integrity, and type extensibility. PostgreSQL is an open-source descendant of this original Berkeley code. diff --git a/doc/src/sgml/query.sgml b/doc/src/sgml/query.sgml index a2736b99e7..82c4ffe697 100644 --- a/doc/src/sgml/query.sgml +++ b/doc/src/sgml/query.sgml @@ -1,5 +1,5 @@ @@ -7,8 +7,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.16 2000/12/22 19:31:56 peter The Postgres query language is a variant of - the SQL3 draft next-generation standard. It - has many extensions to SQL92 such as an + the SQL standard. It + has many extensions to SQL such as an extensible type system, inheritance, functions and production rules. These are features carried over from the original @@ -24,7 +24,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.16 2000/12/22 19:31:56 peter and . You should be aware that some language features - are extensions to the ANSI standard. + are extensions to the standard. @@ -34,14 +34,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.16 2000/12/22 19:31:56 peter In the examples that follow, we assume that you have created the mydb database as described in the previous subsection and have started psql. - Examples in this manual can also be found in - /usr/local/pgsql/src/tutorial/. Refer to the + Examples in this manual can also be found in source distribution + in the directory src/tutorial/. Refer to the README file in that directory for how to use them. To start the tutorial, do the following: - -% cd /usr/local/pgsql/src/tutorial -% psql -s mydb + +$ cd .../src/tutorial +$ psql -s mydb + Welcome to the POSTGRESQL interactive sql monitor: Please read the file COPYRIGHT for copyright terms of POSTGRESQL @@ -49,9 +50,10 @@ Welcome to the POSTGRESQL interactive sql monitor: type \q to quit type \g or terminate with semicolon to execute query You are currently connected to the database: postgres + -mydb=> \i basics.sql - +mydb=> \i basics.sql + @@ -73,34 +75,33 @@ mydb=> \i basics.sql Concepts - The fundamental notion in Postgres is that of a class, - which is a named collection of object instances. Each - instance has the same collection of named attributes, - and each attribute is of a specific type. Furthermore, - each instance has a permanent object identifier - (OID) - that is unique throughout the installation. Because - SQL syntax refers to tables, we will use the terms - table and class interchangeably. - Likewise, an SQL row is an - instance and SQL - columns - are attributes. - As previously discussed, classes are grouped into - databases, and a collection of databases managed by a - single postmaster process constitutes a - database cluster. + The fundamental notion in Postgres is + that of a table, which is a named + collection of rows. Each row has the same + set of named columns, and each column is of + a specific type. Furthermore, each row has a permanent + object identifier (OID) + that is unique throughout the database cluster. Historially, + tables have been called classes in + Postgres, rows are object instances, + and columns are attributes. This makes sense if you consider the + object-relational aspects of the database system, but in this + manual we will use the customary SQL + terminology. As previously discussed, + tables are grouped into databases, and a collection of databases + managed by a single postmaster process + constitutes a database cluster. - Creating a New Class + Creating a New Table - You can create a new class by specifying the class - name, along with all attribute names and their types: + You can create a new table by specifying the table + name, along with all column names and their types: - + CREATE TABLE weather ( city varchar(80), temp_lo int, -- low temperature @@ -108,7 +109,7 @@ CREATE TABLE weather ( prcp real, -- precipitation date date ); - + @@ -135,22 +136,21 @@ CREATE TABLE weather ( looks exactly like the command used to create a table in a traditional relational system. However, we will presently see that - classes have properties that are extensions of the + tables have properties that are extensions of the relational model. - Populating a Class with Instances + Populating a Table with Rows - The INSERT statement is used to populate a class with - instances: + The INSERT statement is used to populate a table with + rows: - -INSERT INTO weather - VALUES ('San Francisco', 46, 50, 0.25, '11/27/1994'); - + +INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27'); + @@ -160,10 +160,9 @@ INSERT INTO weather single atomic transaction directly to or from the target table. An example would be: - -COPY weather FROM '/home/user/weather.txt' - USING DELIMITERS '|'; - + +COPY weather FROM '/home/user/weather.txt' USING DELIMITERS '|'; + where the path name for the source file must be available to the backend server @@ -172,38 +171,38 @@ COPY weather FROM '/home/user/weather.txt' - Querying a Class + Querying a Table - The weather class can be queried with normal relational + The weather table can be queried with normal relational selection and projection queries. A SQL SELECT statement is used to do this. The statement is divided into - a target list (the part that lists the attributes to be + a target list (the part that lists the columns to be returned) and a qualification (the part that specifies any restrictions). For example, to retrieve all the rows of weather, type: - + SELECT * FROM weather; - + and the output should be: - + +--------------+---------+---------+------+------------+ |city | temp_lo | temp_hi | prcp | date | +--------------+---------+---------+------+------------+ -|San Francisco | 46 | 50 | 0.25 | 11-27-1994 | +|San Francisco | 46 | 50 | 0.25 | 1994-11-27 | +--------------+---------+---------+------+------------+ -|San Francisco | 43 | 57 | 0 | 11-29-1994 | +|San Francisco | 43 | 57 | 0 | 1994-11-29 | +--------------+---------+---------+------+------------+ -|Hayward | 37 | 54 | | 11-29-1994 | +|Hayward | 37 | 54 | | 1994-11-29 | +--------------+---------+---------+------+------------+ - + You may specify any arbitrary expressions in the target list. For example, you can do: - + SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather; - + @@ -212,31 +211,31 @@ SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather; NOT) are allowed in the qualification of any query. For example, - + SELECT * FROM weather WHERE city = 'San Francisco' AND prcp > 0.0; - + results in: - + +--------------+---------+---------+------+------------+ |city | temp_lo | temp_hi | prcp | date | +--------------+---------+---------+------+------------+ -|San Francisco | 46 | 50 | 0.25 | 11-27-1994 | +|San Francisco | 46 | 50 | 0.25 | 1994-11-27 | +--------------+---------+---------+------+------------+ - + As a final note, you can specify that the results of a select can be returned in a sorted order - or with duplicate instances removed. + or with duplicate rows removed. - + SELECT DISTINCT city FROM weather ORDER BY city; - + @@ -244,37 +243,37 @@ SELECT DISTINCT city Redirecting SELECT Queries - Any SELECT query can be redirected to a new class - + Any SELECT query can be redirected to a new table + SELECT * INTO TABLE temp FROM weather; - + This forms an implicit CREATE command, creating a new - class temp with the attribute names and types specified + table temp with the column names and types specified in the target list of the SELECT INTO command. We can then, of course, perform any operations on the resulting - class that we can perform on other classes. + table that we can perform on other tables. - Joins Between Classes + Joins Between Tables - Thus far, our queries have only accessed one class at a - time. Queries can access multiple classes at once, or - access the same class in such a way that multiple - instances of the class are being processed at the same - time. A query that accesses multiple instances of the - same or different classes at one time is called a join + Thus far, our queries have only accessed one table at a + time. Queries can access multiple tables at once, or + access the same table in such a way that multiple + rows of the table are being processed at the same + time. A query that accesses multiple rows of the + same or different tables at one time is called a join query. As an example, say we wish to find all the records that are in the temperature range of other records. In effect, we need to compare the temp_lo and temp_hi - attributes of each WEATHER instance to the temp_lo and - temp_hi attributes of all other WEATHER instances. + columns of each WEATHER row to the temp_lo and + temp_hi columns of all other WEATHER columns. This is only a conceptual model. The actual join may @@ -285,7 +284,7 @@ SELECT * INTO TABLE temp FROM weather; We can do this with the following query: - + SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high, W2.city, W2.temp_lo AS low, W2.temp_hi AS high FROM weather W1, weather W2 @@ -299,14 +298,14 @@ SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high, +--------------+-----+------+---------------+-----+------+ |San Francisco | 37 | 54 | San Francisco | 46 | 50 | +--------------+-----+------+---------------+-----+------+ - + The semantics of such a join are that the qualification is a truth expression defined for the Cartesian product of - the classes indicated in the query. For those instances in + the tables indicated in the query. For those rows in the Cartesian product for which the qualification is true, Postgres computes and returns the values specified in the target list. @@ -324,13 +323,13 @@ SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high, In this case, both W1 and - W2 are surrogates for an - instance of the class weather, and both range over all - instances of the class. (In the terminology of most + W2 are surrogates for a + row of the table weather, and both range over all + rows of the table. (In the terminology of most database systems, W1 and W2 are known as range variables.) A query can contain an arbitrary number of - class names and surrogates. + table names and surrogates. @@ -338,17 +337,17 @@ SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high, Updates - You can update existing instances using the + You can update existing rows using the UPDATE command. Suppose you discover the temperature readings are all off by 2 degrees as of Nov 28, you may update the data as follow: - + UPDATE weather SET temp_hi = temp_hi - 2, temp_lo = temp_lo - 2 - WHERE date > '11/28/1994'; - + WHERE date > '1994-11-28'; + @@ -357,18 +356,18 @@ UPDATE weather Deletions are performed using the DELETE command: - + DELETE FROM weather WHERE city = 'Hayward'; - + - All weather recording belongs to Hayward is removed. + All weather recording belonging to Hayward are removed. One should be wary of queries of the form - -DELETE FROM classname; - + +DELETE FROM tablename; + Without a qualification, DELETE will simply - remove all instances of the given class, leaving it + remove all rows from the given table, leaving it empty. The system will not request confirmation before doing this. @@ -385,7 +384,7 @@ DELETE FROM classname; For example, there are aggregates to compute the count, sum, avg (average), max (maximum) and - min (minimum) over a set of instances. + min (minimum) over a set of rows. diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 24513344d7..280c7039a1 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1,5 +1,5 @@ @@ -209,7 +209,7 @@ ALTER TABLE table - You must own the class in order to change its schema. + You must own the table in order to change it. Renaming any part of the schema of a system catalog is not permitted. The PostgreSQL User's Guide has further diff --git a/doc/src/sgml/ref/cluster.sgml b/doc/src/sgml/ref/cluster.sgml index 9852f39f3a..c6eda9d5e3 100644 --- a/doc/src/sgml/ref/cluster.sgml +++ b/doc/src/sgml/ref/cluster.sgml @@ -1,5 +1,5 @@ @@ -23,7 +23,7 @@ Postgres documentation 1999-07-20 -CLUSTER indexname ON table +CLUSTER indexname ON tablename @@ -115,18 +115,18 @@ ERROR: Relation table does not exis CLUSTER instructs Postgres - to cluster the class specified + to cluster the table specified by table approximately based on the index specified by indexname. The index must already have been defined on - classname. + tablename. - When a class is clustered, it is physically reordered + When a table is clustered, it is physically reordered based on the index information. The clustering is static. - In other words, as the class is updated, the changes are + In other words, as the table is updated, the changes are not clustered. No attempt is made to keep new instances or updated tuples clustered. If one wishes, one can re-cluster manually by issuing the command again. diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 155fca54a5..6019eb7a08 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ @@ -590,9 +590,9 @@ ZW ZIMBABWE The following is the same data, output in binary format on a Linux/i586 machine. The data is shown after filtering through the Unix utility od -c. The table has - three fields; the first is char(2), - the second is text, and the third is - int4. All the + three fields; the first is char(2), + the second is text, and the third is + integer. All the rows have a null value in the third field. diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index 4a8ae459aa..be1e82a7e9 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -1,5 +1,5 @@ @@ -208,7 +208,7 @@ ERROR: Cannot create index: 'index_name' already exists. In the second syntax shown above, an index is defined on the result of a user-specified function func_name applied - to one or more attributes of a single class. + to one or more columns of a single table. These functional indices can be used to obtain fast access to data based on operators that would normally require some diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index bb963c833c..089fcebb07 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -1,5 +1,5 @@ @@ -350,7 +350,7 @@ MYBOXES.description <<< box '((0,0), (1,1))' instance variables, the query optimizer must estimate the size of the resulting join. The function join_proc will return another floating point number which will be multiplied - by the cardinalities of the two classes involved to + by the cardinalities of the two tables involved to compute the expected result size. diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml index aeaddd9a20..e6a1a7b146 100644 --- a/doc/src/sgml/ref/create_rule.sgml +++ b/doc/src/sgml/ref/create_rule.sgml @@ -1,5 +1,5 @@ @@ -213,7 +213,7 @@ CREATE - You must have rule definition access to a class in order + You must have rule definition access to a table in order to define a rule on it. Use GRANT and REVOKE to change permissions. diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 095a630a73..cb6b67e7ca 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -336,7 +336,7 @@ CREATE Examples This command creates the box data type and then uses the - type in a class definition: + type in a table definition: CREATE TYPE box (INTERNALLENGTH = 8, INPUT = my_procedure_1, OUTPUT = my_procedure_2); @@ -357,7 +357,7 @@ CREATE TABLE myarrays (id int4, numbers int4array); This command creates a large object type and uses it in - a class definition: + a table definition: CREATE TYPE bigobj (INPUT = lo_filein, OUTPUT = lo_fileout, diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index 95fdece785..8132e41d42 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -1,5 +1,5 @@ @@ -123,8 +123,8 @@ CREATE VIEW vista AS SELECT text 'Hello World' Description - CREATE VIEW will define a view of a table or - class. This view is not physically materialized. Specifically, a query + CREATE VIEW will define a view of a table. + This view is not physically materialized. Specifically, a query rewrite retrieve rule is automatically generated to support retrieve operations on views. diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml index 585716c49b..314f51ec85 100644 --- a/doc/src/sgml/ref/createuser.sgml +++ b/doc/src/sgml/ref/createuser.sgml @@ -1,5 +1,5 @@ @@ -196,7 +196,7 @@ Postgres documentation createuser creates a new Postgres user. Only users with usesuper set in - the pg_shadow class can create + the pg_shadow table can create new Postgres users. diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml index 82f29853b2..1f684b946f 100644 --- a/doc/src/sgml/ref/delete.sgml +++ b/doc/src/sgml/ref/delete.sgml @@ -1,5 +1,5 @@ @@ -120,7 +120,7 @@ DELETE count By default DELETE will delete tuples in the table specified - and all its sub-classes. If you wish to only update the + and all its sub-tables. If you wish to only update the specific table mentioned, you should use the ONLY clause. diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml index abd7582a80..59ab791192 100644 --- a/doc/src/sgml/ref/drop_type.sgml +++ b/doc/src/sgml/ref/drop_type.sgml @@ -1,5 +1,5 @@ @@ -113,7 +113,7 @@ ERROR: RemoveType: type 'typename' It is the user's responsibility to remove any operators, - functions, aggregates, access methods, subtypes, and classes + functions, aggregates, access methods, subtypes, and tables that use a deleted type. diff --git a/doc/src/sgml/ref/dropuser.sgml b/doc/src/sgml/ref/dropuser.sgml index f4b2cd55ea..a1bc836cd1 100644 --- a/doc/src/sgml/ref/dropuser.sgml +++ b/doc/src/sgml/ref/dropuser.sgml @@ -1,5 +1,5 @@ @@ -148,7 +148,7 @@ Postgres documentation Postgres user and the databases which that user owned. Only users with usesuper set in - the pg_shadow class can destroy + the pg_shadow table can destroy Postgres users. diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index 6c9f268a86..dc6fb14da8 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -1,5 +1,5 @@ @@ -129,7 +129,7 @@ INSERT 0 # INSERT allows one to insert new rows into a - class or table. One can insert + table. One can insert a single row at a time or several rows as a result of a query. The columns in the target list may be listed in any order. diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index a34771571e..bdd2bbc4c5 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1,5 +1,5 @@ @@ -31,7 +31,7 @@ SELECT [ ALL | DISTINCT [ ON ( expressioncondition [, ...] ] [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ] - [ FOR UPDATE [ OF class_name [, ...] ] ] + [ FOR UPDATE [ OF tablename [, ...] ] ] [ LIMIT { count | ALL } [ { OFFSET | , } start ]] where from_item can be: @@ -397,11 +397,11 @@ where from_item can be: When a FROM item is a simple table name, it implicitly includes rows - from subclasses (inheritance children) of the table. + from sub-tables (inheritance children) of the table. ONLY will - suppress rows from subclasses of the table. Before + suppress rows from sub-tables of the table. Before Postgres 7.1, - this was the default result, and adding subclasses was done + this was the default result, and adding sub-tables was done by appending * to the table name. This old behaviour is available via the command SET SQL_Inheritance TO OFF; diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index 91bb572918..c80395de80 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -1,5 +1,5 @@ @@ -31,7 +31,7 @@ SELECT [ ALL | DISTINCT [ ON ( expressioncondition [, ...] ] [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ] - [ FOR UPDATE [ OF class_name [, ...] ] ] + [ FOR UPDATE [ OF tablename [, ...] ] ] [ LIMIT { count | ALL } [ { OFFSET | , } start ]] where from_item can be: diff --git a/doc/src/sgml/ref/unlisten.sgml b/doc/src/sgml/ref/unlisten.sgml index f7ea70967e..4f4c1cf2b5 100644 --- a/doc/src/sgml/ref/unlisten.sgml +++ b/doc/src/sgml/ref/unlisten.sgml @@ -1,5 +1,5 @@ @@ -114,7 +114,7 @@ UNLISTEN { notifyname | * } Notes - classname + notifyname need not be a valid class name but can be any string valid as a name up to 32 characters long. @@ -124,13 +124,6 @@ UNLISTEN { notifyname | * } Each backend will automatically execute UNLISTEN * when exiting. - - A restriction in some previous releases of - Postgres that a - classname - which does not correspond to an actual table must be enclosed in double-quotes - is no longer present. - diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 0da8174a9a..58966c9b4a 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -1,5 +1,5 @@ @@ -143,7 +143,7 @@ UPDATE # By default UPDATE will update tuples in the table specified - and all its sub-classes. If you wish to only update the + and all its sub-tables. If you wish to only update the specific table mentioned, you should use the ONLY clause. diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 984b808403..51cb8a9ffd 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -1,5 +1,5 @@ @@ -150,10 +150,10 @@ NOTICE: Index index: Pages 28; - VACUUM opens every class in the database, + VACUUM opens every table in the database, cleans out records from rolled back transactions, and updates statistics in the system catalogs. The statistics maintained include the number of - tuples and number of pages stored in all classes. + tuples and number of pages stored in all tables. @@ -181,7 +181,7 @@ NOTICE: Index index: Pages 28; We recommend that active production databases be VACUUM-ed nightly, in order to remove - expired rows. After copying a large class into + expired rows. After copying a large table into Postgres or after deleting a large number of records, it may be a good idea to issue a VACUUM ANALYZE query. This will update the system catalogs with diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 45b893e1c5..918ff103dd 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,5 +1,5 @@ @@ -553,15 +553,12 @@ CAST ( 'string' AS type ) - Fields and Columns - - - Fields + Columns - A field - is either a user-defined attribute of a given class or one of the - following system-defined attributes: + A column + is either a user-defined column of a given table or one of the + following system-defined columns: @@ -653,40 +650,29 @@ CAST ( 'string' AS type ) . Transaction and command identifiers are 32 bit quantities. - - - - Columns - A column is a construct of the form: + A column can be referenced in the form: - -instance{.composite_field}.field `['subscript`]' - + +corelation.columnname `['subscript`]' + - instance - identifies a particular class and can be thought of as standing for - the instances of that class. An instance variable is either a class - name, an alias for a class defined by means of a FROM clause, - or the keyword NEW or OLD. - (NEW and OLD can only appear in the action portion of a rule, while - other instance variables can be used in any SQL statement.) The - instance name can be omitted if the first field name is unique - across all the classes being used in the current query. - composite_field - is a field of of one of the Postgres composite types, - while successive composite fields select attributes in the - class(s) to which the composite field evaluates. Lastly, - field - is a normal (base type) field in the class(s) last addressed. If - field - is of an array type, - then the optional subscript - selects a specific element in the array. If no subscript is - provided, then the whole array is selected. + corelation is either the name of a + table, an alias for a table defined by means of a FROM clause, or + the keyword NEW or OLD. + (NEW and OLD can only appear in the action portion of a rule, + while other corelation names can be used in any SQL statement.) + The corelation name can be omitted if the column name is unique + across all the tables being used in the current query. If + column is of an array type, then the + optional subscript selects a specific + element in the array. If no subscript is provided, then the + whole array is selected. Refer to the description of the + particular commands in the PostgreSQL Reference + Manual for the allowed syntax in each case. - + @@ -861,10 +847,10 @@ sqrt(emp.salary) The simplest possibility for a from-expression is: -class_reference [ [ AS ] alias ] +table_reference [ [ AS ] alias ] - where class_reference is of the form + where table_reference is of the form [ ONLY ] table_name [ * ] diff --git a/doc/src/sgml/tutorial.sgml b/doc/src/sgml/tutorial.sgml index f4acddfa2f..29ee820327 100644 --- a/doc/src/sgml/tutorial.sgml +++ b/doc/src/sgml/tutorial.sgml @@ -1,5 +1,5 @@ @@ -33,7 +33,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/tutorial.sgml,v 1.11 2000/11/24 17:44 developed originally in the UC Berkeley Computer Science Department, pioneered many of the object-relational concepts now becoming available in some commercial databases. - It provides SQL92/SQL3 language support, + It provides SQL92/SQL99 language support, transaction integrity, and type extensibility. PostgreSQL is an open-source descendant of this original Berkeley code. diff --git a/doc/src/sgml/user.sgml b/doc/src/sgml/user.sgml index d1275e0173..78d422013d 100644 --- a/doc/src/sgml/user.sgml +++ b/doc/src/sgml/user.sgml @@ -1,5 +1,5 @@ @@ -35,7 +35,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/user.sgml,v 1.23 2001/01/06 11:58:56 developed originally in the UC Berkeley Computer Science Department, pioneered many of the object-relational concepts now becoming available in some commercial databases. - It provides SQL92/SQL3 language support, + It provides SQL92/SQL99 language support, transaction integrity, and type extensibility. PostgreSQL is an open-source descendant of this original Berkeley code. diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml index d8890617ba..693cb6defe 100644 --- a/doc/src/sgml/xaggr.sgml +++ b/doc/src/sgml/xaggr.sgml @@ -1,5 +1,5 @@ @@ -31,9 +31,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.9 2000/10/23 00:46:06 tgl Ex If we define an aggregate that does not use a final function, we have an aggregate that computes a running function of - the attribute values from each instance. "Sum" is an + the column values from each row. "Sum" is an example of this kind of aggregate. "Sum" starts at - zero and always adds the current instance's value to + zero and always adds the current row's value to its running total. For example, if we want to make a Sum aggregate to work on a datatype for complex numbers, we only need the addition function for that datatype. diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 6ce9cb712f..912107bb66 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,5 +1,5 @@ @@ -202,7 +202,7 @@ SELECT name, double_salary(EMP) AS dream return composite types, we must first introduce the function notation for projecting attributes. The simple way to explain this is that we can usually use the - notations attribute(class) and class.attribute interchangably: + notations attribute(table) and table.attribute interchangably: -- @@ -223,10 +223,10 @@ SELECT name(EMP) AS youngster As we shall see, however, this is not always the case. This function notation is important when we want to use - a function that returns a single instance. We do this - by assembling the entire instance within the function, + a function that returns a single row. We do this + by assembling the entire row within the function, attribute by attribute. This is an example of a function - that returns a single EMP instance: + that returns a single EMP row: CREATE FUNCTION new_emp() @@ -266,10 +266,10 @@ ERROR: function declared to return emp returns varchar instead of text at colum - When calling a function that returns an instance, we - cannot retrieve the entire instance. We must either - project an attribute out of the instance or pass the - entire instance into another function. + When calling a function that returns a row, we + cannot retrieve the entire row. We must either + project an attribute out of the row or pass the + entire row into another function. SELECT name(new_emp()) AS nobody; @@ -1012,7 +1012,7 @@ concat_text(PG_FUNCTION_ARGS) Therefore, Postgres provides a procedural interface for accessing fields of composite types from C. As Postgres processes - a set of instances, each instance will be passed into your + a set of rows, each row will be passed into your function as an opaque structure of type TUPLE. Suppose we want to write a function to answer the query @@ -1029,7 +1029,7 @@ WHERE name = 'Bill' OR name = 'Sam'; #include "executor/executor.h" /* for GetAttributeByName() */ bool -c_overpaid(TupleTableSlot *t, /* the current instance of EMP */ +c_overpaid(TupleTableSlot *t, /* the current row of EMP */ int32 limit) { bool isnull; @@ -1066,7 +1066,7 @@ c_overpaid(PG_FUNCTION_ARGS) GetAttributeByName is the Postgres system function that - returns attributes out of the current instance. It has + returns attributes out of the current row. It has three arguments: the argument of type TupleTableSlot* passed into the function, the name of the desired attribute, and a return parameter that tells whether the attribute @@ -1088,8 +1088,8 @@ LANGUAGE 'c'; - While there are ways to construct new instances or modify - existing instances from within a C function, these + While there are ways to construct new rows or modify + existing rows from within a C function, these are far too complex to discuss in this manual. diff --git a/doc/src/sgml/xindex.sgml b/doc/src/sgml/xindex.sgml index 6fedbf5b70..f2df6b5624 100644 --- a/doc/src/sgml/xindex.sgml +++ b/doc/src/sgml/xindex.sgml @@ -1,5 +1,5 @@ @@ -27,7 +27,7 @@ Postgres documentation - The pg_am class contains one instance for every user + The pg_am table contains one row for every user defined access method. Support for the heap access method is built into Postgres, but every other access method is described here. The schema is @@ -38,7 +38,7 @@ Postgres documentation - Attribute + Column Description @@ -49,7 +49,7 @@ Postgres documentation amowner - object id of the owner's instance in pg_user + user id of the owner amstrategies @@ -74,7 +74,7 @@ Postgres documentation ... procedure identifiers for interface routines to the access method. For example, regproc ids for opening, closing, and - getting instances from the access method appear here. + getting rows from the access method appear here. @@ -82,11 +82,11 @@ Postgres documentation - The object ID of the instance in - pg_am is used as a foreign key in lots of other - classes. You don't need to add a new instance to this class; all - you're interested in is the object ID of the access - method instance you want to extend: + The object ID of the row in + pg_am is used as a foreign key in a lot of other + tables. You do not need to add a new rows to this table; all that + you are interested in is the object ID of the access + method row you want to extend: SELECT oid FROM pg_am WHERE amname = 'btree'; @@ -102,7 +102,7 @@ SELECT oid FROM pg_am WHERE amname = 'btree'; - The amstrategies attribute exists to standardize + The amstrategies column exists to standardize comparisons across data types. For example, B-trees impose a strict ordering on keys, lesser to greater. Since Postgres allows the user to define operators, @@ -125,7 +125,7 @@ SELECT oid FROM pg_am WHERE amname = 'btree'; Defining a new set of strategies is beyond the scope of this discussion, but we'll explain how B-tree strategies work because you'll need to know that to add a new operator class. In the - pg_am class, the amstrategies attribute is the + pg_am table, the amstrategies column is the number of strategies defined for this access method. For B-trees, this number is 5. These strategies correspond to @@ -193,8 +193,8 @@ SELECT oid FROM pg_am WHERE amname = 'btree'; In order to manage diverse support routines consistently across all Postgres access methods, - pg_am includes an attribute called - amsupport. This attribute records the number of + pg_am includes a column called + amsupport. This column records the number of support routines used by an access method. For B-trees, this number is one -- the routine to take two keys and return -1, 0, or +1, depending on whether the first key is less than, equal @@ -228,14 +228,14 @@ SELECT oid FROM pg_am WHERE amname = 'btree'; - The next class of interest is pg_opclass. This class + The next table of interest is pg_opclass. This table exists only to associate an operator class name and perhaps a default type with an operator class oid. Some existing opclasses are int2_ops, - int4_ops, and oid_ops. You need to add an - instance with your opclass name (for example, + int4_ops, and oid_ops. You need to add a + row with your opclass name (for example, complex_abs_ops) to pg_opclass. The oid of - this instance will be a foreign key in other classes, notably + this row will be a foreign key in other tables, notably pg_amop. @@ -252,7 +252,7 @@ SELECT oid, opcname, opcdeftype (1 row) - Note that the oid for your pg_opclass instance will + Note that the oid for your pg_opclass row will be different! Don't worry about this though. We'll get this number from the system later just like we got the oid of the type here. @@ -357,7 +357,7 @@ CREATE FUNCTION complex_abs_eq(complex, complex) hand, the support function returns whatever the particular access method expects -- in this case, a signed integer.) The final routine in the file is the "support routine" mentioned when we discussed the amsupport - attribute of the pg_am class. We will use this + column of the pg_am table. We will use this later on. For now, ignore it. @@ -416,10 +416,10 @@ CREATE OPERATOR = ( - Now we're ready to update pg_amop with our new + Now we are ready to update pg_amop with our new operator class. The most important thing in this entire discussion is that the operators are ordered, from less than through greater - than, in pg_amop. We add the instances we need: + than, in pg_amop. We add the rows we need: INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy) @@ -440,7 +440,7 @@ CREATE OPERATOR = ( The next step is registration of the "support routine" previously described in our discussion of pg_am. The oid of this support routine is stored in the - pg_amproc class, keyed by the access method + pg_amproc table, keyed by the access method oid and the operator class oid. First, we need to register the function in Postgres (recall that we put the @@ -463,7 +463,7 @@ CREATE OPERATOR = ( (Again, your oid number will probably be different.) - We can add the new instance as follows: + We can add the new row as follows: INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum) diff --git a/doc/src/sgml/xtypes.sgml b/doc/src/sgml/xtypes.sgml index b28830f288..943b14f82e 100644 --- a/doc/src/sgml/xtypes.sgml +++ b/doc/src/sgml/xtypes.sgml @@ -3,7 +3,7 @@ As previously mentioned, there are two kinds of types in Postgres: base types (defined in a programming language) - and composite types (instances). + and composite types. Examples in this section up to interfacing indices can be found in complex.sql and complex.c. Composite examples are in funcs.sql. -- 2.40.0