11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 petere Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.16 2001/11/21 05:53:40 thomas Exp $
33-->
44
55 <chapter id="overview">
@@ -17,11 +17,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
1717
1818 <para>
1919 This chapter gives an overview of the internal structure of the
20- backend of <productname>Postgres </productname>.
20+ backend of <productname>PostgreSQL </productname>.
2121 After having read the following sections you
2222 should have an idea of how a query is processed. Don't expect a
2323 detailed description here (I think such a description dealing with
24- all data structures and functions used within <productname>Postgres </productname>
24+ all data structures and functions used within <productname>PostgreSQL </productname>
2525 would exceed 1000
2626 pages!). This chapter is intended to help understanding the general
2727 control and data flow within the backend from receiving a query to
@@ -39,7 +39,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
3939 <procedure>
4040 <step>
4141 <para>
42- A connection from an application program to the <productname>Postgres </productname>
42+ A connection from an application program to the <productname>PostgreSQL </productname>
4343 server has to be established. The application program transmits a
4444 query to the server and receives the results sent back by the server.
4545 </para>
@@ -109,7 +109,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
109109
110110 <para>
111111 In the following sections we will cover every of the above listed items
112- in more detail to give a better understanding on <productname>Postgres </productname>'s internal
112+ in more detail to give a better understanding on <productname>PostgreSQL </productname>'s internal
113113 control and data structures.
114114 </para>
115115 </sect1>
@@ -118,7 +118,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
118118 <title>How Connections are Established</title>
119119
120120 <para>
121- <productname>Postgres </productname> is implemented using a simple "process per-user"
121+ <productname>PostgreSQL </productname> is implemented using a simple "process per-user"
122122 client/server model. In this model there is one <firstterm>client process</firstterm>
123123 connected to exactly one <firstterm>server process</firstterm>.
124124 As we don't know <foreignphrase>per se</foreignphrase>
@@ -142,7 +142,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
142142 interactive SQL queries) or any user application implemented using
143143 the <filename>libpg</filename> library. Note that applications implemented using
144144 <application>ecpg</application>
145- (the <productname>Postgres </productname> embedded SQL preprocessor for C)
145+ (the <productname>PostgreSQL </productname> embedded SQL preprocessor for C)
146146 also use this library.
147147 </para>
148148
@@ -236,7 +236,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
236236 <para>
237237 The mentioned transformations and compilations are normally done
238238 automatically using the <firstterm>makefiles</firstterm>
239- shipped with the <productname>Postgres </productname>
239+ shipped with the <productname>PostgreSQL </productname>
240240 source distribution.
241241 </para>
242242 </note>
@@ -255,7 +255,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/arch-dev.sgml,v 2.15 2001/11/08 23:34:33 pe
255255
256256 <para>
257257 For a better understanding of the data structures used in
258- <productname>Postgres </productname>
258+ <productname>PostgreSQL </productname>
259259 for the processing of a query we use an example to illustrate the
260260 changes made to these data structures in every stage.
261261 This example contains the following simple query that will be used in
@@ -443,13 +443,13 @@ current context are performed.
443443 </sect1>
444444
445445 <sect1 id="rule-system">
446- <title>The <productname>Postgres </productname> Rule System</title>
446+ <title>The <productname>PostgreSQL </productname> Rule System</title>
447447
448448 <para>
449- <productname>Postgres </productname> supports a powerful
449+ <productname>PostgreSQL </productname> supports a powerful
450450 <firstterm>rule system</firstterm> for the specification
451451 of <firstterm>views</firstterm> and ambiguous <firstterm>view updates</firstterm>.
452- Originally the <productname>Postgres </productname>
452+ Originally the <productname>PostgreSQL </productname>
453453 rule system consisted of two implementations:
454454
455455 <itemizedlist>
@@ -459,7 +459,7 @@ current context are performed.
459459 implemented deep in the <firstterm>executor</firstterm>. The rule system was
460460 called whenever an individual tuple had been accessed. This
461461 implementation was removed in 1995 when the last official release
462- of the <productname>Postgres </productname> project was transformed into
462+ of the <productname>PostgreSQL </productname> project was transformed into
463463 <productname>Postgres95</productname>.
464464 </para>
465465 </listitem>
@@ -478,7 +478,7 @@ current context are performed.
478478
479479 <para>
480480 For information on the syntax and creation of rules in the
481- <productname>Postgres </productname> system refer to
481+ <productname>PostgreSQL </productname> system refer to
482482 <citetitle>The PostgreSQL User's Guide</citetitle>.
483483 </para>
484484
@@ -700,7 +700,7 @@ current context are performed.
700700 Another task performed by the planner/optimizer is fixing the
701701 <firstterm>operator ids</firstterm> in the <literal>Expr</literal>
702702 and <literal>Oper</literal> nodes. As
703- mentioned earlier, <productname>Postgres </productname> supports a variety of different data
703+ mentioned earlier, <productname>PostgreSQL </productname> supports a variety of different data
704704 types and even user defined types can be used. To be able to maintain
705705 the huge amount of functions and operators it is necessary to store
706706 them in a system table. Each function and operator gets a unique
@@ -1181,7 +1181,7 @@ transformInsertStmt()} above have been added here as well.
11811181\subsubsection{The Rewrite System}
11821182
11831183This section describes the changes to the {\it rewrite system} of
1184- <productname>Postgres </productname> that have been necessary to support the use of {\it views}
1184+ <productname>PostgreSQL </productname> that have been necessary to support the use of {\it views}
11851185within queries using a {\it having clause} and to support the
11861186definition of {\it views} by queries using a {\it having clause}.
11871187
@@ -1395,7 +1395,7 @@ items. Note that it is not necessary to understand the meaning of
13951395every single source line here and therefore we will not discuss
13961396detailed questions like "Why has the variable {\tt varno} to be
13971397increased by 3?". Questions like that belong to a chapter dealing
1398- with the implementation of {\it views} in <productname>Postgres </productname> and to be able to
1398+ with the implementation of {\it views} in <productname>PostgreSQL </productname> and to be able to
13991399answer them it would be necessary to know all the functions and not
14001400only those described here. The fact important for us is to make sure,
14011401that whatever is applied to the {\it targetlist} and the data
@@ -1538,7 +1538,7 @@ examined.
15381538%
15391539<step> {\tt QueryRewrite()} \\
15401540This function takes the {\it parsetree} of a query and rewrites it
1541- using <productname>Postgres </productname>'s {\it rewrite system}. Before the query itself can be
1541+ using <productname>PostgreSQL </productname>'s {\it rewrite system}. Before the query itself can be
15421542rewritten, subqueries that are possibly part of the query have to be
15431543processed. Therefore the function {\tt QueryRewriteSubLink()} is
15441544called for the {\it where clause} and for the {\it having clause}.
@@ -2750,7 +2750,7 @@ produced by the {\it parser stage} that can be executed by the {\it
27502750executor}. In most cases there are several ways (paths) with different
27512751cost to get to the same result. It's the {\it planner/optimizer's}
27522752task to find out which path is the cheapest and to create a {\it plan}
2753- using this path. The implementation of {\it unions} in <productname>Postgres </productname> is
2753+ using this path. The implementation of {\it unions} in <productname>PostgreSQL </productname> is
27542754based on the following idea: \\
27552755\\
27562756The set derived by evaluating $A \cup B$ must contain every member of
@@ -2786,7 +2786,7 @@ and the sort is just performed to make its work easier.
27862786\subsection{How Intersect, Except and Union Work Together}
27872787
27882788The last section showed that every stage ({\it parser stage}, {\it
2789- planner/optimizer}, {\it executor}) of <productname>Postgres </productname> has to provide
2789+ planner/optimizer}, {\it executor}) of <productname>PostgreSQL </productname> has to provide
27902790features in order to support {\it union} statements. For the
27912791implementation of {\it intersect} and {\it except} statements (and
27922792statements involving all {\it set operators}) we choose a different approach
@@ -3039,7 +3039,7 @@ file {\tt $\ldots$/src/backend/parser/keywords.c}:
30393039 };
30403040\end{verbatim}
30413041%
3042- <step> <productname>Postgres </productname> contains functions to convert the internal
3042+ <step> <productname>PostgreSQL </productname> contains functions to convert the internal
30433043representation of a {\it parsetree} or {\it plantree} into an ASCII
30443044representation (that can easily be printed to the screen (for
30453045debugging purposes) or be stored in a file) and vice versa. These
@@ -3629,7 +3629,7 @@ troubles in the {\it transforming logic}.
36293629\end{figure}
36303630%
36313631<step> Transform the new {\it operator tree} into DNF (disjunctive normal
3632- form). <productname>Postgres </productname> does not provide any function for the transformation
3632+ form). <productname>PostgreSQL </productname> does not provide any function for the transformation
36333633into DNF but it provides a function {\tt cnfify()} that performs a
36343634transformation into CNF (conjunctive normal form). So we can easily
36353635make use of this function when we exchange every {\tt OR} with an {\tt