From c326d8f4f20a9b98f6faa760ccf2cd13fb289dc8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 31 Aug 2003 17:32:24 +0000 Subject: Add/edit index entries. --- doc/src/sgml/advanced.sgml | 4 +- doc/src/sgml/array.sgml | 4 +- doc/src/sgml/backup.sgml | 28 +- doc/src/sgml/charset.sgml | 4 +- doc/src/sgml/client-auth.sgml | 7 +- doc/src/sgml/datatype.sgml | 249 ++++--- doc/src/sgml/datetime.sgml | 5 +- doc/src/sgml/ddl.sgml | 247 ++++++- doc/src/sgml/dfunc.sgml | 55 +- doc/src/sgml/dml.sgml | 26 +- doc/src/sgml/ecpg.sgml | 4 +- doc/src/sgml/extend.sgml | 43 +- doc/src/sgml/func.sgml | 121 ++-- doc/src/sgml/indices.sgml | 35 +- doc/src/sgml/installation.sgml | 10 +- doc/src/sgml/jdbc.sgml | 60 +- doc/src/sgml/keywords.sgml | 4 +- doc/src/sgml/libpgtcl.sgml | 16 +- doc/src/sgml/libpq.sgml | 1129 ++++++++++++++++--------------- doc/src/sgml/lobj.sgml | 70 +- doc/src/sgml/maintenance.sgml | 18 +- doc/src/sgml/manage-ag.sgml | 65 +- doc/src/sgml/monitoring.sgml | 17 +- doc/src/sgml/mvcc.sgml | 31 +- doc/src/sgml/perform.sgml | 32 +- doc/src/sgml/plperl.sgml | 41 +- doc/src/sgml/plpgsql.sgml | 81 ++- doc/src/sgml/plpython.sgml | 35 +- doc/src/sgml/pltcl.sgml | 17 +- doc/src/sgml/queries.sgml | 125 +++- doc/src/sgml/query.sgml | 7 +- doc/src/sgml/ref/abort.sgml | 6 +- doc/src/sgml/ref/alter_aggregate.sgml | 6 +- doc/src/sgml/ref/alter_conversion.sgml | 6 +- doc/src/sgml/ref/alter_database.sgml | 6 +- doc/src/sgml/ref/alter_domain.sgml | 8 +- doc/src/sgml/ref/alter_function.sgml | 6 +- doc/src/sgml/ref/alter_group.sgml | 6 +- doc/src/sgml/ref/alter_language.sgml | 6 +- doc/src/sgml/ref/alter_opclass.sgml | 6 +- doc/src/sgml/ref/alter_schema.sgml | 6 +- doc/src/sgml/ref/alter_sequence.sgml | 8 +- doc/src/sgml/ref/alter_table.sgml | 6 +- doc/src/sgml/ref/alter_trigger.sgml | 6 +- doc/src/sgml/ref/alter_user.sgml | 6 +- doc/src/sgml/ref/analyze.sgml | 6 +- doc/src/sgml/ref/begin.sgml | 6 +- doc/src/sgml/ref/checkpoint.sgml | 6 +- doc/src/sgml/ref/close.sgml | 6 +- doc/src/sgml/ref/cluster.sgml | 6 +- doc/src/sgml/ref/clusterdb.sgml | 6 +- doc/src/sgml/ref/comment.sgml | 6 +- doc/src/sgml/ref/commit.sgml | 6 +- doc/src/sgml/ref/copy.sgml | 6 +- doc/src/sgml/ref/create_aggregate.sgml | 6 +- doc/src/sgml/ref/create_cast.sgml | 6 +- doc/src/sgml/ref/create_constraint.sgml | 6 +- doc/src/sgml/ref/create_conversion.sgml | 6 +- doc/src/sgml/ref/create_database.sgml | 6 +- doc/src/sgml/ref/create_domain.sgml | 6 +- doc/src/sgml/ref/create_function.sgml | 6 +- doc/src/sgml/ref/create_group.sgml | 6 +- doc/src/sgml/ref/create_index.sgml | 6 +- doc/src/sgml/ref/create_language.sgml | 6 +- doc/src/sgml/ref/create_opclass.sgml | 6 +- doc/src/sgml/ref/create_operator.sgml | 6 +- doc/src/sgml/ref/create_rule.sgml | 6 +- doc/src/sgml/ref/create_schema.sgml | 6 +- doc/src/sgml/ref/create_sequence.sgml | 6 +- doc/src/sgml/ref/create_table.sgml | 6 +- doc/src/sgml/ref/create_table_as.sgml | 6 +- doc/src/sgml/ref/create_trigger.sgml | 6 +- doc/src/sgml/ref/create_type.sgml | 6 +- doc/src/sgml/ref/create_user.sgml | 6 +- doc/src/sgml/ref/create_view.sgml | 6 +- doc/src/sgml/ref/createdb.sgml | 6 +- doc/src/sgml/ref/createlang.sgml | 6 +- doc/src/sgml/ref/createuser.sgml | 6 +- doc/src/sgml/ref/deallocate.sgml | 6 +- doc/src/sgml/ref/declare.sgml | 6 +- doc/src/sgml/ref/delete.sgml | 6 +- doc/src/sgml/ref/drop_aggregate.sgml | 6 +- doc/src/sgml/ref/drop_cast.sgml | 6 +- doc/src/sgml/ref/drop_conversion.sgml | 6 +- doc/src/sgml/ref/drop_database.sgml | 6 +- doc/src/sgml/ref/drop_domain.sgml | 6 +- doc/src/sgml/ref/drop_function.sgml | 6 +- doc/src/sgml/ref/drop_group.sgml | 6 +- doc/src/sgml/ref/drop_index.sgml | 6 +- doc/src/sgml/ref/drop_language.sgml | 6 +- doc/src/sgml/ref/drop_opclass.sgml | 6 +- doc/src/sgml/ref/drop_operator.sgml | 6 +- doc/src/sgml/ref/drop_rule.sgml | 6 +- doc/src/sgml/ref/drop_schema.sgml | 6 +- doc/src/sgml/ref/drop_sequence.sgml | 6 +- doc/src/sgml/ref/drop_table.sgml | 6 +- doc/src/sgml/ref/drop_trigger.sgml | 6 +- doc/src/sgml/ref/drop_type.sgml | 6 +- doc/src/sgml/ref/drop_user.sgml | 6 +- doc/src/sgml/ref/drop_view.sgml | 6 +- doc/src/sgml/ref/dropdb.sgml | 6 +- doc/src/sgml/ref/droplang.sgml | 6 +- doc/src/sgml/ref/dropuser.sgml | 6 +- doc/src/sgml/ref/ecpg-ref.sgml | 6 +- doc/src/sgml/ref/end.sgml | 6 +- doc/src/sgml/ref/execute.sgml | 6 +- doc/src/sgml/ref/explain.sgml | 6 +- doc/src/sgml/ref/fetch.sgml | 6 +- doc/src/sgml/ref/grant.sgml | 6 +- doc/src/sgml/ref/initdb.sgml | 6 +- doc/src/sgml/ref/initlocation.sgml | 6 +- doc/src/sgml/ref/insert.sgml | 6 +- doc/src/sgml/ref/ipcclean.sgml | 6 +- doc/src/sgml/ref/listen.sgml | 6 +- doc/src/sgml/ref/load.sgml | 6 +- doc/src/sgml/ref/lock.sgml | 6 +- doc/src/sgml/ref/move.sgml | 6 +- doc/src/sgml/ref/notify.sgml | 6 +- doc/src/sgml/ref/pg_config-ref.sgml | 6 +- doc/src/sgml/ref/pg_controldata.sgml | 6 +- doc/src/sgml/ref/pg_ctl-ref.sgml | 6 +- doc/src/sgml/ref/pg_dump.sgml | 6 +- doc/src/sgml/ref/pg_dumpall.sgml | 6 +- doc/src/sgml/ref/pg_restore.sgml | 6 +- doc/src/sgml/ref/pgtclsh.sgml | 6 +- doc/src/sgml/ref/pgtksh.sgml | 6 +- doc/src/sgml/ref/postgres-ref.sgml | 6 +- doc/src/sgml/ref/postmaster.sgml | 6 +- doc/src/sgml/ref/prepare.sgml | 6 +- doc/src/sgml/ref/psql-ref.sgml | 6 +- doc/src/sgml/ref/reindex.sgml | 6 +- doc/src/sgml/ref/reset.sgml | 6 +- doc/src/sgml/ref/revoke.sgml | 6 +- doc/src/sgml/ref/rollback.sgml | 6 +- doc/src/sgml/ref/select.sgml | 6 +- doc/src/sgml/ref/select_into.sgml | 6 +- doc/src/sgml/ref/set.sgml | 6 +- doc/src/sgml/ref/set_constraints.sgml | 6 +- doc/src/sgml/ref/set_session_auth.sgml | 6 +- doc/src/sgml/ref/set_transaction.sgml | 6 +- doc/src/sgml/ref/show.sgml | 6 +- doc/src/sgml/ref/start_transaction.sgml | 6 +- doc/src/sgml/ref/truncate.sgml | 6 +- doc/src/sgml/ref/unlisten.sgml | 6 +- doc/src/sgml/ref/update.sgml | 6 +- doc/src/sgml/ref/vacuum.sgml | 6 +- doc/src/sgml/ref/vacuumdb.sgml | 6 +- doc/src/sgml/regress.sgml | 10 +- doc/src/sgml/rules.sgml | 66 +- doc/src/sgml/runtime.sgml | 93 +-- doc/src/sgml/spi.sgml | 4 +- doc/src/sgml/syntax.sgml | 145 ++-- doc/src/sgml/trigger.sgml | 37 +- doc/src/sgml/typeconv.sgml | 40 +- doc/src/sgml/user-manag.sgml | 50 +- doc/src/sgml/wal.sgml | 21 +- doc/src/sgml/xaggr.sgml | 8 +- doc/src/sgml/xfunc.sgml | 60 +- doc/src/sgml/xindex.sgml | 28 +- doc/src/sgml/xoper.sgml | 14 +- doc/src/sgml/xplang.sgml | 6 +- doc/src/sgml/xtypes.sgml | 18 +- 162 files changed, 2692 insertions(+), 1198 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml index d6d7881ef38..c26e15b6f02 100644 --- a/doc/src/sgml/advanced.sgml +++ b/doc/src/sgml/advanced.sgml @@ -1,5 +1,5 @@ @@ -142,7 +142,7 @@ ERROR: <unnamed> referential integrity violation - key referenced from we Transactions - transactions + transaction diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml index fa241d0e323..68c6dc40db0 100644 --- a/doc/src/sgml/array.sgml +++ b/doc/src/sgml/array.sgml @@ -1,10 +1,10 @@ - + Arrays - arrays + array diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 95679d8cce2..fc394219eb0 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -1,5 +1,5 @@ Backup and Restore @@ -285,13 +285,15 @@ pg_dump -Fc dbname > - For reasons of backward compatibility, pg_dump does - not dump large objects by default. To dump large objects you must use - either the custom or the TAR output format, and use the @@ -371,7 +373,15 @@ tar -cf backup.tar /usr/local/pgsql/data Migration between releases - upgrading + + + upgrading + + + + version + compatibility + As a general rule, the internal data storage format is subject to diff --git a/doc/src/sgml/charset.sgml b/doc/src/sgml/charset.sgml index fb9db34019c..13d74398eee 100644 --- a/doc/src/sgml/charset.sgml +++ b/doc/src/sgml/charset.sgml @@ -1,4 +1,4 @@ - + Localization</> @@ -197,7 +197,7 @@ initdb --locale=sv_SE <listitem> <para> Sort order in queries using <command>ORDER BY</> - <indexterm><primary>ORDER BY</></> + <indexterm><primary>ORDER BY</><secondary>and locales</></indexterm> </para> </listitem> diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml index 36b4a910613..2ad7a6a29fc 100644 --- a/doc/src/sgml/client-auth.sgml +++ b/doc/src/sgml/client-auth.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.55 2003/08/17 04:39:11 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.56 2003/08/31 17:32:18 petere Exp $ --> <chapter id="client-authentication"> @@ -576,6 +576,7 @@ local db1,db2,@demodbs all md5 </indexterm> <indexterm> <primary>password</primary> + <secondary>authentication</secondary> </indexterm> <para> @@ -865,6 +866,10 @@ omicron bryanh guest1 <sect2 id="auth-pam"> <title>PAM Authentication + + PAM + + This authentication method operates similarly to password except that it uses PAM (Pluggable diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index b8053f94e55..cb399f5ee85 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,17 +1,17 @@ Data Types - data types + data type - types - data types + type + data type @@ -279,68 +279,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t Numeric Types - data types + data type numeric - - integer - - - - smallint - - - - bigint - - - - int4 - integer - - - - int2 - smallint - - - - int8 - bigint - - - - numeric (data type) - - - - decimal - numeric - - - - real - - - - double precision - - - - float4 - real - - - - float8 - double precision - - - - floating point - - Numeric types consist of two-, four-, and eight-byte integers, four- and eight-byte floating-point numbers, and fixed-precision @@ -434,6 +376,33 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t Integer Types + + integer + + + + smallint + + + + bigint + + + + int4 + integer + + + + int2 + smallint + + + + int8 + bigint + + The types smallint, integer, and bigint store whole numbers, that is, numbers without @@ -495,6 +464,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t Arbitrary Precision Numbers + + numeric (data type) + + + + decimal + numeric + + The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is @@ -562,6 +540,28 @@ NUMERIC Floating-Point Types + + real + + + + double precision + + + + float4 + real + + + + float8 + double precision + + + + floating point + + The data types real and double precision are inexact, variable-precision numeric types. @@ -675,7 +675,7 @@ NUMERIC - sequences + sequence and serial type @@ -807,18 +807,33 @@ CREATE TABLE tablename ( Character Types - character strings + character string data types - strings - character strings + string + character string - + + character + + + + character varying + + + text - character strings + + + + char + + + + varchar @@ -1020,6 +1035,15 @@ SELECT b, char_length(b) FROM test2; Binary Data Types + + + binary data + + + + bytea + + The bytea data type allows storage of binary strings; see . @@ -1210,6 +1234,34 @@ SELECT b, char_length(b) FROM test2; Date/Time Types + + date + + + time + + + time without time zone + + + time with time zone + + + timestamp + + + timestamp with time zone + + + timestamp without time zone + + + interval + + + time span + + PostgreSQL supports the full set of SQL date and time types, shown in date - data type @@ -1461,15 +1512,12 @@ SELECT b, char_length(b) FROM test2; time - data type time without time zone - time time with time zone - data type @@ -1587,17 +1635,14 @@ SELECT b, char_length(b) FROM test2; timestamp - data type timestamp with time zone - data type timestamp without time zone - data type @@ -1797,13 +1842,13 @@ January 8 04:05:06 1999 PST date output format - Formatting + formatting time output format - Formatting + formatting @@ -1924,7 +1969,7 @@ January 8 04:05:06 1999 PST Time Zones - time zones + time zone @@ -2265,7 +2310,11 @@ SELECT * FROM test1 WHERE a; Line Segments - line + lseg + + + + line segment @@ -2293,6 +2342,10 @@ SELECT * FROM test1 WHERE a; box (data type) + + rectangle + + Boxes are represented by pairs of points that are opposite corners of the box. @@ -2431,7 +2484,7 @@ SELECT * FROM test1 WHERE a; network - addresses + data types @@ -2708,7 +2761,7 @@ SELECT * FROM test1 WHERE a; Bit String Types - bit strings + bit string data type @@ -3045,11 +3098,6 @@ SELECT * FROM test; - - record - Identifies a function returning an unspecified row type. - - any Indicates that a function accepts any input data type whatever. @@ -3058,23 +3106,24 @@ SELECT * FROM test; anyarray Indicates that a function accepts any array data type - (see ). + (see ). anyelement Indicates that a function accepts any data type - (see ). + (see ). - void - Indicates that a function returns no value. + cstring + Indicates that a function accepts or returns a null-terminated C string. - trigger - A trigger function is declared to return trigger. + internal + Indicates that a function accepts or returns a server-internal + data type. @@ -3083,14 +3132,18 @@ SELECT * FROM test; - cstring - Indicates that a function accepts or returns a null-terminated C string. + record + Identifies a function returning an unspecified row type. - internal - Indicates that a function accepts or returns a server-internal - data type. + trigger + A trigger function is declared to return trigger. + + + + void + Indicates that a function returns no value. diff --git a/doc/src/sgml/datetime.sgml b/doc/src/sgml/datetime.sgml index 9c8a4077f1b..38dd80c9b3b 100644 --- a/doc/src/sgml/datetime.sgml +++ b/doc/src/sgml/datetime.sgml @@ -1,5 +1,5 @@ @@ -364,7 +364,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.33 2003/08/25 23:30:25 tg - time zones + time zone + abbreviations diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index fc6cdc331c2..551ca05e9aa 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -1,4 +1,4 @@ - + Data Definition @@ -19,6 +19,18 @@ Table Basics + + table + + + + row + + + + column + + A table in a relational database is much like a table on paper: It consists of rows and columns. The number and order of the columns @@ -60,6 +72,11 @@ containing both date and time. + + table + creating + + To create a table, you use the aptly named CREATE TABLE command. In this command you specify at least a @@ -114,6 +131,11 @@ CREATE TABLE products ( highly unusual and often a questionable design. + + table + removing + + If you no longer need a table, you can remove it using the DROP TABLE command. For example: @@ -156,8 +178,8 @@ DROP TABLE products; - columns - system columns + column + system column @@ -167,6 +189,7 @@ DROP TABLE products; OID + column The object identifier (object ID) of a row. This is a serial number that is automatically added by @@ -182,6 +205,10 @@ DROP TABLE products; tableoid + + tableoid + + The OID of the table containing this row. This column is particularly handy for queries that select from inheritance @@ -197,6 +224,10 @@ DROP TABLE products; xmin + + xmin + + The identity (transaction ID) of the inserting transaction for this tuple. (Note: In this context, a tuple is an individual @@ -209,6 +240,10 @@ DROP TABLE products; cmin + + cmin + + The command identifier (starting at zero) within the inserting transaction. @@ -219,6 +254,10 @@ DROP TABLE products; xmax + + xmax + + The identity (transaction ID) of the deleting transaction, or zero for an undeleted tuple. It is possible for this column to @@ -232,6 +271,10 @@ DROP TABLE products; cmax + + cmax + + The command identifier within the deleting transaction, or zero. @@ -241,6 +284,10 @@ DROP TABLE products; ctid + + ctid + + The physical location of the tuple within its table. Note that although the ctid can be used to @@ -292,6 +339,10 @@ DROP TABLE products; Default Values + + default value + + A column can be assigned a default value. When a new row is created and no values are specified for some of the columns, the @@ -302,6 +353,7 @@ DROP TABLE products; + null valuedefault value If no default value is declared explicitly, the null value is the default value. This usually makes sense because a null value can be thought to represent unknown data. @@ -329,6 +381,10 @@ CREATE TABLE products ( Constraints + + constraint + + Data types are a way to limit the kind of data that can be stored in a table. For many applications, however, the constraint they @@ -351,6 +407,15 @@ CREATE TABLE products ( Check Constraints + + check constraint + + + + constraint + check + + A check constraint is the most generic constraint type. It allows you to specify that the value in a certain column must satisfy an @@ -375,6 +440,11 @@ CREATE TABLE products ( would not make too much sense. + + constraint + name + + You can also give the constraint a separate name. This clarifies error messages and allows you to refer to the constraint when you @@ -444,6 +514,11 @@ CREATE TABLE products ( It's a matter of taste. + + null value + with check constraints + + It should be noted that a check constraint is satisfied if the check expression evaluates to true or the null value. Since most @@ -457,6 +532,15 @@ CREATE TABLE products ( Not-Null Constraints + + not-null constraint + + + + constraint + NOT NULL + + A not-null constraint simply specifies that a column must not assume the null value. A syntax example: @@ -526,6 +610,15 @@ CREATE TABLE products ( Unique Constraints + + unique constraint + + + + constraint + unique + + Unique constraints ensure that the data contained in a column or a group of columns is unique with respect to all the rows in the @@ -573,6 +666,11 @@ CREATE TABLE products ( + + null value + with unique constraints + + In general, a unique constraint is violated when there are (at least) two rows in the table where the values of each of the @@ -591,6 +689,15 @@ CREATE TABLE products ( Primary Keys + + primary key + + + + constraint + primary key + + Technically, a primary key constraint is simply a combination of a unique constraint and a not-null constraint. So, the following @@ -649,6 +756,19 @@ CREATE TABLE example ( Foreign Keys + + foreign key + + + + constraint + foreign key + + + + referential integrity + + A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row @@ -749,6 +869,16 @@ CREATE TABLE order_items ( the last table. + + CASCADE + foreign key action + + + + RESTRICT + foreign key action + + We know that the foreign keys disallow creation of orders that do not relate to any products. But what if a product is removed @@ -998,6 +1128,11 @@ SET SQL_Inheritance TO OFF; Modifying Tables + + table + modifying + + When you create a table and you realize that you made a mistake, or the requirements of the application changed, then you can drop the @@ -1042,6 +1177,11 @@ SET SQL_Inheritance TO OFF; Adding a Column + + column + adding + + To add a column, use this command: @@ -1070,6 +1210,11 @@ ALTER TABLE products ADD COLUMN description text CHECK (description <> '') Removing a Column + + column + removing + + To remove a column, use this command: @@ -1081,6 +1226,11 @@ ALTER TABLE products DROP COLUMN description; Adding a Constraint + + constraint + adding + + To add a constraint, the table constraint syntax is used. For example: @@ -1104,6 +1254,11 @@ ALTER TABLE products ALTER COLUMN product_no SET NOT NULL; Removing a Constraint + + constraint + removing + + To remove a constraint you need to know its name. If you gave it a name then that's easy. Otherwise the system assigned a @@ -1127,6 +1282,11 @@ ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL; Changing the Default + + default value + changing + + To set a new default for a column, use a command like this: @@ -1146,6 +1306,11 @@ ALTER TABLE products ALTER COLUMN price DROP DEFAULT; Renaming a Column + + column + renaming + + To rename a column: @@ -1157,6 +1322,11 @@ ALTER TABLE products RENAME COLUMN product_no TO product_number; Renaming a Table + + table + renaming + + To rename a table: @@ -1169,6 +1339,15 @@ ALTER TABLE products RENAME TO items; Privileges + + privilege + + + + permission + privilege + + When you create a database object, you become its owner. By default, only the owner of an object can do anything with the @@ -1241,12 +1420,8 @@ REVOKE ALL ON accounts FROM PUBLIC; Schemas - - schemas - - - - namespaces + + schema @@ -1313,6 +1488,11 @@ REVOKE ALL ON accounts FROM PUBLIC; Creating a Schema + + schema + creating + + To create a separate schema, use the command CREATE SCHEMA. Give the schema a name of your choice. For @@ -1323,11 +1503,11 @@ CREATE SCHEMA myschema; - qualified names + qualified name - names + name qualified @@ -1359,6 +1539,11 @@ CREATE TABLE myschema.mytable ( the following chapters. + + schema + removing + + To drop a schema if it's empty (all objects in it have been dropped), use @@ -1394,6 +1579,11 @@ CREATE SCHEMA schemaname AUTHORIZATION u The Public Schema + + schema + public + + In the previous sections we created tables without specifying any schema names. By default, such tables (and other objects) are @@ -1417,11 +1607,11 @@ CREATE TABLE public.products ( ... ); - unqualified names + unqualified name - names + name unqualified @@ -1437,6 +1627,11 @@ CREATE TABLE public.products ( ... ); in other schemas in the database. + + schema + current + + The first schema named in the search path is called the current schema. Aside from being the first schema searched, it is also the schema in @@ -1444,6 +1639,10 @@ CREATE TABLE public.products ( ... ); command does not specify a schema name. + + search_path + + To show the current search path, use the following command: @@ -1523,6 +1722,11 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; Schemas and Privileges + + privilege + for schemas + + By default, users cannot see the objects in schemas they do not own. To allow that, the owner of the schema needs to grant the @@ -1550,9 +1754,14 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC; - + The System Catalog Schema + + system catalog + schema + + In addition to public and user-created schemas, each database contains a pg_catalog schema, which contains @@ -1701,6 +1910,16 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC; Dependency Tracking + + CASCADE + with DROP + + + + RESTRICT + with DROP + + When you create complex database structures involving many tables with foreign key constraints, views, triggers, functions, etc. you diff --git a/doc/src/sgml/dfunc.sgml b/doc/src/sgml/dfunc.sgml index 3898a2bc176..dc23aa951bf 100644 --- a/doc/src/sgml/dfunc.sgml +++ b/doc/src/sgml/dfunc.sgml @@ -1,5 +1,5 @@ @@ -8,9 +8,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter Before you are able to use your PostgreSQL extension functions written in - C, they must be compiled and linked in a special way to produce a file - that can be dynamically loaded by the server. To be - precise, a shared library needs to be created. + C, they must be compiled and linked in a special way to produce a + file that can be dynamically loaded by the server. To be precise, a + shared library needs to be + created.shared library + @@ -26,17 +28,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter - PIC - Creating shared libraries is generally analogous to linking - executables: first the source files are compiled into object files, - then the object files are linked together. The object files need to - be created as position-independent code - (PIC), which conceptually means that they can be - placed at an arbitrary location in memory when they are loaded by the - executable. (Object files intended for executables are usually not compiled - that way.) The command to link a shared library contains special - flags to distinguish it from linking an executable. --- At least - this is the theory. On some systems the practice is much uglier. + PIC Creating shared libraries is generally + analogous to linking executables: first the source files are + compiled into object files, then the object files are linked + together. The object files need to be created as + position-independent code + (PIC),PIC which + conceptually means that they can be placed at an arbitrary location + in memory when they are loaded by the executable. (Object files + intended for executables are usually not compiled that way.) The + command to link a shared library contains special flags to + distinguish it from linking an executable. --- At least this is the + theory. On some systems the practice is much uglier. @@ -57,7 +60,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter BSD/OS - BSD/OS + BSD/OSshared library The compiler flag to create PIC is @@ -75,7 +78,7 @@ ld -shared -o foo.so foo.o FreeBSD - FreeBSD + FreeBSDshared library The compiler flag to create PIC is @@ -93,7 +96,7 @@ gcc -shared -o foo.so foo.o HP-UX - HP-UX + HP-UXshared library The compiler flag of the system compiler to create @@ -120,7 +123,7 @@ ld -b -o foo.sl foo.o IRIX - IRIX + IRIXshared library PIC is the default, no special compiler @@ -136,7 +139,7 @@ ld -shared -o foo.so foo.o Linux - Linux + Linuxshared library The compiler flag to create PIC is @@ -155,7 +158,7 @@ cc -shared -o foo.so foo.o MacOS X - MacOS X + MacOS Xshared library Here is an example. It assumes the developer tools are installed. @@ -169,7 +172,7 @@ cc -bundle -flat_namespace -undefined suppress -o foo.so foo.o NetBSD - NetBSD + NetBSDshared library The compiler flag to create PIC is @@ -187,7 +190,7 @@ gcc -shared -o foo.so foo.o OpenBSD - OpenBSD + OpenBSDshared library The compiler flag to create PIC is @@ -203,7 +206,7 @@ ld -Bshareable -o foo.so foo.o Solaris - Solaris + Solarisshared library The compiler flag to create PIC is @@ -227,7 +230,7 @@ gcc -G -o foo.so foo.o Tru64 UNIX - Tru64 UNIX + Tru64 UNIXshared library Digital UNIXTru64 UNIX @@ -246,7 +249,7 @@ ld -shared -expect_unresolved '*' -o foo.so foo.o UnixWare - UnixWare + UnixWareshared library The compiler flag to create PIC is - quote_ident(string text) + quote_ident(string text)quote_ident text Return the given string suitably quoted to be used as an identifier @@ -1188,7 +1198,7 @@ PostgreSQL documentation - quote_literal(string text) + quote_literal(string text)quote_literal text Return the given string suitably quoted to be used as a string literal @@ -2055,6 +2065,11 @@ PostgreSQL documentation Binary String Functions and Operators + + binary data + functions + + This section describes functions and operators for examining and manipulating values of type bytea. @@ -2092,7 +2107,7 @@ PostgreSQL documentation String concatenation - binary strings + binary string concatenation @@ -2243,12 +2258,12 @@ PostgreSQL documentation Length of binary string - binary strings + binary string length length - binary strings + of a binary string binary strings, length @@ -2321,8 +2336,8 @@ PostgreSQL documentation <function>LIKE</function> - - like + + LIKE @@ -2420,12 +2435,12 @@ PostgreSQL documentation Regular Expressions - regular expressions + regular expression - similar to + SIMILAR TO @@ -2547,7 +2562,7 @@ substring('foobar' from '#"o_b#"%' for '#') NULLPOSIX Regular Expressions - regular expressions + regular expression pattern matching @@ -3794,6 +3809,10 @@ substring('foobar' from 'o(.)b') o formatting + + to_char + + The PostgreSQL formatting functions provide a powerful set of tools for converting various data types @@ -6004,7 +6023,7 @@ SELECT TIMESTAMP 'now'; Sequence-Manipulation Functions - sequences + sequence nextval @@ -6167,11 +6186,11 @@ SELECT setval('foo', 42, false); Next nextval wi Conditional Expressions - case + CASE - conditionals + conditional expression @@ -6292,8 +6311,12 @@ SELECT a, <literal>COALESCE</> + + COALESCE + + -COALESCE(value , ...) +coalesce(value , ...) @@ -6502,7 +6525,8 @@ SET search_path TO schema , schema, .. configuration - server + of the server + functions @@ -6539,6 +6563,11 @@ SELECT set_config('show_statement_stats', 'off', false); + + privilege + querying + + lists functions that allow the user to query object access privileges programmatically. @@ -6971,6 +7000,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); col_description + + comment + about database objects + + The function shown in extract comments @@ -7272,6 +7306,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); Aggregate Functions + + aggregate function + built-in + + Aggregate functions compute a single result value from a set of input values. average - function avg(expression) @@ -7482,31 +7520,31 @@ SELECT col FROM sometable ORDER BY col ASC LIMIT 1; Subquery Expressions - exists + EXISTS - in + IN - not in + NOT IN - any + ANY - all + ALL - some + SOME - subqueries + subquery @@ -7808,6 +7846,11 @@ SELECT col1 FROM tab1 Row-wise Comparison + + comparison + of rows + + (expression , expression ...) operator (subquery) diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml index 4e79084e7ec..50f934468ab 100644 --- a/doc/src/sgml/indices.sgml +++ b/doc/src/sgml/indices.sgml @@ -1,10 +1,10 @@ - + Indexes - indexes + index @@ -109,12 +109,12 @@ CREATE INDEX test1_id_index ON test1 (id); B-tree, R-tree, GiST, and Hash. Each index type is more appropriate for a particular query type because of the algorithm it uses. - indexes + index B-tree B-tree - indexes + index By default, the CREATE INDEX command will create a @@ -147,12 +147,12 @@ CREATE INDEX test1_id_index ON test1 (id); - indexes + index R-tree R-tree - indexes + index R-tree indexes are especially suited for spatial data. To create an R-tree index, use a command of the form @@ -178,12 +178,12 @@ CREATE INDEX name ON table - indexes + index hash hash - indexes + index The query planner will consider using a hash index whenever an indexed column is involved in a comparison using the @@ -219,7 +219,7 @@ CREATE INDEX name ON table Multicolumn Indexes - indexes + index multicolumn @@ -294,7 +294,7 @@ SELECT name FROM test2 WHERE major = constant OR mino Unique Indexes - indexes + index unique @@ -337,8 +337,8 @@ CREATE UNIQUE INDEX name ON tableIndexes on Expressions - indexes - on expressions + index + on expressions @@ -392,6 +392,10 @@ CREATE INDEX people_names ON people ((first_name || ' ' || last_name)); Operator Classes + + operator class + + An index definition may specify an operator class for each column of an index. @@ -492,7 +496,7 @@ SELECT am.amname AS index_method, Partial Indexes - indexes + index partial @@ -709,6 +713,11 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target) Examining Index Usage + + index + examining usage + + Although indexes in PostgreSQL do not need maintenance and tuning, it is still important to check diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 6f4f8486023..0c1926f949a 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -1,4 +1,4 @@ - + <![%standalone-include[<productname>PostgreSQL</>]]> @@ -383,6 +383,7 @@ JAVACMD=$JAVA_HOME/bin/java <para> <indexterm> <primary>pg_dumpall</primary> + <secondary>use during upgrade</secondary> </indexterm> To back up your database installation, type: @@ -875,8 +876,8 @@ JAVACMD=$JAVA_HOME/bin/java <term><option>--with-pam</option></term> <listitem> <para> - Build with <acronym>PAM</> (Pluggable Authentication Modules) - support. + Build with <acronym>PAM</><indexterm><primary>PAM</></> + (Pluggable Authentication Modules) support. </para> </listitem> </varlistentry> @@ -1163,7 +1164,7 @@ All of PostgreSQL is successfully made. Ready to install. <title>Shared Libraries - shared libraries + shared library @@ -1284,7 +1285,6 @@ set path = ( /usr/local/pgsql/bin $path ) MANPATH - man pages To enable your system to find the man documentation, you need to add lines like the following to a diff --git a/doc/src/sgml/jdbc.sgml b/doc/src/sgml/jdbc.sgml index a577398bbb4..ec79565fefa 100644 --- a/doc/src/sgml/jdbc.sgml +++ b/doc/src/sgml/jdbc.sgml @@ -1,10 +1,18 @@ <acronym>JDBC</acronym> Interface + + JDBC + + + + Java + + JDBC is a core API of Java 1.1 and later. It provides a standard set of @@ -66,6 +74,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.47 2003/08/07 05:06:40 Setting up the Class Path + + class path + + + + CLASSPATH + + To use the driver, the JAR archive (named postgresql.jar if you built from source, otherwise @@ -316,6 +332,18 @@ db.close(); Issuing a Query and Processing the Result + + Statement + + + + PreparedStatement + + + + ResultSet + + Any time you want to issue SQL statements to the database, you require a Statement or @@ -681,6 +709,16 @@ st.close(); Storing Binary Data + + bytea + in JDBC + + + + large object + in JDBC + + PostgreSQL provides two distinct ways to store binary data. Binary data can be stored in a table using @@ -2597,6 +2635,11 @@ public void unlink(int oid) throws SQLException Using the Driver in a Multithreaded or a Servlet Environment + + threads + with JDBC + + A problem with many JDBC drivers is that only one thread can use a Connection at any one @@ -2645,6 +2688,15 @@ public void unlink(int oid) throws SQLException Connection Pools and Data Sources + + connection pool + in JDBC + + + + DataSource + + JDBC 2 introduced standard connection pooling features in an add-on API known as the JDBC 2.0 Optional @@ -3029,7 +3081,11 @@ try { - Data Sources and <acronym>JNDI</acronym> + Data Sources and <acronym>JNDI</acronym> + + + JNDI + All the ConnectionPoolDataSource and diff --git a/doc/src/sgml/keywords.sgml b/doc/src/sgml/keywords.sgml index 26764553f87..d36cc9efb39 100644 --- a/doc/src/sgml/keywords.sgml +++ b/doc/src/sgml/keywords.sgml @@ -1,10 +1,10 @@ - + <acronym>SQL</acronym> Key Words - key words + key word list of diff --git a/doc/src/sgml/libpgtcl.sgml b/doc/src/sgml/libpgtcl.sgml index 220a7d42be2..afcc7061ede 100644 --- a/doc/src/sgml/libpgtcl.sgml +++ b/doc/src/sgml/libpgtcl.sgml @@ -125,8 +125,8 @@ The pg_lo_* commands are interfaces to the large object features of - PostgreSQL.Large - Object The functions are designed to mimic the analogous file + PostgreSQL.large + objectin pgctl The functions are designed to mimic the analogous file system functions in the standard Unix file system interface. The pg_lo_* commands should be used within a BEGIN/COMMIT transaction @@ -1043,12 +1043,12 @@ pg_listen conn notifyName PostgreSQL client application issues a - NOTIFYNOTIFYin - pgtcl command referencing that name. The command string is - executed from the Tcl idle loop. That is the normal idle state of - an application written with Tk. In non-Tk Tcl shells, you can - execute update or vwait - to cause the idle loop to be entered. + NOTIFYNOTIFYin pgtcl command referencing that name. The + command string is executed from the Tcl idle loop. That is the + normal idle state of an application written with Tk. In non-Tk Tcl + shells, you can execute update or + vwait to cause the idle loop to be entered. diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index b7d3584171e..debfa26b727 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -9,6 +9,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete libpq + + C + + libpq is the C application programmer's interface to @@ -31,9 +35,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete - Client programs that use libpq must include the - header file libpq-fe.h and must link with the - libpq library. + Client programs that use libpq must + include the header file + libpq-fe.hlibpq-fe.h + and must link with the libpq library. @@ -45,17 +50,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete application program can have several backend connections open at one time. (One reason to do that is to access more than one database.) Each connection is represented by a - PGconn object which is obtained from the function - PQconnectdb or PQsetdbLogin. Note that - these functions will always return a non-null object pointer, - unless perhaps there is too little memory even to allocate the - PGconn object. The PQstatus function - should be called to check whether a connection was successfully - made before queries are sent via the connection object. + PGconnPGconn object which + is obtained from the function PQconnectdb or + PQsetdbLogin. Note that these functions will always + return a non-null object pointer, unless perhaps there is too + little memory even to allocate the PGconn object. + The PQstatus function should be called to check + whether a connection was successfully made before queries are sent + via the connection object. - PQconnectdb + PQconnectdbPQconnectdb Makes a new connection to the database server. @@ -93,12 +99,13 @@ PGconn *PQconnectdb(const char *conninfo); host - Name of host to connect to. - If this begins with a slash, it specifies Unix-domain communication - rather than TCP/IP communication; the value is the name of the - directory in which the socket file is stored. - The default is to connect to a Unix-domain socket in - /tmp. + Name of host to connect to.host name + If this begins with a slash, it specifies Unix-domain + communication rather than TCP/IP communication; the value is the + name of the directory in which the socket file is stored. The + default is to connect to a Unix-domain socket in + /tmp.Unix domain + socket @@ -144,8 +151,9 @@ PGconn *PQconnectdb(const char *conninfo); port - Port number to connect to at the server host, - or socket file name extension for Unix-domain connections. + Port number to connect to at the server host, or socket file + name extension for Unix-domain + connections.port @@ -209,44 +217,51 @@ PGconn *PQconnectdb(const char *conninfo); sslmode - - This option determines whether or with what priority an SSL - connection will be negotiated with the server. There are four - modes: disable will attempt only an unencrypted - SSL connection; allow will negotiate, - trying first a non-SSL connection, then if that fails, - trying an SSL connection; prefer - (the default) will negotiate, trying first an SSL connection, - then if that fails, trying a regular non-SSL connection; - require will try only an SSL connection. - - - If PostgreSQL is compiled without SSL support, - using option require will cause an error, and options - allow and prefer will be tolerated but - libpq will be unable to negotiate an SSL - connection. - + + This option determines whether or with what priority an + SSL connection will be negotiated with the + server. There are four modes: disable will attempt + only an unencrypted SSL connection; + allow will negotiate, trying first a + non-SSL connection, then if that fails, trying an + SSL connection; prefer (the default) + will negotiate, trying first an SSL connection, + then if that fails, trying a regular non-SSL + connection; require will try only an + SSL connection. + + + + If PostgreSQL is compiled without SSL support, + using option require will cause an error, and + options allow and prefer will be + tolerated but libpq will be unable to negotiate + an SSL + connection.SSLwith libpq + requiressl - - This option is deprecated in favor of the sslmode - setting. - - - If set to 1, an SSL connection to the server is required - (this is equivalent to sslmode require). - libpq will then refuse to connect if the server does not - accept an SSL connection. - If set to 0 (default), libpq will negotiate the connection - type with the server (equivalent to sslmode prefer). - This option is only available if - PostgreSQL is compiled with SSL support. - + + This option is deprecated in favor of the sslmode + setting. + + + + If set to 1, an SSL connection to the server + is required (this is equivalent to sslmode + require). libpq will then refuse + to connect if the server does not accept an + SSL connection. If set to 0 (default), + libpq will negotiate the connection type with + the server (equivalent to sslmode + prefer). This option is only available if + PostgreSQL is compiled with SSL support. + @@ -274,7 +289,7 @@ PGconn *PQconnectdb(const char *conninfo); - PQsetdbLogin + PQsetdbLoginPQsetdbLogin Makes a new connection to the database server. @@ -299,7 +314,7 @@ PGconn *PQsetdbLogin(const char *pghost, - PQsetdb + PQsetdbPQsetdb Makes a new connection to the database server. @@ -321,8 +336,8 @@ PGconn *PQsetdb(char *pghost, - PQconnectStart - PQconnectPoll + PQconnectStartPQconnectStart + PQconnectPollPQconnectPoll nonblocking connection @@ -515,7 +530,7 @@ switch(PQstatus(conn)) - PQconndefaults + PQconndefaultsPQconndefaults Returns the default connection options. @@ -560,7 +575,7 @@ typedef struct - PQfinish + PQfinishPQfinish Closes the connection to the server. Also frees @@ -581,7 +596,7 @@ void PQfinish(PGconn *conn); - PQreset + PQresetPQreset Resets the communication channel to the server. @@ -601,8 +616,8 @@ void PQreset(PGconn *conn); - PQresetStart - PQresetPoll + PQresetStartPQresetStart + PQresetPollPQresetPoll Reset the communication channel to the server, in a nonblocking manner. @@ -665,7 +680,7 @@ These values are fixed for the life of the PGconn object. -PQdb +PQdbPQdb Returns the database name of the connection. @@ -677,7 +692,7 @@ char *PQdb(const PGconn *conn); -PQuser +PQuserPQuser Returns the user name of the connection. @@ -689,7 +704,7 @@ char *PQuser(const PGconn *conn); -PQpass +PQpassPQpass Returns the password of the connection. @@ -701,7 +716,7 @@ char *PQpass(const PGconn *conn); -PQhost +PQhostPQhost Returns the server host name of the connection. @@ -713,7 +728,7 @@ char *PQhost(const PGconn *conn); -PQport +PQportPQport Returns the port of the connection. @@ -725,13 +740,13 @@ char *PQport(const PGconn *conn); -PQtty +PQttyPQtty Returns the debug TTY of the connection. - (This is obsolete, since the server no longer pays attention - to the TTY setting, but the function remains - for backwards compatibility.) + (This is obsolete, since the server no longer pays attention + to the TTY setting, but the function remains + for backwards compatibility.) char *PQtty(const PGconn *conn); @@ -740,7 +755,7 @@ char *PQtty(const PGconn *conn); -PQoptions +PQoptionsPQoptions Returns the command-line options passed in the connection request. @@ -759,7 +774,7 @@ are executed on the PGconn object. -PQstatus +PQstatusPQstatus Returns the status of the connection. @@ -795,7 +810,7 @@ ConnStatusType PQstatus(const PGconn *conn); -PQtransactionStatus +PQtransactionStatusPQtransactionStatus Returns the current in-transaction status of the server. @@ -823,7 +838,7 @@ deprecated and does not exist in later server versions. -PQparameterStatus +PQparameterStatusPQparameterStatus Looks up a current parameter setting of the server. @@ -861,7 +876,7 @@ will not be reflected by PQparameterStatus.) -PQprotocolVersion +PQprotocolVersionPQprotocolVersion Interrogates the frontend/backend protocol being used. @@ -881,7 +896,7 @@ only protocol 2.0. (Protocol 1.0 is obsolete and not supported by libpq.) - PQerrorMessage + PQerrorMessagePQerrorMessage error message @@ -903,7 +918,7 @@ char *PQerrorMessage(const PGconn* conn); - PQsocket + PQsocketPQsocket Obtains the file descriptor number of the connection socket to @@ -919,11 +934,13 @@ int PQsocket(const PGconn *conn); - PQbackendPID + PQbackendPIDPQbackendPID - Returns the process ID of the backend server process - handling this connection. + Returns the process ID + (PID)PIDdetermining PID of + server processin libpq of the backend server + process handling this connection. int PQbackendPID(const PGconn *conn); @@ -941,10 +958,10 @@ int PQbackendPID(const PGconn *conn); - PQgetssl + PQgetsslPQgetssl - SSL + SSLin libpq Returns the SSL structure used in the connection, or null if SSL is not in use. @@ -985,7 +1002,7 @@ SQL queries and commands. -PQexec +PQexecPQexec Submits a command to the server @@ -1001,8 +1018,8 @@ PGresult *PQexec(PGconn *conn, const char *command); out-of-memory conditions or serious errors such as inability to send the command to the server. If a null pointer is returned, it - should be treated like a PGRES_FATAL_ERROR result. Use - PQerrorMessage to get more information about the error. + should be treated like a PGRES_FATAL_ERROR result. Use + PQerrorMessage to get more information about the error. @@ -1022,12 +1039,12 @@ condition. -PQexecParams +PQexecParamsPQexecParams Submits a command to the server and waits for the result, - with the ability to pass parameters separately from the SQL - command text. + with the ability to pass parameters separately from the SQL + command text. PGresult *PQexecParams(PGconn *conn, const char *command, @@ -1093,11 +1110,11 @@ but has some usefulness as an extra defense against SQL-injection attacks. -PQexecPrepared +PQexecPreparedPQexecPrepared Sends a request to execute a prepared statement with given - parameters, and waits for the result. + parameters, and waits for the result. PGresult *PQexecPrepared(PGconn *conn, const char *stmtName, @@ -1138,16 +1155,19 @@ future release. -The PGresult structure encapsulates the result -returned by the server. -libpq application programmers should be careful to -maintain the PGresult abstraction. Use the accessor functions below to get -at the contents of PGresult. Avoid directly referencing the fields of the -PGresult structure because they are subject to change in the future. +The +PGresultPGresult +structure encapsulates the result returned by the server. +libpq application programmers should be +careful to maintain the PGresult abstraction. +Use the accessor functions below to get at the contents of +PGresult. Avoid directly referencing the +fields of the PGresult structure because they +are subject to change in the future. -PQresultStatus +PQresultStatusPQresultStatus Returns the result status of the command. @@ -1238,11 +1258,11 @@ processor (see ). -PQresStatus +PQresStatusPQresStatus - Converts the enumerated type returned by PQresultStatus into - a string constant describing the status code. + Converts the enumerated type returned by PQresultStatus into + a string constant describing the status code. char *PQresStatus(ExecStatusType status); @@ -1251,7 +1271,7 @@ char *PQresStatus(ExecStatusType status); -PQresultErrorMessage +PQresultErrorMessagePQresultErrorMessage Returns the error message associated with the command, or an empty string @@ -1276,7 +1296,7 @@ when you want to know the status from the latest operation on the connection. -PQresultErrorField +PQresultErrorFieldPQresultErrorField Returns an individual field of an error report. @@ -1427,7 +1447,7 @@ Note that error fields are only available from -PQclear +PQclearPQclear Frees the storage associated with a PGresult. @@ -1449,7 +1469,7 @@ void PQclear(PQresult *res); -PQmakeEmptyPGresult +PQmakeEmptyPGresultPQmakeEmptyPGresult Constructs an empty PGresult object with the given status. @@ -1486,7 +1506,7 @@ values they will act as though the result has zero rows and zero columns. -PQntuples +PQntuplesPQntuples Returns the number of rows (tuples) @@ -1499,7 +1519,7 @@ int PQntuples(const PGresult *res); -PQnfields +PQnfieldsPQnfields Returns the number of columns (fields) @@ -1512,7 +1532,7 @@ int PQnfields(const PGresult *res); -PQfname +PQfnamePQfname Returns the column name associated with the given column number. @@ -1530,7 +1550,7 @@ NULL is returned if the column number is out of range. -PQfnumber +PQfnumberPQfnumber Returns the column number @@ -1548,7 +1568,7 @@ int PQfnumber(const PGresult *res, -PQftable +PQftablePQftable Returns the OID of the table from which the given column was fetched. @@ -1577,7 +1597,7 @@ exactly which table is referenced. -PQftablecol +PQftablecolPQftablecol Returns the column number (within its table) of the column making up @@ -1598,7 +1618,7 @@ or when using pre-3.0 protocol. -PQfformat +PQfformatPQfformat Returns the format code indicating the format of the given column. @@ -1618,7 +1638,7 @@ for future definition.) -PQftype +PQftypePQftype Returns the data type associated with the @@ -1641,7 +1661,7 @@ in the source tree. -PQfmod +PQfmodPQfmod Returns the type modifier of the column @@ -1663,7 +1683,7 @@ in which case the value is always -1. -PQfsize +PQfsizePQfsize Returns the size in bytes of the column @@ -1685,7 +1705,7 @@ A negative value indicates the data type is variable-length. -PQbinaryTuples +PQbinaryTuplesPQbinaryTuples Returns 1 if the PGresult contains binary data @@ -1707,11 +1727,11 @@ returns 1 only if all columns of the result are binary (format 1). -PQgetvalue +PQgetvaluePQgetvalue Returns a single field value of one row - of a PGresult. + of a PGresult. Row and column numbers start at 0. char* PQgetvalue(const PGresult *res, @@ -1747,8 +1767,8 @@ be used past the lifetime of the PGresult structure i -PQgetisnull - +PQgetisnullPQgetisnull +null valuein libpq Tests a field for a null value. Row and column numbers start at 0. @@ -1768,7 +1788,7 @@ will return an empty string, not a null pointer, for a null field.) -PQgetlength +PQgetlengthPQgetlength Returns the actual length of a field value in bytes. @@ -1791,7 +1811,7 @@ on PQfsize to obtain the actual data length. -PQprint +PQprintPQprint Prints out all the rows and, optionally, the @@ -1837,11 +1857,11 @@ results. -PQcmdStatus +PQcmdStatusPQcmdStatus Returns the command status tag from the SQL command that - generated the PGresult. + generated the PGresult. char * PQcmdStatus(PGresult *res); @@ -1854,10 +1874,10 @@ data such as the number of rows processed. -PQcmdTuples +PQcmdTuplesPQcmdTuples - Returns the number of rows affected by the SQL command. + Returns the number of rows affected by the SQL command. char * PQcmdTuples(PGresult *res); @@ -1865,23 +1885,25 @@ char * PQcmdTuples(PGresult *res); If the SQL command that generated the - PGresult was INSERT, - UPDATE, DELETE, MOVE, - or FETCH, this returns a - string containing the number of rows affected. If the + PGresult was INSERT, + UPDATE, DELETE, MOVE, + or FETCH, this returns a + string containing the number of rows affected. If the command was anything else, it returns the empty string. -PQoidValue +PQoidValuePQoidValue - Returns the OID of the inserted row, if the - SQL command was an INSERT - that inserted exactly one row into a table that has OIDs. - Otherwise, returns InvalidOid. + Returns the OIDOIDin + libpq of the inserted row, if the + SQL command was an + INSERT that inserted exactly one row into + a table that has OIDs. Otherwise, returns + InvalidOid. Oid PQoidValue(const PGresult *res); @@ -1890,7 +1912,7 @@ Oid PQoidValue(const PGresult *res); -PQoidStatus +PQoidStatusPQoidStatus Returns a string with the OID of the inserted row, if the @@ -1918,6 +1940,7 @@ It is not thread-safe. Escaping Strings for Inclusion in SQL Commands + PQescapeString escaping strings @@ -1976,13 +1999,15 @@ strings overlap. Escaping Binary Strings for Inclusion in SQL Commands + - escaping binary strings + bytea + in libpq - PQescapeBytea + PQescapeByteaPQescapeBytea Escapes binary data for use within an SQL command with the type @@ -2034,7 +2059,7 @@ unsigned char *PQescapeBytea(const unsigned char *from, - PQunescapeBytea + PQunescapeByteaPQunescapeBytea Converts an escaped string representation of binary data into binary @@ -2061,7 +2086,7 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length); - PQfreemem + PQfreememPQfreemem Frees memory allocated by libpq. @@ -2134,32 +2159,32 @@ respectively. -PQsendQuery +PQsendQueryPQsendQuery Submits a command to the server without - waiting for the result(s). 1 is returned if the command was - successfully dispatched and 0 if not (in which case, use - PQerrorMessage to get more information about the failure). + waiting for the result(s). 1 is returned if the command was + successfully dispatched and 0 if not (in which case, use + PQerrorMessage to get more information about the failure). int PQsendQuery(PGconn *conn, const char *command); - After successfully calling PQsendQuery, call + After successfully calling PQsendQuery, call PQgetResult one or more - times to obtain the results. PQsendQuery may not be called - again (on the same connection) until PQgetResult has returned a null pointer, - indicating that the command is done. + times to obtain the results. PQsendQuery may not be called + again (on the same connection) until PQgetResult has returned a null pointer, + indicating that the command is done. -PQsendQueryParams +PQsendQueryParamsPQsendQueryParams Submits a command and separate parameters to the server without - waiting for the result(s). + waiting for the result(s). int PQsendQueryParams(PGconn *conn, const char *command, @@ -2171,22 +2196,22 @@ int PQsendQueryParams(PGconn *conn, int resultFormat); - This is equivalent to PQsendQuery except that - query parameters can be specified separately from the query string. - The function's parameters are handled identically to - PQexecParams. Like - PQexecParams, it will not work on 2.0-protocol - connections, and it allows only one command in the query string. + This is equivalent to PQsendQuery except that + query parameters can be specified separately from the query string. + The function's parameters are handled identically to + PQexecParams. Like + PQexecParams, it will not work on 2.0-protocol + connections, and it allows only one command in the query string. -PQsendQueryPrepared +PQsendQueryPreparedPQsendQueryPrepared Sends a request to execute a prepared statement with given - parameters, without waiting for the result(s). + parameters, without waiting for the result(s). int PQsendQueryPrepared(PGconn *conn, const char *stmtName, @@ -2197,41 +2222,41 @@ int PQsendQueryPrepared(PGconn *conn, int resultFormat); - This is similar to PQsendQueryParams, but the - command to be executed is specified by naming a previously-prepared - statement, instead of giving a query string. - The function's parameters are handled identically to - PQexecPrepared. Like - PQexecPrepared, it will not work on 2.0-protocol - connections. + This is similar to PQsendQueryParams, but the + command to be executed is specified by naming a previously-prepared + statement, instead of giving a query string. + The function's parameters are handled identically to + PQexecPrepared. Like + PQexecPrepared, it will not work on 2.0-protocol + connections. -PQgetResult +PQgetResultPQgetResult Waits for the next result from a prior - PQsendQuery, - PQsendQueryParams, or - PQsendQueryPrepared call, - and returns it. A null pointer is returned when the command is complete - and there will be no more results. + PQsendQuery, + PQsendQueryParams, or + PQsendQueryPrepared call, + and returns it. A null pointer is returned when the command is complete + and there will be no more results. PGresult *PQgetResult(PGconn *conn); - PQgetResult must be called repeatedly until it returns a null pointer, - indicating that the command is done. (If called when no command is - active, PQgetResult will just return a null pointer at once.) - Each non-null result from PQgetResult should be processed using - the same PGresult accessor functions previously described. - Don't forget to free each result object with PQclear when done with it. - Note that PQgetResult will block only if a command is active and the - necessary response data has not yet been read by PQconsumeInput. + PQgetResult must be called repeatedly until it returns a null pointer, + indicating that the command is done. (If called when no command is + active, PQgetResult will just return a null pointer at once.) + Each non-null result from PQgetResult should be processed using + the same PGresult accessor functions previously described. + Don't forget to free each result object with PQclear when done with it. + Note that PQgetResult will block only if a command is active and the + necessary response data has not yet been read by PQconsumeInput. @@ -2252,10 +2277,10 @@ more functions: -PQconsumeInput +PQconsumeInputPQconsumeInput - If input is available from the server, consume it. + If input is available from the server, consume it. int PQconsumeInput(PGconn *conn); @@ -2283,7 +2308,7 @@ application can thus use PQconsumeInput to clear the -PQisBusy +PQisBusyPQisBusy Returns 1 if a command is busy, that is, PQgetResult would block @@ -2319,16 +2344,18 @@ if PQisBusy returns false (0). It can also call -A client that uses PQsendQuery/PQgetResult -can also attempt to cancel a command that is still being processed by the server. +A client that uses +PQsendQuery/PQgetResult can +also attempt to cancel a command that is still being processed by the +server.cancelingSQL command -PQrequestCancel +PQrequestCancelPQrequestCancel - Requests that the server abandon - processing of the current command. + Requests that the server abandon + processing of the current command. int PQrequestCancel(PGconn *conn); @@ -2377,7 +2404,7 @@ functions may be used. - PQsetnonblocking + PQsetnonblockingPQsetnonblocking Sets the nonblocking status of the connection. @@ -2407,7 +2434,7 @@ int PQsetnonblocking(PGconn *conn, int arg); -PQisnonblocking +PQisnonblockingPQisnonblocking Returns the blocking status of the database connection. @@ -2424,7 +2451,7 @@ int PQisnonblocking(const PGconn *conn); -PQflush +PQflushPQflush Attempts to flush any queued output data to the server. @@ -2453,6 +2480,8 @@ and then read the response as described above. The Fast-Path Interface +fast path + PostgreSQL provides a fast-path interface to send simple function calls to the server. @@ -2468,8 +2497,8 @@ parameters and results substitutes for a fast-path function call. -The function PQfn requests execution of a server -function via the fast-path interface: +The function PQfnPQfn +requests execution of a server function via the fast-path interface: PGresult* PQfn(PGconn* conn, int fnid, @@ -2535,7 +2564,10 @@ set-valued results when using this interface. Asynchronous Notification - NOTIFY + + NOTIFY + in libpq + PostgreSQL offers asynchronous notification via the @@ -2551,9 +2583,11 @@ not necessary for there to be any associated table. -libpq applications submit LISTEN and UNLISTEN -commands as ordinary SQL commands. The arrival of NOTIFY -messages can subsequently be detected by calling PQnotifies. +libpq applications submit +LISTEN and UNLISTEN commands as +ordinary SQL commands. The arrival of NOTIFY +messages can subsequently be detected by calling +PQnotifies.PQnotifies @@ -2561,8 +2595,8 @@ The function PQnotifies returns the next notification from a list of unhandled notification messages received from the server. It returns a null pointer if there are no pending notifications. Once a notification is - returned from PQnotifies, it is considered handled and will be - removed from the list of notifications. + returned from PQnotifies, it is considered handled and will be + removed from the list of notifications. PGnotify* PQnotifies(PGconn *conn); @@ -2688,7 +2722,7 @@ if any notifications came in during the processing of the command. -PQnfields +PQnfieldsPQnfieldswith COPY Returns the number of columns (fields) to be copied. @@ -2697,30 +2731,30 @@ if any notifications came in during the processing of the command. -PQbinaryTuples +PQbinaryTuplesPQbinaryTupleswith COPY 0 indicates the overall copy format is textual (rows - separated by newlines, columns separated by separator - characters, etc). - 1 indicates the overall copy format is binary. - See - for more information. + separated by newlines, columns separated by separator + characters, etc). + 1 indicates the overall copy format is binary. + See + for more information. -PQfformat +PQfformatPQfformatwith COPY Returns the format code (0 for text, 1 for binary) associated - with each column of the copy operation. The per-column format - codes will always be zero when the overall copy format is textual, - but the binary format can support both text and binary columns. - (However, as of the current implementation of COPY, - only binary columns appear in a binary copy; so the per-column - formats always match the overall format at present.) + with each column of the copy operation. The per-column format + codes will always be zero when the overall copy format is textual, + but the binary format can support both text and binary columns. + (However, as of the current implementation of COPY, + only binary columns appear in a binary copy; so the per-column + formats always match the overall format at present.) @@ -2745,7 +2779,7 @@ When using protocol 2.0, all these functions will return 0. -PQputCopyData +PQputCopyDataPQputCopyData Sends data to the server during COPY_IN state. @@ -2776,7 +2810,7 @@ by the COPY command; see -PQputCopyEnd +PQputCopyEndPQputCopyEnd Sends end-of-data indication to the server during COPY_IN state. @@ -2828,7 +2862,7 @@ operation. -PQgetCopyData +PQgetCopyDataPQgetCopyData Receives data from the server during COPY_OUT state. @@ -2897,7 +2931,7 @@ operation. -PQgetline +PQgetlinePQgetline Reads a newline-terminated line of characters @@ -2933,7 +2967,7 @@ for a terminator line). -PQgetlineAsync +PQgetlineAsyncPQgetlineAsync Reads a row of COPY data @@ -2985,7 +3019,7 @@ than the room actually available.) -PQputline +PQputlinePQputline Sends a null-terminated string to the server. @@ -3019,7 +3053,7 @@ having sent the actual data. -PQputnbytes +PQputnbytesPQputnbytes Sends a non-null-terminated string to the server. @@ -3040,7 +3074,7 @@ specified directly. Use this procedure when sending binary data. -PQendcopy +PQendcopyPQendcopy Synchronizes with the server. @@ -3099,7 +3133,7 @@ These functions control miscellaneous details of -PQsetErrorVerbosity +PQsetErrorVerbosityPQsetErrorVerbosity Determines the verbosity of messages returned by @@ -3125,7 +3159,7 @@ ones. -PQtrace +PQtracePQtrace Enables tracing of the client/server communication to a debugging file stream. @@ -3137,7 +3171,7 @@ void PQtrace(PGconn *conn, FILE *stream); -PQuntrace +PQuntracePQuntrace Disables tracing started by PQtrace. @@ -3154,6 +3188,11 @@ void PQuntrace(PGconn *conn); Notice Processing + + notice processing + in libpq + + Notice and warning messages generated by the server are not returned by the query execution functions, since they do not imply failure of the query. @@ -3174,10 +3213,10 @@ work in the notice receiver. The function PQsetNoticeReceiver -notice receiver +notice receiverPQsetNoticeReceiver sets or examines the current notice receiver for a connection object. Similarly, PQsetNoticeProcessor -notice processor +notice processorPQsetNoticeProcessor sets or examines the current notice processor. @@ -3255,7 +3294,7 @@ functions like PQgetvalue. Environment Variables - environment variables + environment variable @@ -3544,11 +3583,12 @@ call fe_setauthsvc at all. -libpq applications that use the crypt -authentication method rely on the crypt() operating -system function, which is often not thread-safe. It is better to use the -md5 method, which is thread-safe on all -platforms. +libpq applications that use the +crypt authentication method rely on the +crypt() operating system function, which is often +not thread-safe.cryptthread +safety It is better to use the md5 method, +which is thread-safe on all platforms. @@ -3556,6 +3596,11 @@ platforms. Building <application>libpq</application> Programs + + compiling + libpq applications + + To build (i.e., compile and link) your libpq programs you need to do all of the following things: @@ -3600,12 +3645,12 @@ CPPFLAGS += -I/usr/local/pgsql/include - pg_config If there is any chance that your program might be compiled by other users then you should not hardcode the directory location like that. Instead, you can run the utility - pg_config to find out where the header files - are on the local system: + pg_configpg_configwith libpq to find out where the header + files are on the local system: $ pg_config --includedir /usr/local/include @@ -3694,7 +3739,7 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage' /* * testlibpq.c * - * Test the C version of LIBPQ, the POSTGRES frontend library. + * Test the C version of LIBPQ, the POSTGRES frontend library. */ #include <stdio.h> #include <stdlib.h> @@ -3703,112 +3748,112 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage' static void exit_nicely(PGconn *conn) { - PQfinish(conn); - exit(1); + PQfinish(conn); + exit(1); } int main(int argc, char **argv) { - const char *conninfo; - PGconn *conn; - PGresult *res; - int nFields; - int i, - j; - - /* - * If the user supplies a parameter on the command line, use it as - * the conninfo string; otherwise default to setting dbname=template1 - * and using environment variables or defaults for all other connection - * parameters. - */ - if (argc > 1) - conninfo = argv[1]; - else - conninfo = "dbname = template1"; - - /* Make a connection to the database */ - conn = PQconnectdb(conninfo); - - /* Check to see that the backend connection was successfully made */ - if (PQstatus(conn) != CONNECTION_OK) - { - fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); - fprintf(stderr, "%s", PQerrorMessage(conn)); - exit_nicely(conn); - } - - /* - * Our test case here involves using a cursor, for which we must be - * inside a transaction block. We could do the whole thing with a - * single PQexec() of "select * from pg_database", but that's too - * trivial to make a good example. - */ - - /* Start a transaction block */ - res = PQexec(conn, "BEGIN"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn)); - PQclear(res); - exit_nicely(conn); - } - - /* - * Should PQclear PGresult whenever it is no longer needed to avoid - * memory leaks - */ - PQclear(res); - - /* - * Fetch rows from pg_database, the system catalog of databases - */ - res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn)); - PQclear(res); - exit_nicely(conn); - } - PQclear(res); - - res = PQexec(conn, "FETCH ALL in myportal"); - if (PQresultStatus(res) != PGRES_TUPLES_OK) - { - fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn)); - PQclear(res); - exit_nicely(conn); - } - - /* first, print out the attribute names */ - nFields = PQnfields(res); - for (i = 0; i < nFields; i++) - printf("%-15s", PQfname(res, i)); - printf("\n\n"); - - /* next, print out the rows */ - for (i = 0; i < PQntuples(res); i++) - { - for (j = 0; j < nFields; j++) - printf("%-15s", PQgetvalue(res, i, j)); - printf("\n"); - } - - PQclear(res); - - /* close the portal ... we don't bother to check for errors ... */ - res = PQexec(conn, "CLOSE myportal"); - PQclear(res); - - /* end the transaction */ - res = PQexec(conn, "END"); - PQclear(res); - - /* close the connection to the database and cleanup */ - PQfinish(conn); - - return 0; + const char *conninfo; + PGconn *conn; + PGresult *res; + int nFields; + int i, + j; + + /* + * If the user supplies a parameter on the command line, use it as + * the conninfo string; otherwise default to setting dbname=template1 + * and using environment variables or defaults for all other connection + * parameters. + */ + if (argc > 1) + conninfo = argv[1]; + else + conninfo = "dbname = template1"; + + /* Make a connection to the database */ + conn = PQconnectdb(conninfo); + + /* Check to see that the backend connection was successfully made */ + if (PQstatus(conn) != CONNECTION_OK) + { + fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); + fprintf(stderr, "%s", PQerrorMessage(conn)); + exit_nicely(conn); + } + + /* + * Our test case here involves using a cursor, for which we must be + * inside a transaction block. We could do the whole thing with a + * single PQexec() of "select * from pg_database", but that's too + * trivial to make a good example. + */ + + /* Start a transaction block */ + res = PQexec(conn, "BEGIN"); + if (PQresultStatus(res) != PGRES_COMMAND_OK) + { + fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn)); + PQclear(res); + exit_nicely(conn); + } + + /* + * Should PQclear PGresult whenever it is no longer needed to avoid + * memory leaks + */ + PQclear(res); + + /* + * Fetch rows from pg_database, the system catalog of databases + */ + res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database"); + if (PQresultStatus(res) != PGRES_COMMAND_OK) + { + fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn)); + PQclear(res); + exit_nicely(conn); + } + PQclear(res); + + res = PQexec(conn, "FETCH ALL in myportal"); + if (PQresultStatus(res) != PGRES_TUPLES_OK) + { + fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn)); + PQclear(res); + exit_nicely(conn); + } + + /* first, print out the attribute names */ + nFields = PQnfields(res); + for (i = 0; i < nFields; i++) + printf("%-15s", PQfname(res, i)); + printf("\n\n"); + + /* next, print out the rows */ + for (i = 0; i < PQntuples(res); i++) + { + for (j = 0; j < nFields; j++) + printf("%-15s", PQgetvalue(res, i, j)); + printf("\n"); + } + + PQclear(res); + + /* close the portal ... we don't bother to check for errors ... */ + res = PQexec(conn, "CLOSE myportal"); + PQclear(res); + + /* end the transaction */ + res = PQexec(conn, "END"); + PQclear(res); + + /* close the connection to the database and cleanup */ + PQfinish(conn); + + return 0; } @@ -3819,7 +3864,7 @@ main(int argc, char **argv) /* * testlibpq2.c - * Test of the asynchronous notification interface + * Test of the asynchronous notification interface * * Start this program, then from psql in another window do * NOTIFY TBL2; @@ -3850,102 +3895,102 @@ main(int argc, char **argv) static void exit_nicely(PGconn *conn) { - PQfinish(conn); - exit(1); + PQfinish(conn); + exit(1); } int main(int argc, char **argv) { - const char *conninfo; - PGconn *conn; - PGresult *res; - PGnotify *notify; - int nnotifies; - - /* - * If the user supplies a parameter on the command line, use it as - * the conninfo string; otherwise default to setting dbname=template1 - * and using environment variables or defaults for all other connection - * parameters. - */ - if (argc > 1) - conninfo = argv[1]; - else - conninfo = "dbname = template1"; - - /* Make a connection to the database */ - conn = PQconnectdb(conninfo); - - /* Check to see that the backend connection was successfully made */ - if (PQstatus(conn) != CONNECTION_OK) - { - fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); - fprintf(stderr, "%s", PQerrorMessage(conn)); - exit_nicely(conn); - } - - /* - * Issue LISTEN command to enable notifications from the rule's NOTIFY. - */ - res = PQexec(conn, "LISTEN TBL2"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "LISTEN command failed: %s", PQerrorMessage(conn)); - PQclear(res); - exit_nicely(conn); - } - - /* - * should PQclear PGresult whenever it is no longer needed to avoid - * memory leaks - */ - PQclear(res); - - /* Quit after four notifies are received. */ - nnotifies = 0; - while (nnotifies < 4) - { - /* - * Sleep until something happens on the connection. We use select(2) - * to wait for input, but you could also use poll() or similar - * facilities. - */ - int sock; - fd_set input_mask; - - sock = PQsocket(conn); - - if (sock < 0) - break; /* shouldn't happen */ - - FD_ZERO(&input_mask); - FD_SET(sock, &input_mask); - - if (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) - { - fprintf(stderr, "select() failed: %s\n", strerror(errno)); - exit_nicely(conn); - } - - /* Now check for input */ - PQconsumeInput(conn); - while ((notify = PQnotifies(conn)) != NULL) - { - fprintf(stderr, - "ASYNC NOTIFY of '%s' received from backend pid %d\n", - notify->relname, notify->be_pid); - PQfreemem(notify); - nnotifies++; - } - } - - fprintf(stderr, "Done.\n"); - - /* close the connection to the database and cleanup */ - PQfinish(conn); - - return 0; + const char *conninfo; + PGconn *conn; + PGresult *res; + PGnotify *notify; + int nnotifies; + + /* + * If the user supplies a parameter on the command line, use it as + * the conninfo string; otherwise default to setting dbname=template1 + * and using environment variables or defaults for all other connection + * parameters. + */ + if (argc > 1) + conninfo = argv[1]; + else + conninfo = "dbname = template1"; + + /* Make a connection to the database */ + conn = PQconnectdb(conninfo); + + /* Check to see that the backend connection was successfully made */ + if (PQstatus(conn) != CONNECTION_OK) + { + fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); + fprintf(stderr, "%s", PQerrorMessage(conn)); + exit_nicely(conn); + } + + /* + * Issue LISTEN command to enable notifications from the rule's NOTIFY. + */ + res = PQexec(conn, "LISTEN TBL2"); + if (PQresultStatus(res) != PGRES_COMMAND_OK) + { + fprintf(stderr, "LISTEN command failed: %s", PQerrorMessage(conn)); + PQclear(res); + exit_nicely(conn); + } + + /* + * should PQclear PGresult whenever it is no longer needed to avoid + * memory leaks + */ + PQclear(res); + + /* Quit after four notifies are received. */ + nnotifies = 0; + while (nnotifies < 4) + { + /* + * Sleep until something happens on the connection. We use select(2) + * to wait for input, but you could also use poll() or similar + * facilities. + */ + int sock; + fd_set input_mask; + + sock = PQsocket(conn); + + if (sock < 0) + break; /* shouldn't happen */ + + FD_ZERO(&input_mask); + FD_SET(sock, &input_mask); + + if (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) + { + fprintf(stderr, "select() failed: %s\n", strerror(errno)); + exit_nicely(conn); + } + + /* Now check for input */ + PQconsumeInput(conn); + while ((notify = PQnotifies(conn)) != NULL) + { + fprintf(stderr, + "ASYNC NOTIFY of '%s' received from backend pid %d\n", + notify->relname, notify->be_pid); + PQfreemem(notify); + nnotifies++; + } + } + + fprintf(stderr, "Done.\n"); + + /* close the connection to the database and cleanup */ + PQfinish(conn); + + return 0; } @@ -3956,7 +4001,7 @@ main(int argc, char **argv) /* * testlibpq3.c - * Test out-of-line parameters and binary I/O. + * Test out-of-line parameters and binary I/O. * * Before running this, populate a database with the following commands * (provided in src/test/examples/testlibpq3.sql): @@ -3988,125 +4033,125 @@ main(int argc, char **argv) static void exit_nicely(PGconn *conn) { - PQfinish(conn); - exit(1); + PQfinish(conn); + exit(1); } int main(int argc, char **argv) { - const char *conninfo; - PGconn *conn; - PGresult *res; - const char *paramValues[1]; - int i, - j; - int i_fnum, - t_fnum, - b_fnum; - - /* - * If the user supplies a parameter on the command line, use it as - * the conninfo string; otherwise default to setting dbname=template1 - * and using environment variables or defaults for all other connection - * parameters. - */ - if (argc > 1) - conninfo = argv[1]; - else - conninfo = "dbname = template1"; - - /* Make a connection to the database */ - conn = PQconnectdb(conninfo); - - /* Check to see that the backend connection was successfully made */ - if (PQstatus(conn) != CONNECTION_OK) - { - fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); - fprintf(stderr, "%s", PQerrorMessage(conn)); - exit_nicely(conn); - } - - /* - * The point of this program is to illustrate use of PQexecParams() - * with out-of-line parameters, as well as binary transmission of - * results. By using out-of-line parameters we can avoid a lot of - * tedious mucking about with quoting and escaping. Notice how we - * don't have to do anything special with the quote mark in the - * parameter value. - */ - - /* Here is our out-of-line parameter value */ - paramValues[0] = "joe's place"; - - res = PQexecParams(conn, - "SELECT * FROM test1 WHERE t = $1", - 1, /* one param */ - NULL, /* let the backend deduce param type */ - paramValues, - NULL, /* don't need param lengths since text */ - NULL, /* default to all text params */ - 1); /* ask for binary results */ - - if (PQresultStatus(res) != PGRES_TUPLES_OK) - { - fprintf(stderr, "SELECT failed: %s", PQerrorMessage(conn)); - PQclear(res); - exit_nicely(conn); - } - - /* Use PQfnumber to avoid assumptions about field order in result */ - i_fnum = PQfnumber(res, "i"); - t_fnum = PQfnumber(res, "t"); - b_fnum = PQfnumber(res, "b"); - - for (i = 0; i < PQntuples(res); i++) - { - char *iptr; - char *tptr; - char *bptr; - int blen; - int ival; - - /* Get the field values (we ignore possibility they are null!) */ - iptr = PQgetvalue(res, i, i_fnum); - tptr = PQgetvalue(res, i, t_fnum); - bptr = PQgetvalue(res, i, b_fnum); - - /* - * The binary representation of INT4 is in network byte order, - * which we'd better coerce to the local byte order. - */ - ival = ntohl(*((uint32_t *) iptr)); - - /* - * The binary representation of TEXT is, well, text, and since - * libpq was nice enough to append a zero byte to it, it'll work - * just fine as a C string. - * - * The binary representation of BYTEA is a bunch of bytes, which - * could include embedded nulls so we have to pay attention to - * field length. - */ - blen = PQgetlength(res, i, b_fnum); - - printf("tuple %d: got\n", i); - printf(" i = (%d bytes) %d\n", - PQgetlength(res, i, i_fnum), ival); - printf(" t = (%d bytes) '%s'\n", - PQgetlength(res, i, t_fnum), tptr); - printf(" b = (%d bytes) ", blen); - for (j = 0; j < blen; j++) - printf("\\%03o", bptr[j]); - printf("\n\n"); - } - - PQclear(res); - - /* close the connection to the database and cleanup */ - PQfinish(conn); - - return 0; + const char *conninfo; + PGconn *conn; + PGresult *res; + const char *paramValues[1]; + int i, + j; + int i_fnum, + t_fnum, + b_fnum; + + /* + * If the user supplies a parameter on the command line, use it as + * the conninfo string; otherwise default to setting dbname=template1 + * and using environment variables or defaults for all other connection + * parameters. + */ + if (argc > 1) + conninfo = argv[1]; + else + conninfo = "dbname = template1"; + + /* Make a connection to the database */ + conn = PQconnectdb(conninfo); + + /* Check to see that the backend connection was successfully made */ + if (PQstatus(conn) != CONNECTION_OK) + { + fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); + fprintf(stderr, "%s", PQerrorMessage(conn)); + exit_nicely(conn); + } + + /* + * The point of this program is to illustrate use of PQexecParams() + * with out-of-line parameters, as well as binary transmission of + * results. By using out-of-line parameters we can avoid a lot of + * tedious mucking about with quoting and escaping. Notice how we + * don't have to do anything special with the quote mark in the + * parameter value. + */ + + /* Here is our out-of-line parameter value */ + paramValues[0] = "joe's place"; + + res = PQexecParams(conn, + "SELECT * FROM test1 WHERE t = $1", + 1, /* one param */ + NULL, /* let the backend deduce param type */ + paramValues, + NULL, /* don't need param lengths since text */ + NULL, /* default to all text params */ + 1); /* ask for binary results */ + + if (PQresultStatus(res) != PGRES_TUPLES_OK) + { + fprintf(stderr, "SELECT failed: %s", PQerrorMessage(conn)); + PQclear(res); + exit_nicely(conn); + } + + /* Use PQfnumber to avoid assumptions about field order in result */ + i_fnum = PQfnumber(res, "i"); + t_fnum = PQfnumber(res, "t"); + b_fnum = PQfnumber(res, "b"); + + for (i = 0; i < PQntuples(res); i++) + { + char *iptr; + char *tptr; + char *bptr; + int blen; + int ival; + + /* Get the field values (we ignore possibility they are null!) */ + iptr = PQgetvalue(res, i, i_fnum); + tptr = PQgetvalue(res, i, t_fnum); + bptr = PQgetvalue(res, i, b_fnum); + + /* + * The binary representation of INT4 is in network byte order, + * which we'd better coerce to the local byte order. + */ + ival = ntohl(*((uint32_t *) iptr)); + + /* + * The binary representation of TEXT is, well, text, and since + * libpq was nice enough to append a zero byte to it, it'll work + * just fine as a C string. + * + * The binary representation of BYTEA is a bunch of bytes, which + * could include embedded nulls so we have to pay attention to + * field length. + */ + blen = PQgetlength(res, i, b_fnum); + + printf("tuple %d: got\n", i); + printf(" i = (%d bytes) %d\n", + PQgetlength(res, i, i_fnum), ival); + printf(" t = (%d bytes) '%s'\n", + PQgetlength(res, i, t_fnum), tptr); + printf(" b = (%d bytes) ", blen); + for (j = 0; j < blen; j++) + printf("\\%03o", bptr[j]); + printf("\n\n"); + } + + PQclear(res); + + /* close the connection to the database and cleanup */ + PQfinish(conn); + + return 0; } diff --git a/doc/src/sgml/lobj.sgml b/doc/src/sgml/lobj.sgml index 019c715c25f..474cde427eb 100644 --- a/doc/src/sgml/lobj.sgml +++ b/doc/src/sgml/lobj.sgml @@ -1,5 +1,5 @@ @@ -113,6 +113,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.29 2003/06/21 21:51:33 tgl Ex Oid lo_creat(PGconn *conn, int mode); + lo_creat creates a new large object. mode is a bit mask describing several different attributes of the new @@ -143,7 +144,8 @@ inv_oid = lo_creat(INV_READ|INV_WRITE); Oid lo_import(PGconn *conn, const char *filename); - filename + lo_import + filename specifies the operating system name of the file to be imported as a large object. The return value is the OID that was assigned to the new large object. @@ -159,6 +161,7 @@ Oid lo_import(PGconn *conn, const char *filename); int lo_export(PGconn *conn, Oid lobjId, const char *filename); + lo_export The lobjId argument specifies the OID of the large object to export and the filename argument specifies the operating system name name of the file. @@ -173,6 +176,7 @@ int lo_export(PGconn *conn, Oid lobjId, const char *filename); int lo_open(PGconn *conn, Oid lobjId, int mode); + lo_open The lobjId argument specifies the OID of the large object to open. The mode bits control whether the object is opened for reading (INV_READ), writing (INV_WRITE), or @@ -194,10 +198,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode); int lo_write(PGconn *conn, int fd, const char *buf, size_t len); - writes len bytes from buf to large object fd. The fd - argument must have been returned by a previous lo_open. - The number of bytes actually written is returned. In - the event of an error, the return value is negative. + lo_write writes + len bytes from buf + to large object fd. The fd + argument must have been returned by a previous + lo_open. The number of bytes actually + written is returned. In the event of an error, the return value + is negative. @@ -209,10 +216,13 @@ int lo_write(PGconn *conn, int fd, const char *buf, size_t len); int lo_read(PGconn *conn, int fd, char *buf, size_t len); - reads len bytes from large object fd into buf. The fd - argument must have been returned by a previous lo_open. - The number of bytes actually read is returned. In - the event of an error, the return value is negative. + lo_read reads + len bytes from large object + fd into buf. The + fd argument must have been returned by a + previous lo_open. The number of bytes + actually read is returned. In the event of an error, the return + value is negative. @@ -225,10 +235,14 @@ int lo_read(PGconn *conn, int fd, char *buf, size_t len); int lo_lseek(PGconn *conn, int fd, int offset, int whence); - This function moves the current location pointer for the - large object described by fd to the new location specified - by offset. The valid values for whence are - SEEK_SET (seek from object start), SEEK_CUR (seek from current position), and SEEK_END (seek from object end). The return value is the new location pointer. + lo_lseek This function moves the + current location pointer for the large object described by + fd to the new location specified by + offset. The valid values for whence + are SEEK_SET (seek from object start), + SEEK_CUR (seek from current position), and + SEEK_END (seek from object end). The return value is + the new location pointer. @@ -241,7 +255,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence); int lo_tell(PGconn *conn, int fd); - If there is an error, the return value is negative. + lo_tell If there is an error, the + return value is negative. @@ -253,9 +268,10 @@ int lo_tell(PGconn *conn, int fd); int lo_close(PGconn *conn, int fd); - where fd is a large object descriptor returned by - lo_open. On success, lo_close - returns zero. On error, the return value is negative. + lo_close where fd is a + large object descriptor returned by lo_open. + On success, lo_close returns zero. On + error, the return value is negative. @@ -272,8 +288,10 @@ int lo_close(PGconn *conn, int fd); int lo_unlink(PGconn *conn, Oid lobjId); - The lobjId argument specifies the OID of the large - object to remove. In the event of an error, the return value is negative. + lo_unlink The + lobjId argument specifies the OID of the + large object to remove. In the event of an error, the return + value is negative. @@ -284,11 +302,13 @@ int lo_unlink(PGconn *conn, Oid lobjId); Server-side Functions - There are two built-in server-side functions, lo_import - and lo_export, for large object access, which are available for use - in SQL - commands. - Here is an example of their use: + There are two built-in server-side functions, + lo_importlo_import + and + lo_export,lo_export + for large object access, which are available for use in + SQL commands. Here is an example of their + use: CREATE TABLE image ( name text, diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 122137ad2b9..dfa2e259ffc 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -1,10 +1,14 @@ Routine Database Maintenance Tasks + + maintenance + + There are a few routine maintenance chores that must be performed on a regular basis to keep a PostgreSQL @@ -158,6 +162,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.23 2003/06/18 12:19:11 Updating planner statistics + + statistics + of the planner + + + + ANALYZE + + The PostgreSQL query planner relies on statistical information about the contents of tables in order to @@ -396,7 +409,8 @@ VACUUM Log File Maintenance - log files + server log + log file maintenance diff --git a/doc/src/sgml/manage-ag.sgml b/doc/src/sgml/manage-ag.sgml index dd0b390230c..1521eb4ca4c 100644 --- a/doc/src/sgml/manage-ag.sgml +++ b/doc/src/sgml/manage-ag.sgml @@ -1,5 +1,5 @@ @@ -19,6 +19,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p Overview + + schema + + A database is a named collection of SQL objects (database objects). Generally, every database @@ -70,8 +74,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p - Databases are created with the SQL command - CREATE DATABASE: + Databases are created with the SQL command CREATE + DATABASE:CREATE DATABASE CREATE DATABASE name; @@ -93,9 +97,10 @@ CREATE DATABASE name; question remains how the first database at any given site can be created. The first database is always created by the initdb command when the data storage area is - initialized. (See .) - This database is called template1. So to create the - first real database you can connect to + initialized. (See .) This + database is called + template1.template1 So to + create the first real database you can connect to template1. @@ -112,7 +117,7 @@ CREATE DATABASE name; As an extra convenience, there is also a program that you can execute from the shell to create new databases, - createdb. + createdb.createdb createdb dbname @@ -157,31 +162,33 @@ createdb -O username dbname CREATE DATABASE actually works by copying an existing database. By default, it copies the standard system database named - template1. Thus that database is the template - from which new databases are made. If you add objects to - template1, these objects + template1.template1 Thus that + database is the template from which new databases are + made. If you add objects to template1, these objects will be copied into subsequently created user databases. This behavior allows site-local modifications to the standard set of objects in databases. For example, if you install the procedural language PL/pgSQL in template1, it will - automatically be available in user databases without any extra action - being taken when those databases are made. + automatically be available in user databases without any extra + action being taken when those databases are made. - There is a second standard system database named template0. - This database contains the same data as the initial contents of - template1, that is, only the standard objects predefined by - your version of PostgreSQL. - template0 should never be changed - after initdb. By instructing CREATE DATABASE to - copy template0 instead of template1, you can - create a virgin user database that contains none of the - site-local additions in template1. This is particularly - handy when restoring a pg_dump dump: the dump script should - be restored in a virgin database to ensure that one recreates the - correct contents of the dumped database, without any conflicts with - additions that may now be present in template1. + There is a second standard system database named + template0.template0 This + database contains the same data as the initial contents of + template1, that is, only the standard objects + predefined by your version of + PostgreSQL. template0 + should never be changed after initdb. By instructing + CREATE DATABASE to copy template0 instead + of template1, you can create a virgin user + database that contains none of the site-local additions in + template1. This is particularly handy when restoring a + pg_dump dump: the dump script should be restored in a + virgin database to ensure that one recreates the correct contents + of the dumped database, without any conflicts with additions that + may now be present in template1. @@ -214,7 +221,7 @@ createdb -T template0 dbname - Two useful flags exist in pg_database for each + Two useful flags exist in pg_databasepg_database for each database: the columns datistemplate and datallowconn. datistemplate may be set to indicate that a database is intended as a template for @@ -382,7 +389,8 @@ gmake CPPFLAGS=-DALLOW_ABSOLUTE_DBPATHS all Destroying a Database - Databases are destroyed with the command DROP DATABASE: + Databases are destroyed with the command DROP + DATABASE:DROP DATABASE DROP DATABASE name; @@ -403,7 +411,8 @@ DROP DATABASE name; - For convenience, there is also a shell program to drop databases: + For convenience, there is also a shell program to drop + databases:dropdb dropdb dbname diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 90a77d0a2c8..b4bead33472 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1,10 +1,20 @@ Monitoring Database Activity + + monitoring + database activity + + + + database activity + monitoring + + A database administrator frequently wonders, What is the system doing right now? @@ -589,6 +599,11 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid, Viewing Locks + + lock + monitoring + + Another useful tool for monitoring database activity is the pg_locks system table. It allows the diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml index b5cda133ef2..12833a36e32 100644 --- a/doc/src/sgml/mvcc.sgml +++ b/doc/src/sgml/mvcc.sgml @@ -1,5 +1,5 @@ @@ -22,6 +22,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere Introduction + + MVCC + + Unlike traditional database systems which use locks for concurrency control, PostgreSQL @@ -57,6 +61,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere Transaction Isolation + + transaction isolation + + The SQL standard defines four levels of transaction isolation in terms of three phenomena that must be @@ -108,7 +116,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere - isolation levels + transaction isolation level The four transaction isolation levels and the corresponding behaviors are described in . @@ -206,7 +214,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere Read Committed Isolation Level - isolation levels + transaction isolation level read committed @@ -292,7 +300,7 @@ COMMIT; Serializable Isolation Level - isolation levels + transaction isolation level serializable @@ -376,7 +384,7 @@ ERROR: Can't serialize access due to concurrent update Explicit Locking - locking + lock @@ -394,6 +402,10 @@ ERROR: Can't serialize access due to concurrent update Table-Level Locks + + LOCK + + The list below shows the available lock modes and the contexts in which they are used automatically by @@ -644,6 +656,10 @@ ERROR: Can't serialize access due to concurrent update Deadlocks + + deadlock + + The use of explicit locking can increase the likelyhood of deadlocks, wherein two (or more) transactions each @@ -813,6 +829,11 @@ UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 22222; Locking and Indexes + + index + locks + + Though PostgreSQL provides nonblocking read/write access to table diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index 0de183a01e0..1b8e442b0b0 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.30 2003/06/25 02:07:33 mom Using <command>EXPLAIN</command> + + EXPLAIN + + + + query plan + + PostgreSQL devises a query plan for each query it is given. Choosing the right @@ -336,6 +344,11 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 < 50 AND t1 Statistics Used by the Planner + + statistics + of the planner + + As we saw in the previous section, the query planner needs to estimate the number of rows retrieved by a query in order to make good choices @@ -381,6 +394,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't since it does not read every row of the table. + + pg_statistic + + Most queries retrieve only a fraction of the rows in a table, due to having WHERE clauses that restrict the rows to be examined. @@ -393,6 +410,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't and are always approximate even when freshly updated. + + pg_stats + + Rather than look at pg_statistic directly, it's better to look at its view pg_stats @@ -538,6 +559,11 @@ SELECT attname, n_distinct, most_common_vals FROM pg_stats WHERE tablename = 'ro Controlling the Planner with Explicit <literal>JOIN</> Clauses + + join + controlling the order + + It is possible to control the query planner to some extent by using the explicit JOIN @@ -700,6 +726,10 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; Disable Autocommit + + autocommit + + Turn off autocommit and just do one commit at the end. (In plain SQL, this means issuing BEGIN diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index 02d38bc5340..8e834b08197 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -1,5 +1,5 @@ @@ -73,11 +73,12 @@ CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS ' - If an SQL null value is passed to a function, the argument value - will appear as undefined in Perl. The above function - definition will not behave very nicely with null inputs (in fact, - it will act as though they are zeroes). We could add - STRICT to the function definition to make + If an SQL null valuenull valuein PL/Perl is passed to a function, + the argument value will appear as undefined in Perl. The + above function definition will not behave very nicely with null + inputs (in fact, it will act as though they are zeroes). We could + add STRICT to the function definition to make PostgreSQL do something more reasonable: if a null value is passed, the function will not be called at all, but will just return a null result automatically. Alternatively, @@ -170,7 +171,7 @@ SELECT name, empcomp(employee) FROM employee; mirror sites). This module makes available a DBI-compliant database-handle named $pg_dbh that can be used to perform queries - with normal DBI syntax. + with normal DBI syntax.DBI @@ -180,7 +181,7 @@ SELECT name, empcomp(employee) FROM employee; elog - PL/Perl + in PL/Perl elog level, msg @@ -202,6 +203,11 @@ SELECT name, empcomp(employee) FROM employee; Trusted and Untrusted PL/Perl + + trusted + PL/Perl + + Normally, PL/Perl is installed as a trusted programming language named plperl. In this setup, certain Perl @@ -231,13 +237,14 @@ CREATE FUNCTION badfunc() RETURNS integer AS ' Sometimes it is desirable to write Perl functions that are not - restricted. For example, one might want a Perl function that - sends mail. To handle these cases, PL/Perl can also be installed - as an untrusted language (usually called - PL/PerlU). In this case the full Perl language is - available. If the createlang program is used to - install the language, the language name plperlu - will select the untrusted PL/Perl variant. + restricted. For example, one might want a Perl function that sends + mail. To handle these cases, PL/Perl can also be installed as an + untrusted language (usually called + PL/PerlUPL/PerlU). + In this case the full Perl language is available. If the + createlang program is used to install the + language, the language name plperlu will select + the untrusted PL/Perl variant. @@ -272,7 +279,9 @@ CREATE FUNCTION badfunc() RETURNS integer AS ' - PL/Perl cannot be used to write trigger functions. + PL/Perl cannot be used to write trigger + functions.triggerin + PL/Perl diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index b313860ea0c..4cf4d6c31aa 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,5 +1,5 @@ @@ -63,20 +63,22 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.20 2003/08/09 22:50:22 tgl - As each expression and SQL command is first used - in the function, the PL/pgSQL interpreter creates - a prepared execution plan (using the SPI - manager's SPI_prepare and - SPI_saveplan functions). Subsequent visits - to that expression or command reuse the prepared plan. Thus, a - function with conditional code that contains many statements for - which execution plans might be required will only prepare and save - those plans that are really used during the lifetime of the - database connection. This can substantially reduce the total - amount of time required to parse, and generate execution plans for the - statements in a PL/pgSQL function. A disadvantage is - that errors in a specific expression or command may not be detected - until that part of the function is reached in execution. + As each expression and SQL command is first + used in the function, the PL/pgSQL interpreter + creates a prepared execution plan (using the + SPI manager's SPI_prepare + and SPI_saveplan + functions).preparing a queryin + PL/pgSQL Subsequent visits to that expression or command + reuse the prepared plan. Thus, a function with conditional code + that contains many statements for which execution plans might be + required will only prepare and save those plans that are really + used during the lifetime of the database connection. This can + substantially reduce the total amount of time required to parse, + and generate execution plans for the statements in a + PL/pgSQL function. A disadvantage is that errors + in a specific expression or command may not be detected until that + part of the function is reached in execution. @@ -196,7 +198,7 @@ END; and return the polymorphic types anyelement and anyarray. The actual datatypes handled by a polymorphic function can vary from call to - call, as discussed in . + call, as discussed in . An example is shown in . @@ -563,7 +565,7 @@ END; or anyarray), a special parameter $0 is created. Its datatype is the actual return type of the function, as deduced from the actual input types (see ). + linkend="extend-types-polymorphic">). This allows the function to access its actual return type as shown in . $0 is initialized to NULL and can be modified by @@ -903,6 +905,11 @@ tax := subtotal * 0.06; <command>SELECT INTO</command> + + SELECT INTO + in PL/pgSQL + + The result of a SELECT command yielding multiple columns (but only one row) can be assigned to a record variable, row-type @@ -1097,14 +1104,16 @@ EXECUTE ''UPDATE tbl SET '' This example shows use of the functions quote_ident(text) and - quote_literal(text). - Variables containing column and table identifiers should be - passed to function quote_ident. - Variables containing values that should be literal strings in the - constructed command should be passed to - quote_literal. Both take the - appropriate steps to return the input text enclosed in double - or single quotes respectively, with any embedded special characters + quote_literal(text).quote_identuse + in + PL/pgSQLquote_literaluse + in PL/pgSQL Variables containing column and table + identifiers should be passed to function + quote_ident. Variables containing values + that should be literal strings in the constructed command should + be passed to quote_literal. Both take the + appropriate steps to return the input text enclosed in double or + single quotes respectively, with any embedded special characters properly escaped. @@ -1517,6 +1526,11 @@ END IF; Simple Loops + + loop + in PL/pgSQL + + With the LOOP, EXIT, WHILE, and FOR statements, you can arrange for your @@ -1734,6 +1748,11 @@ END LOOP; Cursors + + cursor + in PL/pgSQL + + Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read @@ -2096,6 +2115,11 @@ RAISE EXCEPTION ''Inexistent ID --> %'', user_id; Trigger Procedures + + trigger + in PL/pgSQL + + PL/pgSQL can be used to define trigger procedures. A trigger procedure is created with the @@ -2302,10 +2326,12 @@ CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp Oracle + porting from PL/SQL to PL/pgSQL - PL/SQL + PL/SQL (Oracle) + porting to PL/pgSQL @@ -2546,7 +2572,8 @@ END; with OUT parameters and string manipulation. PostgreSQL does not have an instr function, but you can work around it - using a combination of other functions. In instr In there is a PL/pgSQL implementation of instr that you can use to make your porting diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index 0a101384ee7..2f854a3a83d 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -1,4 +1,4 @@ - + PL/Python - Python Procedural Language @@ -68,9 +68,10 @@ def __plpython_procedure_myfunc_23456(): If you do not provide a return value, Python returns the default - None. The - language module translates Python's None into the - SQL null value. + None. The language module translates Python's + None into the SQL null + value.null valuein PL/Python @@ -87,7 +88,9 @@ def __plpython_procedure_myfunc_23456(): The global dictionary SD is available to store data between function calls. This variable is private static data. The global dictionary GD is public data, - available to all Python functions within a session. Use with care. + available to all Python functions within a session. Use with + care.global datain + PL/Python @@ -102,6 +105,11 @@ def __plpython_procedure_myfunc_23456(): Trigger Functions + + trigger + in PL/Python + + When a function is used in a trigger, the dictionary TD contains trigger-related values. The trigger @@ -146,7 +154,8 @@ def __plpython_procedure_myfunc_23456(): plpy.error("msg"), and plpy.fatal("msg"). They are mostly equivalent to calling elog(LEVEL, "msg") - from C code. plpy.error and + from C code.elogin + PL/Python plpy.error and plpy.fatal actually raise a Python exception which, if uncaught, causes the PL/Python module to call elog(ERROR, msg) when the function handler @@ -187,10 +196,11 @@ foo = rv[i]["my_column"] - The second function, plpy.prepare, prepares the - execution plan for a query. It is called with a query string and a - list of parameter types, if you have parameter references in the - query. For example: + preparing a queryin PL/Python + The second function, plpy.prepare, prepares + the execution plan for a query. It is called with a query string + and a list of parameter types, if you have parameter references in + the query. For example: plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name = $1", [ "text" ]) @@ -235,7 +245,8 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS ' - Restricted Environment @@ -259,6 +270,6 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS ' ---> +]]> diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml index d93f7f6517f..76b4e962085 100644 --- a/doc/src/sgml/pltcl.sgml +++ b/doc/src/sgml/pltcl.sgml @@ -1,5 +1,5 @@ @@ -190,6 +190,11 @@ CREATE FUNCTION overpaid(employee) RETURNS boolean AS ' Global Data in PL/Tcl + + global data + in PL/Tcl + + Sometimes it is useful to have some global data that is held between two @@ -298,8 +303,10 @@ spi_exec -array C "SELECT * FROM pg_class" { spi_prepare query typelist - Prepares and saves a query plan for later execution. The saved plan - will be retained for the life of the current session. + Prepares and saves a query plan for later execution. The + saved plan will be retained for the life of the current + session.preparing a queryin + PL/Tcl The query may use parameters, that is, placeholders for @@ -437,7 +444,7 @@ SELECT 'doesn''t' AS ret elog - PL/Tcl + in PL/Tcl elog level msg @@ -466,7 +473,7 @@ SELECT 'doesn''t' AS ret Trigger Procedures in PL/Tcl - triggers + trigger in PL/Tcl diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index d3ec786ac27..b717ad445a0 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -1,8 +1,16 @@ - + Queries + + query + + + + SELECT + + The previous chapters explained how to create tables, how to fill them with data, and how to manipulate that data. Now we finally @@ -73,6 +81,10 @@ SELECT random(); Table Expressions + + table expression + + A table expression computes a table. The table expression contains a FROM clause that is @@ -112,6 +124,10 @@ FROM table_reference , table_r overall table expression. + + ONLY + + When a table reference names a table that is the supertable of a table inheritance hierarchy, the table reference produces rows of @@ -125,7 +141,7 @@ FROM table_reference , table_r Joined Tables - joins + join @@ -141,10 +157,14 @@ FROM table_reference , table_r Cross join - joins + join cross + + cross join + + T1 CROSS JOIN T2 @@ -175,10 +195,14 @@ FROM table_reference , table_r Qualified joins - joins + join outer + + outer join + + T1 { INNER | { LEFT | RIGHT | FULL } OUTER } JOIN T2 ON boolean_expression @@ -227,9 +251,12 @@ FROM table_reference , table_r - joins + join natural + + natural join + Finally, NATURAL is a shorthand form of USING: it forms a USING list consisting of exactly those column names that appear in both @@ -256,10 +283,14 @@ FROM table_reference , table_r LEFT OUTER JOIN - joins + join left + + left join + + First, an inner join is performed. Then, for each row in @@ -274,6 +305,15 @@ FROM table_reference , table_r RIGHT OUTER JOIN + + join + right + + + + right join + + First, an inner join is performed. Then, for each row in @@ -424,13 +464,13 @@ FROM table_reference , table_r Table and Column Aliases - label - table + alias + in the FROM clause - alias - label + label + alias @@ -530,7 +570,7 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c Subqueries - subqueries + subquery @@ -556,6 +596,11 @@ FROM (SELECT * FROM table1) AS alias_name table function + + function + in the FROM clause + + Table functions are functions that produce a set of rows, made up of either base data types (scalar types) or composite data types @@ -628,7 +673,7 @@ SELECT * The WHERE Clause - where + WHERE @@ -716,7 +761,11 @@ SELECT ... FROM fdt WHERE EXISTS (SELECT c1 FROM t2 WHERE c2 > fdt.c1) The GROUP BY and HAVING Clauses - group + GROUP BY + + + + grouping @@ -827,6 +876,10 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales column names is also allowed. + + HAVING + + If a table has been grouped using a GROUP BY clause, but then only certain groups are of interest, the @@ -884,7 +937,7 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit Select Lists - select + SELECT select list @@ -901,6 +954,10 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit Select-List Items + + * + + The simplest kind of select list is * which emits all columns that the table expression produces. Otherwise, @@ -944,8 +1001,8 @@ SELECT tbl1.a, tbl2.a, tbl1.b FROM ... Column Labels - label - column + alias + in the select list @@ -981,7 +1038,11 @@ SELECT a AS value, b + c AS sum FROM ... DISTINCT - distinct + DISTINCT + + + + duplicates @@ -997,6 +1058,8 @@ SELECT DISTINCT select_list ... + null valuein + DISTINCT Obviously, two rows are considered distinct if they differ in at least one column value. Null values are considered equal in this comparison. @@ -1035,13 +1098,25 @@ SELECT DISTINCT ON (expression , Combining Queries - union + UNION + + + INTERSECT + + + EXCEPT + + + set union + + + set intersection - intersection + set difference - except + set operation @@ -1104,7 +1179,10 @@ SELECT DISTINCT ON (expression , sorting - query results + + + + ORDER BY @@ -1173,12 +1251,11 @@ SELECT a AS b FROM table1 ORDER BY a; LIMIT and OFFSET - limit + LIMIT - offset - with query results + OFFSET diff --git a/doc/src/sgml/query.sgml b/doc/src/sgml/query.sgml index 5a7a7f4e62e..26ffb06bd73 100644 --- a/doc/src/sgml/query.sgml +++ b/doc/src/sgml/query.sgml @@ -1,5 +1,5 @@ @@ -87,7 +87,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.32 2003/06/24 23:27:24 momji - cluster + database cluster + clusterof databasesdatabase cluster Tables are grouped into databases, and a collection of databases managed by a single PostgreSQL server @@ -562,7 +563,7 @@ SELECT * Aggregate Functions - aggregate + aggregate function diff --git a/doc/src/sgml/ref/abort.sgml b/doc/src/sgml/ref/abort.sgml index 5d1d4472d01..e83b21e4d57 100644 --- a/doc/src/sgml/ref/abort.sgml +++ b/doc/src/sgml/ref/abort.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation abort the current transaction + + ABORT + + ABORT [ WORK | TRANSACTION ] diff --git a/doc/src/sgml/ref/alter_aggregate.sgml b/doc/src/sgml/ref/alter_aggregate.sgml index 972accd7565..e4a6850e95d 100644 --- a/doc/src/sgml/ref/alter_aggregate.sgml +++ b/doc/src/sgml/ref/alter_aggregate.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of an aggregate function + + ALTER AGGREGATE + + ALTER AGGREGATE name ( type ) RENAME TO newname diff --git a/doc/src/sgml/ref/alter_conversion.sgml b/doc/src/sgml/ref/alter_conversion.sgml index b2767405ca8..d1ab87c3b5f 100644 --- a/doc/src/sgml/ref/alter_conversion.sgml +++ b/doc/src/sgml/ref/alter_conversion.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a conversion + + ALTER CONVERSION + + ALTER CONVERSION name RENAME TO newname diff --git a/doc/src/sgml/ref/alter_database.sgml b/doc/src/sgml/ref/alter_database.sgml index 12447d6b0a7..6e8da1f0308 100644 --- a/doc/src/sgml/ref/alter_database.sgml +++ b/doc/src/sgml/ref/alter_database.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change a database + + ALTER DATABASE + + ALTER DATABASE name SET variable { TO | = } { value | DEFAULT } diff --git a/doc/src/sgml/ref/alter_domain.sgml b/doc/src/sgml/ref/alter_domain.sgml index fdbf08e6d48..f31311b6331 100644 --- a/doc/src/sgml/ref/alter_domain.sgml +++ b/doc/src/sgml/ref/alter_domain.sgml @@ -1,5 +1,5 @@ @@ -8,6 +8,7 @@ PostgreSQL documentation ALTER DOMAIN SQL - Language Statements + ALTER DOMAIN @@ -16,6 +17,11 @@ PostgreSQL documentation change the definition of a domain + + + ALTER DOMAIN + + 2002-11-27 diff --git a/doc/src/sgml/ref/alter_function.sgml b/doc/src/sgml/ref/alter_function.sgml index 621350980b8..50c857b0e1a 100644 --- a/doc/src/sgml/ref/alter_function.sgml +++ b/doc/src/sgml/ref/alter_function.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a function + + ALTER FUNCTION + + ALTER FUNCTION name ( [ type [, ...] ] ) RENAME TO newname diff --git a/doc/src/sgml/ref/alter_group.sgml b/doc/src/sgml/ref/alter_group.sgml index 6d0695b9384..d306b952558 100644 --- a/doc/src/sgml/ref/alter_group.sgml +++ b/doc/src/sgml/ref/alter_group.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change a user group + + ALTER GROUP + + ALTER GROUP groupname ADD USER username [, ... ] diff --git a/doc/src/sgml/ref/alter_language.sgml b/doc/src/sgml/ref/alter_language.sgml index 2c922d58830..c20ceded643 100644 --- a/doc/src/sgml/ref/alter_language.sgml +++ b/doc/src/sgml/ref/alter_language.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a procedural language + + ALTER LANGUAGE + + ALTER LANGUAGE name RENAME TO newname diff --git a/doc/src/sgml/ref/alter_opclass.sgml b/doc/src/sgml/ref/alter_opclass.sgml index 5a9694c73a8..be31dd98eb3 100644 --- a/doc/src/sgml/ref/alter_opclass.sgml +++ b/doc/src/sgml/ref/alter_opclass.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of an operator class + + ALTER OPERATOR CLASS + + ALTER OPERATOR CLASS name USING index_method RENAME TO newname diff --git a/doc/src/sgml/ref/alter_schema.sgml b/doc/src/sgml/ref/alter_schema.sgml index 6e3c78c9c7c..940e3d56235 100644 --- a/doc/src/sgml/ref/alter_schema.sgml +++ b/doc/src/sgml/ref/alter_schema.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a schema + + ALTER SCHEMA + + ALTER SCHEMA name RENAME TO newname diff --git a/doc/src/sgml/ref/alter_sequence.sgml b/doc/src/sgml/ref/alter_sequence.sgml index 28a81022aab..f12e9ad85a0 100644 --- a/doc/src/sgml/ref/alter_sequence.sgml +++ b/doc/src/sgml/ref/alter_sequence.sgml @@ -1,5 +1,5 @@ @@ -8,6 +8,7 @@ PostgreSQL documentation ALTER SEQUENCE SQL - Language Statements + ALTER SEQUENCE @@ -16,6 +17,11 @@ PostgreSQL documentation alter the definition of a sequence generator + + + ALTER SEQUENCE + + 1999-07-20 diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 7f5456c2772..2dd377c0586 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a table + + ALTER TABLE + + ALTER TABLE [ ONLY ] table [ * ] diff --git a/doc/src/sgml/ref/alter_trigger.sgml b/doc/src/sgml/ref/alter_trigger.sgml index b335434eaf8..f8409136522 100644 --- a/doc/src/sgml/ref/alter_trigger.sgml +++ b/doc/src/sgml/ref/alter_trigger.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change the definition of a trigger + + ALTER TRIGGER + + ALTER TRIGGER trigger ON table diff --git a/doc/src/sgml/ref/alter_user.sgml b/doc/src/sgml/ref/alter_user.sgml index 95de7a592d5..f3c7292718c 100644 --- a/doc/src/sgml/ref/alter_user.sgml +++ b/doc/src/sgml/ref/alter_user.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change a database user account + + ALTER USER + + ALTER USER username [ [ WITH ] option [ ... ] ] diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml index 4977964f4e7..93d86763633 100644 --- a/doc/src/sgml/ref/analyze.sgml +++ b/doc/src/sgml/ref/analyze.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation collect statistics about a database + + ANALYZE + + ANALYZE [ VERBOSE ] [ table [ (column [, ...] ) ] ] diff --git a/doc/src/sgml/ref/begin.sgml b/doc/src/sgml/ref/begin.sgml index 7bd1309d289..67393c891b1 100644 --- a/doc/src/sgml/ref/begin.sgml +++ b/doc/src/sgml/ref/begin.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation start a transaction block + + BEGIN + + BEGIN [ WORK | TRANSACTION ] diff --git a/doc/src/sgml/ref/checkpoint.sgml b/doc/src/sgml/ref/checkpoint.sgml index 71d075d542e..78662f6fcbd 100644 --- a/doc/src/sgml/ref/checkpoint.sgml +++ b/doc/src/sgml/ref/checkpoint.sgml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,10 @@ force a transaction log checkpoint + + CHECKPOINT + + CHECKPOINT diff --git a/doc/src/sgml/ref/close.sgml b/doc/src/sgml/ref/close.sgml index 63b2f15d16c..634f11de8b9 100644 --- a/doc/src/sgml/ref/close.sgml +++ b/doc/src/sgml/ref/close.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation close a cursor + + CLOSE + + CLOSE cursor diff --git a/doc/src/sgml/ref/cluster.sgml b/doc/src/sgml/ref/cluster.sgml index 90c56551a33..eaa1763d2ae 100644 --- a/doc/src/sgml/ref/cluster.sgml +++ b/doc/src/sgml/ref/cluster.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation cluster a table according to an index + + CLUSTER + + CLUSTER indexname ON tablename diff --git a/doc/src/sgml/ref/clusterdb.sgml b/doc/src/sgml/ref/clusterdb.sgml index 4e41136168c..dce618f3c01 100644 --- a/doc/src/sgml/ref/clusterdb.sgml +++ b/doc/src/sgml/ref/clusterdb.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation cluster a PostgreSQL database + + clusterdb + + clusterdb diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index 2eaf4ada45d..6927fb10a4a 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define or change the comment of an object + + COMMENT + + COMMENT ON diff --git a/doc/src/sgml/ref/commit.sgml b/doc/src/sgml/ref/commit.sgml index a84c61a9011..b4992f73eab 100644 --- a/doc/src/sgml/ref/commit.sgml +++ b/doc/src/sgml/ref/commit.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation commit the current transaction + + COMMIT + + COMMIT [ WORK | TRANSACTION ] diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index c53a5f9251a..1b3cd2d8b00 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation copy data between files and tables + + COPY + + COPY table [ ( column [, ...] ) ] diff --git a/doc/src/sgml/ref/create_aggregate.sgml b/doc/src/sgml/ref/create_aggregate.sgml index 2aff0636713..f0f212db18d 100644 --- a/doc/src/sgml/ref/create_aggregate.sgml +++ b/doc/src/sgml/ref/create_aggregate.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new aggregate function + + CREATE AGGREGATE + + CREATE AGGREGATE name ( diff --git a/doc/src/sgml/ref/create_cast.sgml b/doc/src/sgml/ref/create_cast.sgml index b97135c9538..b89aead0bf4 100644 --- a/doc/src/sgml/ref/create_cast.sgml +++ b/doc/src/sgml/ref/create_cast.sgml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,10 @@ define a user-defined cast + + CREATE CAST + + CREATE CAST (sourcetype AS targettype) diff --git a/doc/src/sgml/ref/create_constraint.sgml b/doc/src/sgml/ref/create_constraint.sgml index b61cd5d911f..1cfcc39a8ed 100644 --- a/doc/src/sgml/ref/create_constraint.sgml +++ b/doc/src/sgml/ref/create_constraint.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new constraint trigger + + CREATE CONSTRAINT + + CREATE CONSTRAINT TRIGGER name diff --git a/doc/src/sgml/ref/create_conversion.sgml b/doc/src/sgml/ref/create_conversion.sgml index 382c5089832..6623bd8c5f7 100644 --- a/doc/src/sgml/ref/create_conversion.sgml +++ b/doc/src/sgml/ref/create_conversion.sgml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,10 @@ define a user-defined conversion + + CREATE CONVERSION + + CREATE [DEFAULT] CONVERSION name diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index ad0008de403..ddde0df3347 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation create a new database + + CREATE DATABASE + + CREATE DATABASE name diff --git a/doc/src/sgml/ref/create_domain.sgml b/doc/src/sgml/ref/create_domain.sgml index 0d6fe6ef50a..6adf9b7ec1b 100644 --- a/doc/src/sgml/ref/create_domain.sgml +++ b/doc/src/sgml/ref/create_domain.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new domain + + CREATE DOMAIN + + CREATE DOMAIN domainname [AS] data_type diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 4e1978c6eec..ef8274494e0 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.48 2003/06/27 define a new function + + CREATE FUNCTION + + CREATE [ OR REPLACE ] FUNCTION name ( [ argtype [, ...] ] ) diff --git a/doc/src/sgml/ref/create_group.sgml b/doc/src/sgml/ref/create_group.sgml index d90dd31086a..1fb983721bf 100644 --- a/doc/src/sgml/ref/create_group.sgml +++ b/doc/src/sgml/ref/create_group.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new user group + + CREATE GROUP + + CREATE GROUP name [ [ WITH ] option [ ... ] ] diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index ff60aaa3b01..06c37f497ee 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new index + + CREATE INDEX + + CREATE [ UNIQUE ] INDEX index_name ON table [ USING method ] diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml index d26eb48911d..c729ecc56f9 100644 --- a/doc/src/sgml/ref/create_language.sgml +++ b/doc/src/sgml/ref/create_language.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new procedural language + + CREATE LANGUAGE + + CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE langname diff --git a/doc/src/sgml/ref/create_opclass.sgml b/doc/src/sgml/ref/create_opclass.sgml index eddb8e71287..f205eab8855 100644 --- a/doc/src/sgml/ref/create_opclass.sgml +++ b/doc/src/sgml/ref/create_opclass.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new operator class for indexes + + CREATE OPERATOR CLASS + + CREATE OPERATOR CLASS name [ DEFAULT ] FOR TYPE data_type USING index_method AS diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index 34933a37eff..67470102f76 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new operator + + CREATE OPERATOR + + CREATE OPERATOR name ( diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml index ff7f2bfb134..2fccd22a10d 100644 --- a/doc/src/sgml/ref/create_rule.sgml +++ b/doc/src/sgml/ref/create_rule.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new rewrite rule + + CREATE RULE + + CREATE [ OR REPLACE ] RULE name AS ON event diff --git a/doc/src/sgml/ref/create_schema.sgml b/doc/src/sgml/ref/create_schema.sgml index e70d29a37b8..3641587b9ad 100644 --- a/doc/src/sgml/ref/create_schema.sgml +++ b/doc/src/sgml/ref/create_schema.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new schema + + CREATE SCHEMA + + CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ ... ] ] diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index 374f34cb0a8..5a9210fbcd3 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new sequence generator + + CREATE SEQUENCE + + CREATE [ TEMPORARY | TEMP ] SEQUENCE seqname [ INCREMENT [ BY ] increment ] diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 2d55997e708..23cf859cd50 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new table + + CREATE TABLE + + CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml index 0f648d56b3a..ac05e2d42e5 100644 --- a/doc/src/sgml/ref/create_table_as.sgml +++ b/doc/src/sgml/ref/create_table_as.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation create a new table from the results of a query + + CREATE TABLE AS + + CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name [ (column_name [, ...] ) ] diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index 1856264954c..cf580b1ab93 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new trigger + + CREATE TRIGGER + + CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] } diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 2d2b92a85aa..6e98d5e00ff 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new data type + + CREATE TYPE + + CREATE TYPE typename AS diff --git a/doc/src/sgml/ref/create_user.sgml b/doc/src/sgml/ref/create_user.sgml index 23d64bd2c54..f22b8854f07 100644 --- a/doc/src/sgml/ref/create_user.sgml +++ b/doc/src/sgml/ref/create_user.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new database user account + + CREATE USER + + CREATE USER username [ [ WITH ] option [ ... ] ] diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index 8bfb4f16636..6bf9434a1b1 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a new view + + CREATE VIEW + + CREATE [ OR REPLACE ] VIEW name [ ( @@ -15,6 +15,10 @@ PostgreSQL documentation create a new PostgreSQL database + + createdb + + createdb diff --git a/doc/src/sgml/ref/createlang.sgml b/doc/src/sgml/ref/createlang.sgml index be86e7c1c79..c44ab33a86f 100644 --- a/doc/src/sgml/ref/createlang.sgml +++ b/doc/src/sgml/ref/createlang.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation define a new PostgreSQL procedural language + + createlang + + createlang diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml index 6f58117be1c..0e6935f536b 100644 --- a/doc/src/sgml/ref/createuser.sgml +++ b/doc/src/sgml/ref/createuser.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation define a new PostgreSQL user account + + createuser + + createuser diff --git a/doc/src/sgml/ref/deallocate.sgml b/doc/src/sgml/ref/deallocate.sgml index 008a6262e12..11da825a723 100644 --- a/doc/src/sgml/ref/deallocate.sgml +++ b/doc/src/sgml/ref/deallocate.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation deallocate a prepared statement + + DEALLOCATE + + DEALLOCATE [ PREPARE ] plan_name diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index 14ce71f4a66..2bd6ed82af7 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define a cursor + + DECLARE + + DECLARE cursorname [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ] diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml index b04b86c8887..fea6a268abb 100644 --- a/doc/src/sgml/ref/delete.sgml +++ b/doc/src/sgml/ref/delete.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation delete rows of a table + + DELETE + + DELETE FROM [ ONLY ] table [ WHERE condition ] diff --git a/doc/src/sgml/ref/drop_aggregate.sgml b/doc/src/sgml/ref/drop_aggregate.sgml index 49915626a5c..0f19dd6a811 100644 --- a/doc/src/sgml/ref/drop_aggregate.sgml +++ b/doc/src/sgml/ref/drop_aggregate.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined aggregate function + + DROP AGGREGATE + + DROP AGGREGATE name ( type ) [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_cast.sgml b/doc/src/sgml/ref/drop_cast.sgml index 427796e56bf..0c352ad2bcc 100644 --- a/doc/src/sgml/ref/drop_cast.sgml +++ b/doc/src/sgml/ref/drop_cast.sgml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,10 @@ remove a user-defined cast + + DROP CAST + + DROP CAST (sourcetype AS targettype) [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_conversion.sgml b/doc/src/sgml/ref/drop_conversion.sgml index d9c795c445a..9cb416b2d50 100644 --- a/doc/src/sgml/ref/drop_conversion.sgml +++ b/doc/src/sgml/ref/drop_conversion.sgml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,10 @@ remove a user-defined conversion + + DROP CONVERSION + + DROP CONVERSION conversion_name [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_database.sgml b/doc/src/sgml/ref/drop_database.sgml index fb77f53c67c..1224b4142ec 100644 --- a/doc/src/sgml/ref/drop_database.sgml +++ b/doc/src/sgml/ref/drop_database.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a database + + DROP DATABASE + + DROP DATABASE name diff --git a/doc/src/sgml/ref/drop_domain.sgml b/doc/src/sgml/ref/drop_domain.sgml index 99c8ec7d44e..b8627e5156b 100644 --- a/doc/src/sgml/ref/drop_domain.sgml +++ b/doc/src/sgml/ref/drop_domain.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a domain + + DROP DOMAIN + + DROP DOMAIN domainname [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_function.sgml b/doc/src/sgml/ref/drop_function.sgml index 1a62a00f482..1a51b2b58c5 100644 --- a/doc/src/sgml/ref/drop_function.sgml +++ b/doc/src/sgml/ref/drop_function.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined function + + DROP FUNCTION + + DROP FUNCTION name ( [ type [, ...] ] ) [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_group.sgml b/doc/src/sgml/ref/drop_group.sgml index c6c6907e751..ea350586810 100644 --- a/doc/src/sgml/ref/drop_group.sgml +++ b/doc/src/sgml/ref/drop_group.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user group + + DROP GROUP + + DROP GROUP name diff --git a/doc/src/sgml/ref/drop_index.sgml b/doc/src/sgml/ref/drop_index.sgml index 4185a4158c2..720d601e76c 100644 --- a/doc/src/sgml/ref/drop_index.sgml +++ b/doc/src/sgml/ref/drop_index.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove an index + + DROP INDEX + + DROP INDEX name [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_language.sgml b/doc/src/sgml/ref/drop_language.sgml index ad67a95d442..1be0bef48b0 100644 --- a/doc/src/sgml/ref/drop_language.sgml +++ b/doc/src/sgml/ref/drop_language.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined procedural language + + DROP LANGUAGE + + DROP [ PROCEDURAL ] LANGUAGE name [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_opclass.sgml b/doc/src/sgml/ref/drop_opclass.sgml index cb0aebd7103..dcd72a30383 100644 --- a/doc/src/sgml/ref/drop_opclass.sgml +++ b/doc/src/sgml/ref/drop_opclass.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined operator class + + DROP OPERATOR CLASS + + DROP OPERATOR CLASS name USING index_method [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_operator.sgml b/doc/src/sgml/ref/drop_operator.sgml index 8f3b1e069c6..427e332b753 100644 --- a/doc/src/sgml/ref/drop_operator.sgml +++ b/doc/src/sgml/ref/drop_operator.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined operator + + DROP OPERATOR + + DROP OPERATOR name ( lefttype | NONE , righttype | NONE ) [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_rule.sgml b/doc/src/sgml/ref/drop_rule.sgml index 0276621c575..df34ddd54b6 100644 --- a/doc/src/sgml/ref/drop_rule.sgml +++ b/doc/src/sgml/ref/drop_rule.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a rewrite rule + + DROP RULE + + DROP RULE name ON relation [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_schema.sgml b/doc/src/sgml/ref/drop_schema.sgml index b8f706b0c77..77ccbbb8f34 100644 --- a/doc/src/sgml/ref/drop_schema.sgml +++ b/doc/src/sgml/ref/drop_schema.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a schema + + DROP SCHEMA + + DROP SCHEMA name [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_sequence.sgml b/doc/src/sgml/ref/drop_sequence.sgml index fe77e2a3d69..a23dd4ad16a 100644 --- a/doc/src/sgml/ref/drop_sequence.sgml +++ b/doc/src/sgml/ref/drop_sequence.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a sequence + + DROP SEQUENCE + + DROP SEQUENCE name [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_table.sgml b/doc/src/sgml/ref/drop_table.sgml index 4ebda8787e6..61e253dc50b 100644 --- a/doc/src/sgml/ref/drop_table.sgml +++ b/doc/src/sgml/ref/drop_table.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a table + + DROP TABLE + + DROP TABLE name [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_trigger.sgml b/doc/src/sgml/ref/drop_trigger.sgml index 5a33d033c24..f4a24e90198 100644 --- a/doc/src/sgml/ref/drop_trigger.sgml +++ b/doc/src/sgml/ref/drop_trigger.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a trigger + + DROP TRIGGER + + DROP TRIGGER name ON table [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml index 4267efcb0bd..18548fff14f 100644 --- a/doc/src/sgml/ref/drop_type.sgml +++ b/doc/src/sgml/ref/drop_type.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a user-defined data type + + DROP TYPE + + DROP TYPE typename [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/drop_user.sgml b/doc/src/sgml/ref/drop_user.sgml index 7d094b993d3..143efbca9bd 100644 --- a/doc/src/sgml/ref/drop_user.sgml +++ b/doc/src/sgml/ref/drop_user.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a database user account + + DROP USER + + DROP USER name diff --git a/doc/src/sgml/ref/drop_view.sgml b/doc/src/sgml/ref/drop_view.sgml index fd32f92f8ac..b17d2bccd80 100644 --- a/doc/src/sgml/ref/drop_view.sgml +++ b/doc/src/sgml/ref/drop_view.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove a view + + DROP VIEW + + DROP VIEW name [, ...] [ CASCADE | RESTRICT ] diff --git a/doc/src/sgml/ref/dropdb.sgml b/doc/src/sgml/ref/dropdb.sgml index e029b1a6a36..725eaf8991f 100644 --- a/doc/src/sgml/ref/dropdb.sgml +++ b/doc/src/sgml/ref/dropdb.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation remove a PostgreSQL database + + dropdb + + dropdb diff --git a/doc/src/sgml/ref/droplang.sgml b/doc/src/sgml/ref/droplang.sgml index 6bddf1a5ba5..309578ad603 100644 --- a/doc/src/sgml/ref/droplang.sgml +++ b/doc/src/sgml/ref/droplang.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation remove a PostgreSQL procedural language + + droplang + + droplang diff --git a/doc/src/sgml/ref/dropuser.sgml b/doc/src/sgml/ref/dropuser.sgml index c199624d346..27d67f9ba88 100644 --- a/doc/src/sgml/ref/dropuser.sgml +++ b/doc/src/sgml/ref/dropuser.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation remove a PostgreSQL user account + + dropuser + + dropuser diff --git a/doc/src/sgml/ref/ecpg-ref.sgml b/doc/src/sgml/ref/ecpg-ref.sgml index ffb5ed41945..fc4aeef337c 100644 --- a/doc/src/sgml/ref/ecpg-ref.sgml +++ b/doc/src/sgml/ref/ecpg-ref.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation embedded SQL C preprocessor + + ecpg + + ecpg diff --git a/doc/src/sgml/ref/end.sgml b/doc/src/sgml/ref/end.sgml index b672319479e..a56539f37b7 100644 --- a/doc/src/sgml/ref/end.sgml +++ b/doc/src/sgml/ref/end.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation commit the current transaction + + END + + END [ WORK | TRANSACTION ] diff --git a/doc/src/sgml/ref/execute.sgml b/doc/src/sgml/ref/execute.sgml index 7704b8ce27b..d92c637d272 100644 --- a/doc/src/sgml/ref/execute.sgml +++ b/doc/src/sgml/ref/execute.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation execute a prepared statement + + EXECUTE + + EXECUTE plan_name [ (parameter [, ...] ) ] diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 2ac74e8a383..471ab1fc228 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation show the execution plan of a statement + + EXPLAIN + + EXPLAIN [ ANALYZE ] [ VERBOSE ] statement diff --git a/doc/src/sgml/ref/fetch.sgml b/doc/src/sgml/ref/fetch.sgml index 05960eb2e0f..d6622a4ea78 100644 --- a/doc/src/sgml/ref/fetch.sgml +++ b/doc/src/sgml/ref/fetch.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation retrieve rows from a query using a cursor + + FETCH + + FETCH [ direction { FROM | IN } ] cursor diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index 7ba370d6598..c0ee3055178 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation define access privileges + + GRANT + + GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index ccab2e94422..4b656a86d26 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation create a new PostgreSQL database cluster + + initdb + + initdb diff --git a/doc/src/sgml/ref/initlocation.sgml b/doc/src/sgml/ref/initlocation.sgml index 8211e635cd2..b85e1778c60 100644 --- a/doc/src/sgml/ref/initlocation.sgml +++ b/doc/src/sgml/ref/initlocation.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation create a secondary PostgreSQL database storage area + + initlocation + + initlocation diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index cbb0d279bd2..76160d6dbec 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation create new rows in a table + + INSERT + + INSERT INTO table [ ( column [, ...] ) ] diff --git a/doc/src/sgml/ref/ipcclean.sgml b/doc/src/sgml/ref/ipcclean.sgml index 85ca334c178..4edad27b4dc 100644 --- a/doc/src/sgml/ref/ipcclean.sgml +++ b/doc/src/sgml/ref/ipcclean.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation remove shared memory and semaphores from an aborted PostgreSQL server + + ipcclean + + ipcclean diff --git a/doc/src/sgml/ref/listen.sgml b/doc/src/sgml/ref/listen.sgml index 154224d0d20..7de13387dbd 100644 --- a/doc/src/sgml/ref/listen.sgml +++ b/doc/src/sgml/ref/listen.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation listen for a notification + + LISTEN + + LISTEN name diff --git a/doc/src/sgml/ref/load.sgml b/doc/src/sgml/ref/load.sgml index 056322f58ed..c62c85f5823 100644 --- a/doc/src/sgml/ref/load.sgml +++ b/doc/src/sgml/ref/load.sgml @@ -1,5 +1,5 @@ @@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.17 2003/04/26 23:56:51 pe load or reload a shared library file + + LOAD + + LOAD 'filename' diff --git a/doc/src/sgml/ref/lock.sgml b/doc/src/sgml/ref/lock.sgml index c39cb154b8e..08cb017454d 100644 --- a/doc/src/sgml/ref/lock.sgml +++ b/doc/src/sgml/ref/lock.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation lock a table + + LOCK + + LOCK [ TABLE ] name [, ...] [ IN lockmode MODE ] diff --git a/doc/src/sgml/ref/move.sgml b/doc/src/sgml/ref/move.sgml index d60ec29c3b5..471e0529790 100644 --- a/doc/src/sgml/ref/move.sgml +++ b/doc/src/sgml/ref/move.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation reposition a cursor + + MOVE + + MOVE [ direction { FROM | IN } ] cursor diff --git a/doc/src/sgml/ref/notify.sgml b/doc/src/sgml/ref/notify.sgml index 82cd1531790..8d6edac63f6 100644 --- a/doc/src/sgml/ref/notify.sgml +++ b/doc/src/sgml/ref/notify.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation generate a notification + + NOTIFY + + NOTIFY name diff --git a/doc/src/sgml/ref/pg_config-ref.sgml b/doc/src/sgml/ref/pg_config-ref.sgml index 084d78b95d0..a14938028cd 100644 --- a/doc/src/sgml/ref/pg_config-ref.sgml +++ b/doc/src/sgml/ref/pg_config-ref.sgml @@ -1,4 +1,4 @@ - + @@ -12,6 +12,10 @@ retrieve information about the installed version of PostgreSQL + + pg_config + + pg_config diff --git a/doc/src/sgml/ref/pg_controldata.sgml b/doc/src/sgml/ref/pg_controldata.sgml index 314022eb925..ea79cadabed 100644 --- a/doc/src/sgml/ref/pg_controldata.sgml +++ b/doc/src/sgml/ref/pg_controldata.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation display control information of a PostgreSQL database cluster + + pg_controldata + + pg_controldata diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index 8aabb33934f..ec6c27d82cc 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation start, stop, or restart a PostgreSQL server + + pg_ctl + + pg_ctl diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 5b9e2d4c40e..57eae7fcc9e 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,5 +1,5 @@ @@ -18,6 +18,10 @@ PostgreSQL documentation + + pg_dump + + pg_dump diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 500336e9196..8c2d6e8322c 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation extract a PostgreSQL database cluster into a script file + + pg_dumpall + + pg_dumpall diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index e342327e74f..77d7860e4ca 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1,4 +1,4 @@ - + @@ -15,6 +15,10 @@ + + pg_restore + + pg_restore diff --git a/doc/src/sgml/ref/pgtclsh.sgml b/doc/src/sgml/ref/pgtclsh.sgml index 2a32d6305e0..bd8710c5c55 100644 --- a/doc/src/sgml/ref/pgtclsh.sgml +++ b/doc/src/sgml/ref/pgtclsh.sgml @@ -1,5 +1,5 @@ @@ -17,6 +17,10 @@ PostgreSQL documentation + + pgtclsh + + pgtclsh diff --git a/doc/src/sgml/ref/pgtksh.sgml b/doc/src/sgml/ref/pgtksh.sgml index bcc052bfdbf..ef7c43f0eff 100644 --- a/doc/src/sgml/ref/pgtksh.sgml +++ b/doc/src/sgml/ref/pgtksh.sgml @@ -1,5 +1,5 @@ @@ -17,6 +17,10 @@ PostgreSQL documentation + + pgtksh + + pgtksh diff --git a/doc/src/sgml/ref/postgres-ref.sgml b/doc/src/sgml/ref/postgres-ref.sgml index 073b83fd7d9..9c961492a9e 100644 --- a/doc/src/sgml/ref/postgres-ref.sgml +++ b/doc/src/sgml/ref/postgres-ref.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation run a PostgreSQL server in single-user mode + + postgres (the program) + + diff --git a/doc/src/sgml/ref/postmaster.sgml b/doc/src/sgml/ref/postmaster.sgml index ed431c6b54b..12d879d44f0 100644 --- a/doc/src/sgml/ref/postmaster.sgml +++ b/doc/src/sgml/ref/postmaster.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation PostgreSQL multiuser database server + + postmaster + + postmaster diff --git a/doc/src/sgml/ref/prepare.sgml b/doc/src/sgml/ref/prepare.sgml index 590772ee2a1..b2a0c040f6b 100644 --- a/doc/src/sgml/ref/prepare.sgml +++ b/doc/src/sgml/ref/prepare.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation prepare a statement for execution + + PREPARE + + PREPARE plan_name [ (datatype [, ...] ) ] AS statement diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 3969a1ad641..35e33e7fe21 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -17,6 +17,10 @@ PostgreSQL documentation + + psql + + psql diff --git a/doc/src/sgml/ref/reindex.sgml b/doc/src/sgml/ref/reindex.sgml index 591542ac1e0..8258b460f17 100644 --- a/doc/src/sgml/ref/reindex.sgml +++ b/doc/src/sgml/ref/reindex.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation rebuild indexes + + REINDEX + + REINDEX { DATABASE | TABLE | INDEX } name [ FORCE ] diff --git a/doc/src/sgml/ref/reset.sgml b/doc/src/sgml/ref/reset.sgml index 87d9de30974..48d75ad9afa 100644 --- a/doc/src/sgml/ref/reset.sgml +++ b/doc/src/sgml/ref/reset.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation restore the value of a run-time parameter to the default value + + RESET + + RESET parameter diff --git a/doc/src/sgml/ref/revoke.sgml b/doc/src/sgml/ref/revoke.sgml index 22cb395a75d..557a219f773 100644 --- a/doc/src/sgml/ref/revoke.sgml +++ b/doc/src/sgml/ref/revoke.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation remove access privileges + + REVOKE + + REVOKE [ GRANT OPTION FOR ] diff --git a/doc/src/sgml/ref/rollback.sgml b/doc/src/sgml/ref/rollback.sgml index dc5b063c495..33c6c3f74ad 100644 --- a/doc/src/sgml/ref/rollback.sgml +++ b/doc/src/sgml/ref/rollback.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation abort the current transaction + + ROLLBACK + + ROLLBACK [ WORK | TRANSACTION ] diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 04d2a36e5b3..9bfe0e90938 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation retrieve rows from a table or view + + SELECT + + SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index 131bb6e1a2f..03330d0b7b9 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation create a new table from the results of a query + + SELECT INTO + + SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index bb1ddd22759..cf9f0468ade 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation change a run-time parameter + + SET + + SET [ SESSION | LOCAL ] variable { TO | = } { value | 'value' | DEFAULT } diff --git a/doc/src/sgml/ref/set_constraints.sgml b/doc/src/sgml/ref/set_constraints.sgml index 3d5b58bee2e..2a5f3ea8eac 100644 --- a/doc/src/sgml/ref/set_constraints.sgml +++ b/doc/src/sgml/ref/set_constraints.sgml @@ -1,4 +1,4 @@ - + SET CONSTRAINTS @@ -10,6 +10,10 @@ set the constraint mode of the current transaction + + SET CONSTRAINTS + + SET CONSTRAINTS { ALL | constraint [, ...] } { DEFERRED | IMMEDIATE } diff --git a/doc/src/sgml/ref/set_session_auth.sgml b/doc/src/sgml/ref/set_session_auth.sgml index f8c0297adad..1978b0bbab5 100644 --- a/doc/src/sgml/ref/set_session_auth.sgml +++ b/doc/src/sgml/ref/set_session_auth.sgml @@ -1,4 +1,4 @@ - + SET SESSION AUTHORIZATION @@ -10,6 +10,10 @@ set the session user identifier and the current user identifier of the current session + + SET SESSION AUTHORIZATION + + SET [ SESSION | LOCAL ] SESSION AUTHORIZATION username diff --git a/doc/src/sgml/ref/set_transaction.sgml b/doc/src/sgml/ref/set_transaction.sgml index 2ff29bc3d5f..9149d557dcf 100644 --- a/doc/src/sgml/ref/set_transaction.sgml +++ b/doc/src/sgml/ref/set_transaction.sgml @@ -1,4 +1,4 @@ - + SET TRANSACTION @@ -10,6 +10,10 @@ set the characteristics of the current transaction + + SET TRANSACTION + + SET TRANSACTION diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index 1f0f52735a0..bbdecc76e2d 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation show the value of a run-time parameter + + SHOW + + SHOW name diff --git a/doc/src/sgml/ref/start_transaction.sgml b/doc/src/sgml/ref/start_transaction.sgml index 5b9abefddd8..26963e80489 100644 --- a/doc/src/sgml/ref/start_transaction.sgml +++ b/doc/src/sgml/ref/start_transaction.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation start a transaction block + + START TRANSACTION + + START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml index b5b9d84ddc8..d0e08e74822 100644 --- a/doc/src/sgml/ref/truncate.sgml +++ b/doc/src/sgml/ref/truncate.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation empty a table + + TRUNCATE + + TRUNCATE [ TABLE ] name diff --git a/doc/src/sgml/ref/unlisten.sgml b/doc/src/sgml/ref/unlisten.sgml index 4c3799177b2..385f6db2e3a 100644 --- a/doc/src/sgml/ref/unlisten.sgml +++ b/doc/src/sgml/ref/unlisten.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation stop listening for a notification + + UNLISTEN + + UNLISTEN { name | * } diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 1fe85b995ed..160eb5ea18e 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation update rows of a table + + UPDATE + + UPDATE [ ONLY ] table SET column = { expression | DEFAULT } [, ...] diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 3f532c02448..7102a3d0d33 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -1,5 +1,5 @@ @@ -14,6 +14,10 @@ PostgreSQL documentation garbage-collect and optionally analyze a database + + VACUUM + + VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ table ] diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index 490d72b5a2f..31390050c29 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -1,5 +1,5 @@ @@ -15,6 +15,10 @@ PostgreSQL documentation garbage-collect and analyze a PostgreSQL database + + vacuumdb + + vacuumdb diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml index a5dac7a1411..d6b0de87f1d 100644 --- a/doc/src/sgml/regress.sgml +++ b/doc/src/sgml/regress.sgml @@ -1,8 +1,16 @@ - + Regression Tests + + regression tests + + + + test + + The regression tests are a comprehensive set of tests for the SQL implementation in PostgreSQL. They test diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml index 66d20cb11b7..b60e7ef08f3 100644 --- a/doc/src/sgml/rules.sgml +++ b/doc/src/sgml/rules.sgml @@ -1,10 +1,10 @@ - + The Rule System - rules + rule @@ -35,6 +35,10 @@ The Query Tree + + query tree + + To understand how the rule system works it is necessary to know when it is invoked and what its input and results are. @@ -146,6 +150,7 @@ the target list + target list The target list is a list of expressions that define the @@ -258,7 +263,16 @@ Views and the Rule System -rulesand views + + + rule + and views + + + + view + implementation through rules + Views in PostgreSQL are implemented @@ -286,9 +300,14 @@ CREATE RULE "_RETURN" AS ON SELECT TO myview DO INSTEAD same thing: relations. - + How <command>SELECT</command> Rules Work + + rule + for SELECT + + Rules ON SELECT are applied to all queries as the last step, even if the command given is an INSERT, @@ -736,7 +755,7 @@ SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = t2.a; To resolve this problem, another entry is added to the target list in UPDATE (and also in DELETE) statements: the current tuple ID - (CTID). This is a system column containing the + (CTID).CTID This is a system column containing the file block number and position in the block for the row. Knowing the table, the CTID can be used to retrieve the original row of t1 to be updated. After adding the CTID @@ -817,6 +836,21 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a; Rules on <command>INSERT</>, <command>UPDATE</>, and <command>DELETE</> + + rule + for INSERT + + + + rule + for UPDATE + + + + rule + for DELETE + + Rules that are defined on INSERT, UPDATE, and DELETE are significantly different from the view rules @@ -1243,7 +1277,7 @@ SELECT shoelace_data.sl_name, 0, Cooperation with Views -viewsupdating +viewupdating A simple way to protect view relations from the mentioned @@ -1654,6 +1688,16 @@ SELECT * FROM shoelace; Rules and Privileges + + privilege + with rules + + + + privilege + with views + + Due to rewriting of queries by the PostgreSQL rule system, other tables/views than those used in the original @@ -1796,6 +1840,16 @@ GRANT SELECT ON phone_number TO secretary; Rules versus Triggers + + rule + compared with triggers + + + + trigger + compared with rules + + Many things that can be done using triggers can also be implemented using the PostgreSQL diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index c3c42309b64..d74cf993d98 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -69,7 +69,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.200 2003/08/17 22:19:10 tg default, although locations such as /usr/local/pgsql/data or /var/lib/pgsql/data are popular. To initialize a - database cluster, use the command initdb, which is + database cluster, use the command initdb,initdb which is installed with PostgreSQL. The desired file system location of your database system is indicated by the option, for example @@ -120,11 +120,13 @@ postgres$ initdb -D /usr/local/pgsql/data However, while the directory contents are secure, the default client authentication setup allows any local user to connect to the - database and even become the database superuser. If you do not trust - other local users, we recommend you use initdb's - or option to assign a - password to the database superuser. After initdb, - modify the pg_hba.conf file to use md5 or + database and even become the database superuser. If you do not + trust other local users, we recommend you use + initdb's or + option to assign a password to the + database superuser.passwordof the + superuser After initdb, modify + the pg_hba.conf file to use md5 or password instead of trust authentication before you start the server for the first time. (Other approaches include using ident authentication or @@ -207,8 +209,9 @@ pg_ctl start -l logfile Normally, you will want to start the database server when the - computer boots. Autostart scripts are operating system-specific. - There are a few distributed with + computer boots.bootingstarting + the server during Autostart scripts are operating + system-specific. There are a few distributed with PostgreSQL in the contrib/start-scripts directory. This may require root privileges. @@ -240,7 +243,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres For FreeBSD, look at the file contrib/start-scripts/freebsd in the PostgreSQL source distribution. - FreeBSD + FreeBSDstart script @@ -248,7 +251,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres On OpenBSD, add the following lines to the file /etc/rc.local: - OpenBSD + OpenBSDstart script if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postmaster ]; then su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres @@ -261,7 +264,7 @@ fi On Linux systems either add - Linux + Linuxstart script /usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data @@ -276,7 +279,7 @@ fi On NetBSD, either use the FreeBSD or Linux start scripts, depending on - preference. NetBSD + preference. NetBSDstart script @@ -285,7 +288,7 @@ fi On Solaris, create a file called /etc/init.d/postgresql that contains the following line: - Solaris + Solarisstart script su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data" @@ -441,7 +444,7 @@ psql: could not connect to server: Connection refused configuration - server + of the server @@ -462,7 +465,7 @@ psql: could not connect to server: Connection refused One way to set these options is to edit the file - postgresql.conf in the data directory. (A + postgresql.confpostgresql.conf in the data directory. (A default file is installed there.) An example of what this file might look like is: @@ -626,7 +629,7 @@ SET ENABLE_SEQSCAN TO OFF; TCPIP_SOCKET (boolean) - If this is true, then the server will accept TCP/IP connections. + If this is true, then the server will accept TCP/IP connections.TCP/IP Otherwise only local Unix domain socket connections are accepted. It is off by default. This option can only be set at server start. @@ -781,7 +784,8 @@ SET ENABLE_SEQSCAN TO OFF; AUTHENTICATION_TIMEOUT (integer) - timeoutauthentication + timeoutclient authentication + client authenticationtimeout during Maximum time to complete client authentication, in seconds. If a @@ -1514,8 +1518,17 @@ SET ENABLE_SEQSCAN TO OFF; Error Reporting and Logging + + server log + + Syslog + + + syslog + + @@ -2137,7 +2150,7 @@ SET ENABLE_SEQSCAN TO OFF; AUSTRALIAN_TIMEZONES (boolean) - Australian time zones + time zoneAustralian If set to true, ACST, @@ -2154,8 +2167,8 @@ SET ENABLE_SEQSCAN TO OFF; significant digits - display - of float numbers + floating-point + display EXTRA_FLOAT_DIGITS (integer) @@ -2175,7 +2188,7 @@ SET ENABLE_SEQSCAN TO OFF; CLIENT_ENCODING (string) - character set encoding + character set Sets the client-side encoding (character set). @@ -2338,7 +2351,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' deadlock - timeout + timeout during timeout @@ -2388,12 +2401,12 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' Version and Platform Compatibility - Previous Postgres Versions + Previous PostgreSQL Versions ADD_MISSING_FROM (boolean) - missing from + FROMmissing When true, tables that are referenced by a query will be @@ -2913,7 +2926,7 @@ $ postmaster -o '-S 1024 -s' BSD/OS - BSD/OS + BSD/OSIPC configuration Shared Memory</> @@ -2974,9 +2987,9 @@ options "SEMMNS=240" <term><systemitem class="osname">FreeBSD</></term> <term><systemitem class="osname">NetBSD</></term> <term><systemitem class="osname">OpenBSD</></term> - <indexterm><primary>FreeBSD</></> - <indexterm><primary>NetBSD</></> - <indexterm><primary>OpenBSD</></> + <indexterm><primary>FreeBSD</><secondary>IPC configuration</></> + <indexterm><primary>NetBSD</><secondary>IPC configuration</></> + <indexterm><primary>OpenBSD</><secondary>IPC configuration</></> <listitem> <para> The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need @@ -3010,7 +3023,7 @@ options SEMMAP=256 <varlistentry> <term><systemitem class="osname">HP-UX</></term> - <indexterm><primary>HP-UX</></> + <indexterm><primary>HP-UX</><secondary>IPC configuration</></> <listitem> <para> The default settings tend to suffice for normal installations. @@ -3031,7 +3044,7 @@ options SEMMAP=256 <varlistentry> <term><systemitem class="osname">Linux</></term> - <indexterm><primary>Linux</></> + <indexterm><primary>Linux</><secondary>IPC configuration</></> <listitem> <para> The default shared memory limit (both @@ -3084,7 +3097,7 @@ sysctl -w vm.overcommit_memory=3 <varlistentry> <term><systemitem class="osname">MacOS X</></term> - <indexterm><primary>MacOS X</></> + <indexterm><primary>MacOS X</><secondary>IPC configuration</></> <listitem> <para> Edit the file @@ -3104,7 +3117,7 @@ sysctl -w kern.sysv.shmall <varlistentry> <term><systemitem class="osname">SCO OpenServer</></term> - <indexterm><primary>SCO OpenServer</></> + <indexterm><primary>SCO OpenServer</><secondary>IPC configuration</></> <listitem> <para> In the default configuration, only 512 kB of shared memory per @@ -3132,7 +3145,7 @@ sysctl -w kern.sysv.shmall <varlistentry> <term><systemitem class="osname">Solaris</></term> - <indexterm><primary>Solaris</></> + <indexterm><primary>Solaris</><secondary>IPC configuration</></> <listitem> <para> At least in version 2.6, the default maximum size of a shared @@ -3165,7 +3178,7 @@ set semsys:seminfo_semmsl=32 <varlistentry> <term><systemitem class="osname">UnixWare</></term> - <indexterm><primary>UnixWare</></> + <indexterm><primary>UnixWare</><secondary>IPC configuration</></> <listitem> <para> On <productname>UnixWare</> 7, the maximum size for shared @@ -3285,13 +3298,17 @@ default:\ <sect1 id="postmaster-shutdown"> <title>Shutting Down the Server + + shutdown + + There are several ways to shut down the database server. You control the type of shutdown by sending different signals to the server process. - SIGTERM + SIGTERMSIGTERM After receiving SIGTERM, the server @@ -3304,7 +3321,7 @@ default:\ - SIGINT + SIGINTSIGINT The server disallows new connections and sends all existing @@ -3317,7 +3334,7 @@ default:\ - SIGQUIT + SIGQUITSIGQUIT This is the Immediate Shutdown, which diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml index f3b11b5a1c9..f8c6c2cd949 100644 --- a/doc/src/sgml/spi.sgml +++ b/doc/src/sgml/spi.sgml @@ -1,5 +1,5 @@ @@ -1655,7 +1655,7 @@ char * SPI_getrelname(Relation rel) PostgreSQL allocates memory within memory contextsmemory - context, which provide a convenient method of + contextin SPI, which provide a convenient method of managing allocations made in many different places that need to live for differing amounts of time. Destroying a context releases all the memory that was allocated in it. Thus, it is not necessary diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 8372fa6b348..aa05367d163 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,5 +1,5 @@ @@ -26,6 +26,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.83 2003/08/19 06:06:48 tgl Lexical Structure + + token + + SQL input consists of a sequence of commands. A command is composed of a @@ -80,12 +84,18 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); Identifiers and Key Words - identifiers + identifier + syntax of - key words - syntax + name + syntax of + + + + key word + syntax of @@ -121,6 +131,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); + identifierlength The system uses no more than NAMEDATALEN-1 characters of an identifier; longer names can be written in commands, but they will be truncated. By default, @@ -133,7 +144,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); case sensitivity - SQL commands + of SQL commands Identifier and key word names are case insensitive. Therefore @@ -152,7 +163,7 @@ UPDATE my_table SET a = 5; - quotes + quotation marks and identifiers There is a second kind of identifier: the delimited @@ -207,7 +218,7 @@ UPDATE "my_table" SET "a" = 5; Constants - constants + constant @@ -224,13 +235,13 @@ UPDATE "my_table" SET "a" = 5; String Constants - character strings - constants + character string + constant - quotes + quotation marks escaping A string constant in SQL is an arbitrary sequence of characters @@ -286,8 +297,8 @@ SELECT 'foo' 'bar'; Bit-String Constants - bit strings - constants + bit string + constant @@ -316,8 +327,8 @@ SELECT 'foo' 'bar'; Numeric Constants - numeric - constants + number + constant @@ -351,6 +362,9 @@ SELECT 'foo' 'bar'; + integer + bigint + numeric A numeric constant that contains neither a decimal point nor an exponent is initially presumed to be type integer if its value fits in type integer (32 bits); otherwise it is @@ -363,13 +377,13 @@ SELECT 'foo' 'bar'; The initially assigned data type of a numeric constant is just a - starting point for the type resolution algorithms. In most - cases the constant will be automatically coerced to the most - appropriate type depending on context. When necessary, you - can force a numeric value to be interpreted as a specific - data type by casting it. For example, you can force a numeric - value to be treated as type real (float4) - by writing + starting point for the type resolution algorithms. In most cases + the constant will be automatically coerced to the most + appropriate type depending on context. When necessary, you can + force a numeric value to be interpreted as a specific data type + by casting it.type cast + For example, you can force a numeric value to be treated as type + real (float4) by writing REAL '1.23' -- string style @@ -382,8 +396,8 @@ REAL '1.23' -- string style Constants of Other Types - data types - constants + data type + constant @@ -431,8 +445,8 @@ CAST ( 'string' AS type ) Array constants - arrays - constants + array + constant @@ -468,7 +482,7 @@ CAST ( 'string' AS type ) Operators - operators + operator syntax @@ -600,8 +614,8 @@ CAST ( 'string' AS type ) Comments - comments - in SQL + comment + in SQL @@ -636,7 +650,7 @@ CAST ( 'string' AS type ) Lexical Precedence - operators + operator precedence @@ -828,6 +842,20 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; Value Expressions + + expression + syntax + + + + value expression + + + + scalar + expression + + Value expressions are used in a variety of contexts, such as in the target list of the SELECT command, as @@ -903,7 +931,9 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; - Another value expression in parentheses, useful to group subexpressions and override precedence. + Another value expression in parentheses, useful to group + subexpressions and override + precedence.parenthesis @@ -927,6 +957,10 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; Column References + + column reference + + A column can be referenced in the form @@ -962,6 +996,15 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; Positional Parameters + + parameter + syntax + + + + $ + + A positional parameter reference is used to indicate a value that is supplied externally to an SQL statement. Parameters are @@ -993,6 +1036,11 @@ CREATE FUNCTION dept(text) RETURNS dept Operator Invocations + + operator + invocation + + There are three possible syntaxes for an operator invocation: @@ -1017,6 +1065,11 @@ CREATE FUNCTION dept(text) RETURNS dept Function Calls + + function + invocation + + The syntax for a function call is the name of a function (possibly qualified with a schema name), followed by its argument list @@ -1044,7 +1097,8 @@ sqrt(2) Aggregate Expressions - aggregate functions + aggregate function + invocation @@ -1123,10 +1177,14 @@ sqrt(2) Type Casts - - data types - type casts - + + data type + type cast + + + + type cast + A type cast specifies a conversion from one data type to another. @@ -1193,6 +1251,10 @@ CAST ( expression AS type Scalar Subqueries + + subquery + + A scalar subquery is an ordinary SELECT query in parentheses that returns exactly one @@ -1221,10 +1283,10 @@ SELECT name, (SELECT max(pop) FROM cities WHERE cities.state = states.name) Array Constructors - - arrays - constructors - + + array + constructor + An array constructor is an expression that builds an @@ -1316,6 +1378,11 @@ SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%'); Expression Evaluation Rules + + expression + order of evaluation + + The order of evaluation of subexpressions is not defined. In particular, the inputs of an operator or function are not necessarily diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml index d9ee33a2963..a4eb485bf59 100644 --- a/doc/src/sgml/trigger.sgml +++ b/doc/src/sgml/trigger.sgml @@ -1,10 +1,14 @@ Triggers + + trigger + + This chapter describes how to write trigger functions. In particular, it describes the C-language interface for trigger @@ -98,18 +102,20 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl When a trigger is being defined, arguments can be specified for - it. The purpose of including arguments in the trigger definition - is to allow different triggers with similar requirements to call - the same function. As an example, there could be a generalized - trigger function that takes as its arguments two column names and - puts the current user in one and the current time stamp in the - other. Properly written, this trigger function would be - independent of the specific table it is triggering on. So the - same function could be used for INSERT events - on any table with suitable columns, to automatically track creation - of records in a transaction table for example. It could also be - used to track last-update events if defined as an - UPDATE trigger. + it.triggerarguments for trigger + functions The purpose of including arguments in the + trigger definition is to allow different triggers with similar + requirements to call the same function. As an example, there + could be a generalized trigger function that takes as its + arguments two column names and puts the current user in one and + the current time stamp in the other. Properly written, this + trigger function would be independent of the specific table it is + triggering on. So the same function could be used for + INSERT events on any table with suitable + columns, to automatically track creation of records in a + transaction table for example. It could also be used to track + last-update events if defined as an UPDATE + trigger. @@ -117,6 +123,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl Interaction with the Trigger Manager + + trigger + in C + + This section describes the low-level details of the interface to a trigger function. This information is only needed when writing a diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml index 18bad527ff7..d93a91b5ed6 100644 --- a/doc/src/sgml/typeconv.sgml +++ b/doc/src/sgml/typeconv.sgml @@ -1,10 +1,15 @@ Type Conversion + + data type + conversion + + SQL statements can, intentionally or not, require mixing of different data types in the same expression. @@ -139,6 +144,11 @@ between the built-in types has been carefully crafted and is best not altered.) + + data type + category + + An additional heuristic is provided in the parser to allow better guesses at proper behavior for SQL standard types. There are @@ -204,6 +214,11 @@ should use this new function and will no longer do the implicit conversion using Operators + + operator + type resolution in an invocation + + The specific operator to be used in an operator invocation is determined by following @@ -452,6 +467,11 @@ SELECT CAST('20' AS int8) ! AS "factorial"; Functions + + function + type resolution in an invocation + + The specific function to be used in a function invocation is determined according to the following steps. @@ -755,8 +775,22 @@ padding spaces. -<literal>UNION</literal>, <literal>CASE</literal>, and -<literal>ARRAY</literal> Constructs +<literal>UNION</literal>, <literal>CASE</literal>, and <literal>ARRAY</literal> Constructs + + + UNION + determination of result type + + + + CASE + determination of result type + + + + ARRAY + determination of result type + SQL UNION constructs must match up possibly dissimilar types to diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index 660d1ccd75d..8eca4794833 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -1,5 +1,5 @@ @@ -22,6 +22,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/user-manag.sgml,v 1.21 2003/08/10 01:20:34 Database Users + + user + + + + CREATE USER + + + + DROP USER + + Database users are conceptually completely separate from operating system users. In practice it might be convenient to @@ -41,6 +53,14 @@ DROP USER name; + + createuser + + + + dropuser + + For convenience, the programs createuser and dropuser are provided as wrappers @@ -99,7 +119,7 @@ dropuser name - superuser + superusersuperuser A database superuser bypasses all permission checks. Also, @@ -111,7 +131,7 @@ dropuser name - database creation + database creationdatabaseprivilege to create A user must be explicitly given permission to create databases @@ -123,7 +143,7 @@ dropuser name - password + passwordpassword A password is only significant if the client authentication @@ -140,7 +160,7 @@ dropuser name A user's attributes can be modified after creation with - ALTER USER. + ALTER USER.ALTER USER See the reference pages for CREATE USER and ALTER USER for details. @@ -166,6 +186,10 @@ ALTER USER myname SET enable_indexscan TO off; Groups + + group + + As in Unix, groups are a way of logically grouping users to ease management of privileges: privileges can be granted to, or revoked @@ -184,6 +208,22 @@ ALTER GROUP name DROP USER uname1 Privileges + + privilege + + + + owner + + + + GRANT + + + + REVOKE + + Being moved to the DDL chapter. Will eventually disappear here. diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml index 279364a65d8..2d3f574e391 100644 --- a/doc/src/sgml/wal.sgml +++ b/doc/src/sgml/wal.sgml @@ -1,8 +1,17 @@ - + Write-Ahead Logging (<acronym>WAL</acronym>) + + WAL + + + + transaction log + WAL + + Write-Ahead Logging (WAL) is a standard approach to transaction logging. Its detailed @@ -24,6 +33,10 @@ Benefits of <acronym>WAL</acronym> + + fsync + + The first obvious benefit of using WAL is a significantly reduced number of disk writes, since only the log @@ -86,7 +99,7 @@ With UNDO, it will also be possible to implement - savepoints to allow partial rollback of + savepointssavepoint to allow partial rollback of invalid transaction operations (parser errors caused by mistyping commands, insertion of duplicate primary/unique keys and so on) with the ability to continue or commit valid operations made by @@ -133,7 +146,7 @@ - Checkpoints are points in the sequence of + Checkpointscheckpoint are points in the sequence of transactions at which it is guaranteed that the data files have been updated with all information logged before the checkpoint. At checkpoint time, all dirty data pages are flushed to disk and a @@ -301,7 +314,7 @@ The aim of WAL, to ensure that the log is written before database records are altered, may be subverted by - disk drives that falsely report a successful write to the kernel, + disk drivesdisk drive that falsely report a successful write to the kernel, when, in fact, they have only cached the data and not yet stored it on the disk. A power failure in such a situation may still lead to irrecoverable data corruption. Administrators should try to ensure diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml index 7b82af322ea..8f1bda7e79a 100644 --- a/doc/src/sgml/xaggr.sgml +++ b/doc/src/sgml/xaggr.sgml @@ -1,13 +1,13 @@ User-Defined Aggregates - aggregate functions - extending + aggregate function + user-defined @@ -115,7 +115,7 @@ CREATE AGGREGATE avg ( Aggregate functions may use polymorphic state transition functions or final functions, so that the same functions can be used to implement multiple aggregates. - See + See for an explanation of polymorphic functions. Going a step further, the aggregate function itself may be specified with a polymorphic base type and state type, allowing a single diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 0193691a08e..8d323c6879b 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,11 +1,14 @@ User-Defined Functions - function + + function + user-defined + PostgreSQL provides four kinds of @@ -70,7 +73,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E Query Language (<acronym>SQL</acronym>) Functions - functionSQL + + function + user-defined + in SQL + SQL functions execute an arbitrary list of SQL statements, returning @@ -84,12 +91,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E - SETOFfunction - Alternatively, an SQL function may be declared to return a set, - by specifying the function's return type - as SETOF sometype. In this case - all rows of the last query's result are returned. Further details - appear below. + SETOFfunction Alternatively, + an SQL function may be declared to return a set, by specifying the + function's return type as SETOF + sometype.SETOF + In this case all rows of the last query's result are returned. + Further details appear below. @@ -523,7 +530,7 @@ SELECT name, listchildren(name) FROM nodes; SQL functions may be declared to accept and return the polymorphic types anyelement and anyarray. - See for a more detailed explanation + See for a more detailed explanation of polymorphic functions. Here is a polymorphic function make_array that builds up an array from two arbitrary data type elements: @@ -644,6 +651,12 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision C-Language Functions + + function + user-defined + in C + + User-defined functions can be written in C (or a language that can be made compatible with C, such as C++). Such functions are @@ -670,6 +683,10 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision Dynamic Loading + + dynamic loading + + The first time a user-defined function in a particular loadable object file is called in a session, @@ -787,9 +804,14 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision - + Base Types in C-Language Functions + + data type + internal organisation + + To know how to write C-language functions, you need to know how PostgreSQL internally represents base data types and how they can @@ -1479,7 +1501,7 @@ concat_text(PG_FUNCTION_ARGS) Use pg_config - --includedir-serverpg_config + --includedir-serverpg_configwith user-defined C functions to find out where the PostgreSQL server header files are installed on your system (or the system that your users will be running on). This option is new with @@ -1498,7 +1520,7 @@ concat_text(PG_FUNCTION_ARGS) When allocating memory, use the PostgreSQL functions - palloc and pfree + pallocpalloc and pfreepfree instead of the corresponding C library functions malloc and free. The memory allocated by palloc will be @@ -2075,7 +2097,7 @@ CREATE OR REPLACE FUNCTION testpassbyval(integer, integer) RETURNS SETOF __testp C-language functions may be declared to accept and return the polymorphic types anyelement and anyarray. - See for a more detailed explanation + See for a more detailed explanation of polymorphic functions. When function arguments or return types are defined as polymorphic types, the function author cannot know in advance what data type it will be called with, or @@ -2155,7 +2177,10 @@ CREATE FUNCTION make_array(anyelement) Function Overloading - overloading + + overloading + functions + More than one function may be defined with the same SQL name, so long @@ -2216,6 +2241,11 @@ CREATE FUNCTION test(int, int) RETURNS int Procedural Language Handlers + + procedural language + handler for + + All calls to functions that are written in a language other than the current version 1 interface for compiled diff --git a/doc/src/sgml/xindex.sgml b/doc/src/sgml/xindex.sgml index bd5d1fe78bf..4d99f5dea0c 100644 --- a/doc/src/sgml/xindex.sgml +++ b/doc/src/sgml/xindex.sgml @@ -1,10 +1,15 @@ Interfacing Extensions To Indexes + + index + for user-defined data type + + The procedures described thus far let you define new types, new functions, and new operators. However, we cannot yet define an @@ -43,15 +48,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.31 2003/08/17 22:09:00 tgl The routines for an index method do not directly know anything - about the data types that the index method will operate on. Instead, an - operator class identifies the set of operations that the - index method needs to use to work with a particular data type. - Operator classes are so called because one thing they specify is the set - of WHERE-clause operators that can be used with an index (i.e., can be - converted into an index-scan qualification). An operator class may also - specify some support procedures that are needed by the - internal operations of the index method, but do not directly - correspond to any WHERE-clause operator that can be used with the index. + about the data types that the index method will operate on. + Instead, an operator + classoperator class + identifies the set of operations that the index method needs to use + to work with a particular data type. Operator classes are so + called because one thing they specify is the set of + WHERE-clause operators that can be used with an index + (i.e., can be converted into an index-scan qualification). An + operator class may also specify some support + procedures that are needed by the internal operations of the + index method, but do not directly correspond to any + WHERE-clause operator that can be used with the index. diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml index dc03c3e7e40..ab5f38be751 100644 --- a/doc/src/sgml/xoper.sgml +++ b/doc/src/sgml/xoper.sgml @@ -1,10 +1,15 @@ User-defined Operators + + operator + user-defined + + Every operator is syntactic sugar for a call to an underlying function that does the real work; so you must @@ -18,9 +23,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.25 2003/08/17 22:09:00 tgl E PostgreSQL supports left unary, right - unary, and binary operators. Operators can be overloaded; that is, - the same operator name can be used for different operators that - have different numbers and types of operands. When a query is + unary, and binary operators. Operators can be + overloaded;overloadingoperators + that is, the same operator name can be used for different operators + that have different numbers and types of operands. When a query is executed, the system determines the operator to call from the number and types of the provided operands. diff --git a/doc/src/sgml/xplang.sgml b/doc/src/sgml/xplang.sgml index d350ba25ea8..c05c4948a2c 100644 --- a/doc/src/sgml/xplang.sgml +++ b/doc/src/sgml/xplang.sgml @@ -1,10 +1,14 @@ Procedural Languages + + procedural language + + PostgreSQL allows users to add new programming languages to be available for writing functions and diff --git a/doc/src/sgml/xtypes.sgml b/doc/src/sgml/xtypes.sgml index 74ced8cd83e..11981a5b198 100644 --- a/doc/src/sgml/xtypes.sgml +++ b/doc/src/sgml/xtypes.sgml @@ -1,13 +1,13 @@ User-Defined Types - data types - extending + data type + user-defined @@ -34,13 +34,17 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xtypes.sgml,v 1.19 2003/08/10 01:20:34 tgl output function - A user-defined type must always have input and output functions. + A user-defined type must always have input and output + functions.input functionof + a data typeoutput + functionof a data type These functions determine how the type appears in strings (for input by the user and output to the user) and how the type is organized in memory. The input function takes a null-terminated character string - as its argument and returns the internal (in memory) representation of - the type. The output function takes the internal representation of - the type as argument and returns a null-terminated character string. + as its argument and returns the internal (in memory) representation + of the type. The output function takes the internal representation + of the type as argument and returns a null-terminated character + string. -- cgit v1.2.3