Various small doc improvements; plpgsql, schemas, permissions, oidvector

Started by Karl O. Pincover 2 years ago22 messages
#1Karl O. Pinc
kop@karlpinc.com
1 attachment(s)

Hi,

I have made various, mostly unrelated to each other,
small improvements to the documentation. These
are usually in the areas of plpgsql, schemas, and permissions.
Most change 1 lines, but some supply short overviews.

"Short" is subjective, so if these need to be
broken into different threads or different
commitfest entries let me know. I'm starting
simple and submitting a single patch.

Attached: various_doc_patches_v1.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

various_doc_patches_v1.patchtext/x-patchDownload
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..ea70dd3597 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,7 +10,27 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
+   the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in the documentation.
+   The pg_settings view into the system catalogs can provide such summaries,
+   e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected database and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
+   In the first section of this chapter we
    describe how to interact with configuration parameters. The subsequent sections
    discuss each parameter in detail.
   </para>
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..df8a373652 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,12 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified access
+    refers only to objects in the public schema.
    </para>
 
    <para>
@@ -3162,6 +3162,53 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..00acf501ee 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Referencing the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row Command Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Exceptions and Error Trapping</title>
 
     <indexterm>
      <primary>exceptions</primary>
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..425eac3b61 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -9,9 +9,23 @@
   either a database user, or a group of database users, depending on how
   the role is set up.  Roles can own database objects (for example, tables
   and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  control who has access to which objects.
+ </para>
+
+ <para>
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
+  This can happen automatically, if the role given membership has
+  the <literal>INHERIT</literal> attribute, or manually, via a <literal>SET
+  ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Karl O. Pinc (#1)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On 25 Sep 2023, at 00:57, Karl O. Pinc <kop@karlpinc.com> wrote:

I have made various, mostly unrelated to each other,
small improvements to the documentation. These
are usually in the areas of plpgsql, schemas, and permissions.
Most change 1 lines, but some supply short overviews.

"Short" is subjective, so if these need to be
broken into different threads or different
commitfest entries let me know.

While I agree it's subjective, I don't think adding a new section or paragraph
qualifies as short or small. I would prefer if each (related) change is in a
single commit with a commit message which describes the motivation for the
change. A reviewer can second-guess the rationale for the changes, but they
shouldn't have to.

The resulting patchset can all be in the same thread though.

--
Daniel Gustafsson

#3Karl O. Pinc
kop@karlpinc.com
In reply to: Daniel Gustafsson (#2)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Mon, 25 Sep 2023 09:26:38 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

On 25 Sep 2023, at 00:57, Karl O. Pinc <kop@karlpinc.com> wrote:

I have made various, mostly unrelated to each other,
small improvements to the documentation.

While I agree it's subjective, I don't think adding a new section or
paragraph qualifies as short or small. I would prefer if each
(related) change is in a single commit with a commit message which
describes the motivation for the change. A reviewer can second-guess
the rationale for the changes, but they shouldn't have to.

Will do. Is there a preferred data format or should I send
each patch in a separate attachment with description?

The resulting patchset can all be in the same thread though.

Thanks.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#4Daniel Gustafsson
daniel@yesql.se
In reply to: Karl O. Pinc (#3)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On 25 Sep 2023, at 14:00, Karl O. Pinc <kop@karlpinc.com> wrote:

Is there a preferred data format or should I send
each patch in a separate attachment with description?

The easiest way would be to create a patchset off of master I think. In a
branch, commit each change with an explanatory commit message. Once done you
can do "git format-patch origin/master -v 1" which will generate a set of n
patches named v1-0001 through v1-000n. You can then attache those to the
thread. This will make it easier for a reviewer, and it's easy to apply them
in the right order in case one change depends on another earlier change.

--
Daniel Gustafsson

#5Karl O. Pinc
kop@karlpinc.com
In reply to: Daniel Gustafsson (#4)
11 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

On 25 Sep 2023, at 14:00, Karl O. Pinc <kop@karlpinc.com> wrote:

Is there a preferred data format or should I send
each patch in a separate attachment with description?

Once done you can do "git format-patch origin/master -v 1" which will
generate a set of n patches named v1-0001 through v1-000n. You can
then attache those to the thread.

Done. 11 patches attached. Thanks for the help.

(This is v2, since I made some changes upon review.)

I am not particularly confident in the top-line commit
descriptions. Some seem kind of long and not a whole
lot of thought went into them. But the commit descriptions
are for the committer to decide anyway.

The bulk of the commit descriptions are very wordy
and will surely need at least some editing.

Listing all the attachments here for future discussion:

v2-0001-Change-section-heading-to-better-reflect-saving-a.patch
v2-0002-Change-section-heading-to-better-describe-referen.patch
v2-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v2-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v2-0005-Improve-sentences-in-overview-of-system-configura.patch
v2-0006-Provide-examples-of-listing-all-settings.patch
v2-0007-Cleanup-summary-of-role-powers.patch
v2-0008-Explain-the-difference-between-role-attributes-an.patch
v2-0009-Document-the-oidvector-type.patch
v2-0010-Improve-sentences-about-the-significance-of-the-s.patch
v2-0011-Add-a-sub-section-to-describe-schema-resolution.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v2-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v2 01/11] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v2-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v2 02/11] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v2-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 0252dd434bb9ab2487cd37a93912d19ca1ef5149 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v2 03/11] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
"Trapping Errors" is not a good section title for these reasons, and
because when it comes to programmatically raising errors in Pl/PgSQL
you don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Handling and Exception Trapping" is a little long but it does
accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions and how the programmer can trap exceptions and
affect the program's flow of control.  The "Exception" does not stand
out as much as I'd like on a scan of the table of contents, but
enough.  I left "Error" in the title since the word "error" is used so
frequently in the docs, and the section is also about what happens
when there is any sort of PG error, not just those raised in user
code.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..646d0305eb 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Handling and Exception Trapping</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v2-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From f1547ccab10a41ac3d58aa49c540d5bb845507a1 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v2 04/11] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 646d0305eb..3cecf7bbd9 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v2-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 43901ae60cc8471c99f585283bc0d756b4166d6e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v2 05/11] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v2-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From e9aa07fdb7ea6beb3d62f821e42bace5cecb6ce7 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v2 06/11] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v2-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From 94cd14a74a19c3332b1a0d33484d12ab7a60d596 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v2 07/11] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v2-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From e838989f040dfced1533729ead0fca3551cdc78b Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v2 08/11] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v2-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 20bf83047dcf08bd3d65b25889dee9e559a152db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v2 09/11] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v2-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From efba1692e299769ff42dc1ecdc6f4d60daf54df7 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v2 10/11] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v2-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From 21e1015e5266fda74853e69bcfb8027802e6dbc3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v2 11/11] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

#6Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#5)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Version 3.

Re-do title, which is all of patch v3-003.

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1" which
will generate a set of n patches named v1-0001 through v1-000n.

Done. 11 patches attached. Thanks for the help.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v3-0001-Change-section-heading-to-better-reflect-saving-a.patch
v3-0002-Change-section-heading-to-better-describe-referen.patch
v3-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v3-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v3-0005-Improve-sentences-in-overview-of-system-configura.patch
v3-0006-Provide-examples-of-listing-all-settings.patch
v3-0007-Cleanup-summary-of-role-powers.patch
v3-0008-Explain-the-difference-between-role-attributes-an.patch
v3-0009-Document-the-oidvector-type.patch
v3-0010-Improve-sentences-about-the-significance-of-the-s.patch
v3-0011-Add-a-sub-section-to-describe-schema-resolution.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#7Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#6)
11 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Forgot to attach. Sorry.

On Mon, 25 Sep 2023 23:30:38 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Version 3.

Re-do title, which is all of patch v3-003.

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1" which
will generate a set of n patches named v1-0001 through v1-000n.

Done. 11 patches attached. Thanks for the help.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v3-0001-Change-section-heading-to-better-reflect-saving-a.patch
v3-0002-Change-section-heading-to-better-describe-referen.patch
v3-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v3-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v3-0005-Improve-sentences-in-overview-of-system-configura.patch
v3-0006-Provide-examples-of-listing-all-settings.patch
v3-0007-Cleanup-summary-of-role-powers.patch
v3-0008-Explain-the-difference-between-role-attributes-an.patch
v3-0009-Document-the-oidvector-type.patch
v3-0010-Improve-sentences-about-the-significance-of-the-s.patch
v3-0011-Add-a-sub-section-to-describe-schema-resolution.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v3-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v3 01/11] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v3-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v3 02/11] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v3-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 80c2b8ef7ad6e610f5c7bdc61b827983a87110e2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v3 03/11] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
(Although, to be fair, exceptions are a subset of errors.)  "Trapping
Errors" is not a good section title for these reasons, and because
when it comes to programmatically raising errors in Pl/PgSQL you
don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Processing and Trapping Exceptions" is a little long but it
does accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions with quite a lot about how the programmer can
trap exceptions, affect the program's flow of control, and process
information about errors.  The "Exception" is at the end, and so
stands out after the section title is read.  (At least, according to
my understanding, the end of a sentence is the most memorable.)  I
left "Error" in the title since the word "error" is used so frequently
in the docs, and the section is also about what happens when there is
any sort of PG error, not just those raised in user code.  Error comes
first to stand upon a visual scan of the table of contents.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..127dd1b337 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Processing and Trapping Exceptions</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v3-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From fcc7f8289c078ac0e7174ce16a030c11a163a1db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v3 04/11] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 127dd1b337..54402752b2 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v3-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 1b798d07c6a44855cb3e6e67809f41acd9282ab2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v3 05/11] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v3-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From 7a48244dd5bee61e1c3e9dd3854e214b034ab02e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v3 06/11] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v3-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From a9ec4dce44fd3fa59a9de4704c4d7f255ac2b1e8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v3 07/11] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v3-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From d09293d321a614095cd1fa3fb949b18190c0130d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v3 08/11] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v3-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 2f4ff2b80572db32428a2284279673f9497ad40f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v3 09/11] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v3-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From c012c0261053ea80a657d53ca0b4bea069c9bc91 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v3 10/11] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v3-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From b3e4455b15a1a5b2dac454058fbca1d1fd4811c8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v3 11/11] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

#8Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#7)
12 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Version 4.

Added: v4-0012-Explain-role-management.patch

On Mon, 25 Sep 2023 23:37:44 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1" which
will generate a set of n patches named v1-0001 through v1-000n.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v4-0001-Change-section-heading-to-better-reflect-saving-a.patch
v4-0002-Change-section-heading-to-better-describe-referen.patch
v4-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v4-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v4-0005-Improve-sentences-in-overview-of-system-configura.patch
v4-0006-Provide-examples-of-listing-all-settings.patch
v4-0007-Cleanup-summary-of-role-powers.patch
v4-0008-Explain-the-difference-between-role-attributes-an.patch
v4-0009-Document-the-oidvector-type.patch
v4-0010-Improve-sentences-about-the-significance-of-the-s.patch
v4-0011-Add-a-sub-section-to-describe-schema-resolution.patch
v4-0012-Explain-role-management.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v4-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v4 01/12] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v4-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v4 02/12] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v4-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 80c2b8ef7ad6e610f5c7bdc61b827983a87110e2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v4 03/12] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
(Although, to be fair, exceptions are a subset of errors.)  "Trapping
Errors" is not a good section title for these reasons, and because
when it comes to programmatically raising errors in Pl/PgSQL you
don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Processing and Trapping Exceptions" is a little long but it
does accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions with quite a lot about how the programmer can
trap exceptions, affect the program's flow of control, and process
information about errors.  The "Exception" is at the end, and so
stands out after the section title is read.  (At least, according to
my understanding, the end of a sentence is the most memorable.)  I
left "Error" in the title since the word "error" is used so frequently
in the docs, and the section is also about what happens when there is
any sort of PG error, not just those raised in user code.  Error comes
first to stand upon a visual scan of the table of contents.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..127dd1b337 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Processing and Trapping Exceptions</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v4-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From fcc7f8289c078ac0e7174ce16a030c11a163a1db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v4 04/12] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 127dd1b337..54402752b2 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v4-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 1b798d07c6a44855cb3e6e67809f41acd9282ab2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v4 05/12] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v4-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From 7a48244dd5bee61e1c3e9dd3854e214b034ab02e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v4 06/12] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v4-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From a9ec4dce44fd3fa59a9de4704c4d7f255ac2b1e8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v4 07/12] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v4-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From d09293d321a614095cd1fa3fb949b18190c0130d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v4 08/12] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v4-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 2f4ff2b80572db32428a2284279673f9497ad40f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v4 09/12] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v4-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From c012c0261053ea80a657d53ca0b4bea069c9bc91 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v4 10/12] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v4-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From b3e4455b15a1a5b2dac454058fbca1d1fd4811c8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v4 11/12] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

v4-0012-Explain-role-management.patchtext/x-patchDownload
From dc6093dfc7ce2aed0ce5ac244f11498542ff519b Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sat, 30 Sep 2023 19:29:46 -0500
Subject: [PATCH v4 12/12] Explain role management

It is non-obvious how the permission mechanisms control how
roles are managed, and can be difficult to find the place in
the documentation that describes the details.  When you do,
the details are mixed in with other details un-related to
setting up a management structure for roles.

It is worth providing a concise summary of how roles are managed,
alongside other high-level information related to roles.
---
 doc/src/sgml/user-manag.sgml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 4a26ede8fb..7c854991e5 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -52,6 +52,15 @@
   there are only roles.  Any role can act as a user, a group, or both.
  </para>
 
+ <para>
+   Most database objects are managed by way of granting some role ownership,
+   but roles don't have owners.
+   Instead, roles are <link linkend="role-creation">managed</link> by
+   those roles having the <literal>CREATEROLE</literal> attribute, that
+   are also granted <literal>ADMIN</literal> privileges to the roles
+   which are managed.
+ </para>
+
  <para>
   This chapter describes how to create and manage roles.
   More information about the effects of role privileges on various
-- 
2.30.2

#9Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#8)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Version 5

Changed word order in a sentence:
v5-0012-Explain-role-management.patch

Added a hyperlink:
v5-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch

Added 3 index entries:
v5-0014-Add-index-entries-for-parallel-safety.patch

On Mon, 25 Sep 2023 23:37:44 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1"
which will generate a set of n patches named v1-0001 through
v1-000n.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v5-0001-Change-section-heading-to-better-reflect-saving-a.patch
v5-0002-Change-section-heading-to-better-describe-referen.patch
v5-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v5-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v5-0005-Improve-sentences-in-overview-of-system-configura.patch
v5-0006-Provide-examples-of-listing-all-settings.patch
v5-0007-Cleanup-summary-of-role-powers.patch
v5-0008-Explain-the-difference-between-role-attributes-an.patch
v5-0009-Document-the-oidvector-type.patch
v5-0010-Improve-sentences-about-the-significance-of-the-s.patch
v5-0011-Add-a-sub-section-to-describe-schema-resolution.patch
v5-0012-Explain-role-management.patch
v5-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch
v5-0014-Add-index-entries-for-parallel-safety.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#10Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#8)
14 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Version 5, this time with attachments.

Changed word order in a sentence:
v5-0012-Explain-role-management.patch

Added a hyperlink:
v5-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch

Added 3 index entries:
v5-0014-Add-index-entries-for-parallel-safety.patch

On Mon, 25 Sep 2023 23:37:44 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1"
which will generate a set of n patches named v1-0001 through
v1-000n.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v5-0001-Change-section-heading-to-better-reflect-saving-a.patch
v5-0002-Change-section-heading-to-better-describe-referen.patch
v5-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v5-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v5-0005-Improve-sentences-in-overview-of-system-configura.patch
v5-0006-Provide-examples-of-listing-all-settings.patch
v5-0007-Cleanup-summary-of-role-powers.patch
v5-0008-Explain-the-difference-between-role-attributes-an.patch
v5-0009-Document-the-oidvector-type.patch
v5-0010-Improve-sentences-about-the-significance-of-the-s.patch
v5-0011-Add-a-sub-section-to-describe-schema-resolution.patch
v5-0012-Explain-role-management.patch
v5-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch
v5-0014-Add-index-entries-for-parallel-safety.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v5-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v5 01/14] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v5-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v5 02/14] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v5-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 80c2b8ef7ad6e610f5c7bdc61b827983a87110e2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v5 03/14] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
(Although, to be fair, exceptions are a subset of errors.)  "Trapping
Errors" is not a good section title for these reasons, and because
when it comes to programmatically raising errors in Pl/PgSQL you
don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Processing and Trapping Exceptions" is a little long but it
does accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions with quite a lot about how the programmer can
trap exceptions, affect the program's flow of control, and process
information about errors.  The "Exception" is at the end, and so
stands out after the section title is read.  (At least, according to
my understanding, the end of a sentence is the most memorable.)  I
left "Error" in the title since the word "error" is used so frequently
in the docs, and the section is also about what happens when there is
any sort of PG error, not just those raised in user code.  Error comes
first to stand upon a visual scan of the table of contents.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..127dd1b337 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Processing and Trapping Exceptions</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v5-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From fcc7f8289c078ac0e7174ce16a030c11a163a1db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v5 04/14] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 127dd1b337..54402752b2 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v5-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 1b798d07c6a44855cb3e6e67809f41acd9282ab2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v5 05/14] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v5-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From 7a48244dd5bee61e1c3e9dd3854e214b034ab02e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v5 06/14] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v5-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From a9ec4dce44fd3fa59a9de4704c4d7f255ac2b1e8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v5 07/14] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v5-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From d09293d321a614095cd1fa3fb949b18190c0130d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v5 08/14] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v5-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 2f4ff2b80572db32428a2284279673f9497ad40f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v5 09/14] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v5-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From c012c0261053ea80a657d53ca0b4bea069c9bc91 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v5 10/14] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v5-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From b3e4455b15a1a5b2dac454058fbca1d1fd4811c8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v5 11/14] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

v5-0012-Explain-role-management.patchtext/x-patchDownload
From 9d7b98d2f0441ee62a65fd48124ac0f362a43050 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sat, 30 Sep 2023 19:29:46 -0500
Subject: [PATCH v5 12/14] Explain role management

It is non-obvious how the permission mechanisms control how
roles are managed, and can be difficult to find the place in
the documentation that describes the details.  When you do,
the details are mixed in with other details un-related to
setting up a management structure for roles.

It is worth providing a concise summary of how roles are managed,
alongside other high-level information related to roles.
---
 doc/src/sgml/user-manag.sgml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 4a26ede8fb..b3422ec4f0 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -52,6 +52,15 @@
   there are only roles.  Any role can act as a user, a group, or both.
  </para>
 
+ <para>
+   The managment of most database objects is by way of granting some role
+   ownership, but roles don't have owners.
+   Instead, roles are <link linkend="role-creation">managed</link> by
+   those roles having the <literal>CREATEROLE</literal> attribute, that
+   are also granted <literal>ADMIN</literal> privileges to the roles
+   which are managed.
+ </para>
+
  <para>
   This chapter describes how to create and manage roles.
   More information about the effects of role privileges on various
-- 
2.30.2

v5-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patchtext/x-patchDownload
From 8e0fd522780311b116e17cb6b8814aa43a374277 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 17:52:22 -0500
Subject: [PATCH v5 13/14] Hyperlink from CREATE FUNCTION reference page to
 parallel safety page

Is is nice to have a link in the reference material to a full discussion.
---
 doc/src/sgml/ref/create_function.sgml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 863d99d1fc..eb16e8adc0 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -429,7 +429,8 @@ CREATE [ OR REPLACE ] FUNCTION
 
     <listitem>
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
-      can't be executed in parallel mode and the presence of such a
+      can't be executed in <link linkend="parallel-labeling">parallel
+      mode</link> and the presence of such a
       function in an SQL statement forces a serial execution plan.  This is
       the default.  <literal>PARALLEL RESTRICTED</literal> indicates that
       the function can be executed in parallel mode, but the execution is
-- 
2.30.2

v5-0014-Add-index-entries-for-parallel-safety.patchtext/x-patchDownload
From c5f9c0beb5710401dfe727ed4e97fd3ffb149247 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 18:06:54 -0500
Subject: [PATCH v5 14/14] Add index entries for parallel safety

Always nice to index things, and safety is important.
---
 doc/src/sgml/parallel.sgml            | 10 ++++++++++
 doc/src/sgml/ref/create_function.sgml |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml
index 5acc9537d6..d523592b2a 100644
--- a/doc/src/sgml/parallel.sgml
+++ b/doc/src/sgml/parallel.sgml
@@ -523,6 +523,16 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
     </listitem>
   </itemizedlist>
 
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>functions</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>aggregates</secondary>
+  </indexterm>
+
  <sect2 id="parallel-labeling">
   <title>Parallel Labeling for Functions and Aggregates</title>
 
diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index eb16e8adc0..419e9b7284 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -428,6 +428,12 @@ CREATE [ OR REPLACE ] FUNCTION
     <term><literal>PARALLEL</literal></term>
 
     <listitem>
+
+     <indexterm>
+       <primary>parallel safety</primary>
+       <secondary>functions</secondary>
+     </indexterm>
+
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
       can't be executed in <link linkend="parallel-labeling">parallel
       mode</link> and the presence of such a
-- 
2.30.2

#11Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#10)
15 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Sun, 1 Oct 2023 18:18:07 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Version 6

Added:
v6-0015-Trigger-authors-need-not-worry-about-parallelism.patch

Can't say if this is an awesome idea or not. (Might have saved me time.)
Read the commit message for a justification.

On Mon, 25 Sep 2023 23:37:44 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1"
which will generate a set of n patches named v1-0001 through
v1-000n.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v6-0001-Change-section-heading-to-better-reflect-saving-a.patch
v6-0002-Change-section-heading-to-better-describe-referen.patch
v6-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v6-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v6-0005-Improve-sentences-in-overview-of-system-configura.patch
v6-0006-Provide-examples-of-listing-all-settings.patch
v6-0007-Cleanup-summary-of-role-powers.patch
v6-0008-Explain-the-difference-between-role-attributes-an.patch
v6-0009-Document-the-oidvector-type.patch
v6-0010-Improve-sentences-about-the-significance-of-the-s.patch
v6-0011-Add-a-sub-section-to-describe-schema-resolution.patch
v6-0012-Explain-role-management.patch
v6-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch
v6-0014-Add-index-entries-for-parallel-safety.patch
v6-0015-Trigger-authors-need-not-worry-about-parallelism.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v6-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v6 01/15] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v6-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v6 02/15] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v6-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 80c2b8ef7ad6e610f5c7bdc61b827983a87110e2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v6 03/15] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
(Although, to be fair, exceptions are a subset of errors.)  "Trapping
Errors" is not a good section title for these reasons, and because
when it comes to programmatically raising errors in Pl/PgSQL you
don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Processing and Trapping Exceptions" is a little long but it
does accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions with quite a lot about how the programmer can
trap exceptions, affect the program's flow of control, and process
information about errors.  The "Exception" is at the end, and so
stands out after the section title is read.  (At least, according to
my understanding, the end of a sentence is the most memorable.)  I
left "Error" in the title since the word "error" is used so frequently
in the docs, and the section is also about what happens when there is
any sort of PG error, not just those raised in user code.  Error comes
first to stand upon a visual scan of the table of contents.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..127dd1b337 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Processing and Trapping Exceptions</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v6-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From fcc7f8289c078ac0e7174ce16a030c11a163a1db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v6 04/15] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 127dd1b337..54402752b2 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v6-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 1b798d07c6a44855cb3e6e67809f41acd9282ab2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v6 05/15] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v6-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From 7a48244dd5bee61e1c3e9dd3854e214b034ab02e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v6 06/15] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v6-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From a9ec4dce44fd3fa59a9de4704c4d7f255ac2b1e8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v6 07/15] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v6-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From d09293d321a614095cd1fa3fb949b18190c0130d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v6 08/15] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v6-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 2f4ff2b80572db32428a2284279673f9497ad40f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v6 09/15] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v6-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From c012c0261053ea80a657d53ca0b4bea069c9bc91 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v6 10/15] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v6-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From b3e4455b15a1a5b2dac454058fbca1d1fd4811c8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v6 11/15] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

v6-0012-Explain-role-management.patchtext/x-patchDownload
From 9d7b98d2f0441ee62a65fd48124ac0f362a43050 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sat, 30 Sep 2023 19:29:46 -0500
Subject: [PATCH v6 12/15] Explain role management

It is non-obvious how the permission mechanisms control how
roles are managed, and can be difficult to find the place in
the documentation that describes the details.  When you do,
the details are mixed in with other details un-related to
setting up a management structure for roles.

It is worth providing a concise summary of how roles are managed,
alongside other high-level information related to roles.
---
 doc/src/sgml/user-manag.sgml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 4a26ede8fb..b3422ec4f0 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -52,6 +52,15 @@
   there are only roles.  Any role can act as a user, a group, or both.
  </para>
 
+ <para>
+   The managment of most database objects is by way of granting some role
+   ownership, but roles don't have owners.
+   Instead, roles are <link linkend="role-creation">managed</link> by
+   those roles having the <literal>CREATEROLE</literal> attribute, that
+   are also granted <literal>ADMIN</literal> privileges to the roles
+   which are managed.
+ </para>
+
  <para>
   This chapter describes how to create and manage roles.
   More information about the effects of role privileges on various
-- 
2.30.2

v6-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patchtext/x-patchDownload
From 8e0fd522780311b116e17cb6b8814aa43a374277 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 17:52:22 -0500
Subject: [PATCH v6 13/15] Hyperlink from CREATE FUNCTION reference page to
 parallel safety page

Is is nice to have a link in the reference material to a full discussion.
---
 doc/src/sgml/ref/create_function.sgml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 863d99d1fc..eb16e8adc0 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -429,7 +429,8 @@ CREATE [ OR REPLACE ] FUNCTION
 
     <listitem>
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
-      can't be executed in parallel mode and the presence of such a
+      can't be executed in <link linkend="parallel-labeling">parallel
+      mode</link> and the presence of such a
       function in an SQL statement forces a serial execution plan.  This is
       the default.  <literal>PARALLEL RESTRICTED</literal> indicates that
       the function can be executed in parallel mode, but the execution is
-- 
2.30.2

v6-0014-Add-index-entries-for-parallel-safety.patchtext/x-patchDownload
From c5f9c0beb5710401dfe727ed4e97fd3ffb149247 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 18:06:54 -0500
Subject: [PATCH v6 14/15] Add index entries for parallel safety

Always nice to index things, and safety is important.
---
 doc/src/sgml/parallel.sgml            | 10 ++++++++++
 doc/src/sgml/ref/create_function.sgml |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml
index 5acc9537d6..d523592b2a 100644
--- a/doc/src/sgml/parallel.sgml
+++ b/doc/src/sgml/parallel.sgml
@@ -523,6 +523,16 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
     </listitem>
   </itemizedlist>
 
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>functions</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>aggregates</secondary>
+  </indexterm>
+
  <sect2 id="parallel-labeling">
   <title>Parallel Labeling for Functions and Aggregates</title>
 
diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index eb16e8adc0..419e9b7284 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -428,6 +428,12 @@ CREATE [ OR REPLACE ] FUNCTION
     <term><literal>PARALLEL</literal></term>
 
     <listitem>
+
+     <indexterm>
+       <primary>parallel safety</primary>
+       <secondary>functions</secondary>
+     </indexterm>
+
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
       can't be executed in <link linkend="parallel-labeling">parallel
       mode</link> and the presence of such a
-- 
2.30.2

v6-0015-Trigger-authors-need-not-worry-about-parallelism.patchtext/x-patchDownload
From 090ff4a33deb04e0cb779830b6ab6e81be43714f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 2 Oct 2023 14:55:16 -0500
Subject: [PATCH v6 15/15] Trigger authors need not worry about parallelism

The idea is that it's worth telling the trigger author who comes
across PARALLEL declarations when creating trigger functions that they
don't need to investigate further.

Is this stating the obvious?  Yes.  But it's not obvious until you've
read about PGs parallelism, and read _enough_ to know that there's
only mention of queries and no mention of data modification
statements.  Knowing that something is missing from PG requires at
least passing familiarity with _all_ of the documentation.

Plus, this patch adds an index entry so the new verbage is easy to find
for those who do investigate.

Agreed, documenting everything PG does _not_ do is a terrible idea.
The goal here is to help trigger authors limit what they need to
research.
---
 doc/src/sgml/trigger.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml
index 6e1f370b21..f6ec8d2a97 100644
--- a/doc/src/sgml/trigger.sgml
+++ b/doc/src/sgml/trigger.sgml
@@ -377,6 +377,17 @@
     trigger.
    </para>
 
+   <indexterm>
+     <primary>parallel safety</primary>
+     <secondary>triggers</secondary>
+   </indexterm>
+
+   <para>
+     Trigger authors need not concern themselves with parallel safety.
+     <link linkend="parallel-query">Parallel execution</link>
+     is supported only in queries, 
+   </para>
+
    <para>
     Each programming language that supports triggers has its own method
     for making the trigger input data available to the trigger function.
-- 
2.30.2

#12Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#11)
16 attachment(s)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Mon, 2 Oct 2023 15:18:32 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Version 7

Added:
v7-0016-Predicate-locks-are-held-per-cluster-not-per-data.patch

On Mon, 25 Sep 2023 23:37:44 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 17:55:59 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Mon, 25 Sep 2023 14:14:37 +0200
Daniel Gustafsson <daniel@yesql.se> wrote:

Once done you can do "git format-patch origin/master -v 1"
which will generate a set of n patches named v1-0001
through v1-000n.

I am not particularly confident in the top-line commit
descriptions.

The bulk of the commit descriptions are very wordy

Listing all the attachments here for future discussion:

v7-0001-Change-section-heading-to-better-reflect-saving-a.patch
v7-0002-Change-section-heading-to-better-describe-referen.patch
v7-0003-Better-section-heading-for-plpgsql-exception-trap.patch
v7-0004-Describe-how-to-raise-an-exception-in-the-excepti.patch
v7-0005-Improve-sentences-in-overview-of-system-configura.patch
v7-0006-Provide-examples-of-listing-all-settings.patch
v7-0007-Cleanup-summary-of-role-powers.patch
v7-0008-Explain-the-difference-between-role-attributes-an.patch
v7-0009-Document-the-oidvector-type.patch
v7-0010-Improve-sentences-about-the-significance-of-the-s.patch
v7-0011-Add-a-sub-section-to-describe-schema-resolution.patch
v7-0012-Explain-role-management.patch
v7-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch
v7-0014-Add-index-entries-for-parallel-safety.patch
v7-0015-Trigger-authors-need-not-worry-about-parallelism.patch
v7-0016-Predicate-locks-are-held-per-cluster-not-per-data.patch

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

v7-0006-Provide-examples-of-listing-all-settings.patchtext/x-patchDownload
From 7a48244dd5bee61e1c3e9dd3854e214b034ab02e Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:36:23 -0500
Subject: [PATCH v7 06/16] Provide examples of listing all settings

This commit is problematic in that it does something that is not done
elsewhere in the documentation, it provides example SELECTs as a
stand-in for a regular tabular documentation element.  It is almost
something that should go in its own appendix, but I don't think that
is warranted.  Likewise, I think that having another tabular
documentation element that must be maintained and kept up-to-date is
also not appropriate.

It is useful to have tabular overviews of all available system
settings, as is having an overview of the setting values of your
particular cluster.  This commit is an attempt in that direction.
---
 doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 97f9838bfb..0af4e6dcae 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11,6 +11,43 @@
   <para>
    There are many configuration parameters that affect the behavior of
    the database system.
+   A single master list of all parameters and their characteristics is not
+   provided in this document.
+   Use the <link linkend="bookindex">index</link> (or web search) to find
+   configuration parameter documentation by name.
+  </para>
+
+  <indexterm>
+    <primary>pg_settings</primary>
+    <secondary>example queries</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>configuration</primary>
+    <secondary>query the current settings</secondary>
+  </indexterm>
+
+  <para>
+   The <link linkend="view-pg-settings">pg_settings</link>
+   <link linkend="tutorial-views">view</link> into
+   the <link linkend="catalogs">system catalogs</link> provides summaries of
+   all, or selected, configuration parameters, e.g:
+  </para>
+
+<programlisting>
+-- Describe all configuration parameters.
+SELECT name, short_desc FROM pg_settings ORDER BY name;
+
+-- Show the current configuration of the connected cluster, database,
+-- and session.
+SELECT name, setting, unit FROM pg_settings ORDER BY name;
+
+-- Show the means available to change the setting; whether the setting is
+-- per-cluster, per-database, per-session, etc.
+SELECT name, context FROM pg_settings ORDER BY name;
+</programlisting>
+  
+  <para>
    The first section of this chapter describes how to interact with
    configuration parameters.
    Subsequent sections discuss each parameter in detail.
-- 
2.30.2

v7-0007-Cleanup-summary-of-role-powers.patchtext/x-patchDownload
From a9ec4dce44fd3fa59a9de4704c4d7f255ac2b1e8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 16:39:02 -0500
Subject: [PATCH v7 07/16] Cleanup summary of role powers.

Make sentences shorter.  Explain privileges v.s. permissions.

This commit assumes that there is a distinction in the PostgreSQL
vocabulary between role privileges and permissions.  Privileges being
a specific Postgres term for powers granted to roles via GRANT.
Permissions being abilities to perform specific operations that comes
with privileges, but also with role attributes like CREATEDB.  So
permissions are a broader category than privileges, in terms of where
they come from.  As well as being a narrower category in another
sense, in that some privileges, like object ownership, carry with them
a swath of individual permissions/abilities, like USAGE.

It seems a useful distinction to make, in terms of thinking about how
object access works.  Essential in fact, since both privileges
(e.g. ownership) and role attributes (e.g. SUPERUSER) give roles
abilities, aka permissions (e.g. SELECT).  Without the distinction you
can't describe role inheritance (attributes don't, privileges do) or
discuss the source of particular access rights.  If access rights, aka
permissions, aka "abilities to do things", are the same as privileges
how come some privileges convey multiple abilities, abilities that
have their own names; how can you get an ability via a role attribute
but not have the privilege?  It seems most clear to, conceptually at
least, have a separate set of permissions (abilities) that come via
privileges granted to roles and role attributes assigned to roles.

So, I'm not sure my choice of vocabulary is perfect.  One might use
"rights" or some other word rather than "permissions".  But I think
that there should be a clear distinction between the 3 concepts of
granted privileges, role attributes, and permissions to perform
specific operations.

I also would argue that it is not necessary to scour the existing
documentation and patch to obtain perfect consistency in vocabulary
usage. The existing wording seems acceptable in practice and I don't
see anyone who's read what's already there to be confused by the
changes presented here.
---
 doc/src/sgml/user-manag.sgml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 27c1f3d703..492325e8a2 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -7,11 +7,14 @@
   <productname>PostgreSQL</productname> manages database access permissions
   using the concept of <firstterm>roles</firstterm>.  A role can be thought of as
   either a database user, or a group of database users, depending on how
-  the role is set up.  Roles can own database objects (for example, tables
-  and functions) and can assign privileges on those objects to other roles to
-  control who has access to which objects.  Furthermore, it is possible
-  to grant <firstterm>membership</firstterm> in a role to another role, thus
-  allowing the member role to use privileges assigned to another role.
+  the role is set up.
+  Roles can own database objects (for example, tables and functions).
+  They can assign privileges on the owned objects, and thus the permissions
+  the privileges carry, to other roles.
+  Roles therefore control who has what access to which objects.
+  It is possible to grant <firstterm>membership</firstterm> in a role to
+  another role, thus allowing the member role to use the privileges assigned
+  to another role.
  </para>
 
  <para>
-- 
2.30.2

v7-0008-Explain-the-difference-between-role-attributes-an.patchtext/x-patchDownload
From d09293d321a614095cd1fa3fb949b18190c0130d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 17:18:58 -0500
Subject: [PATCH v7 08/16] Explain the difference between role attributes and
 role privileges

All of the information presented here is present elsewhere in the
documentation, but scattered about.  It is useful to have a summary;
one place where the interactions between INHERIT, the other role
attributes, and granting of privileges with roles is explained.
Otherwise, it is hard to synthesize this out of bits and pieces
mentioned elsewhere.
---
 doc/src/sgml/user-manag.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 492325e8a2..4a26ede8fb 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -12,9 +12,37 @@
   They can assign privileges on the owned objects, and thus the permissions
   the privileges carry, to other roles.
   Roles therefore control who has what access to which objects.
+ </para>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>inheriting permissions</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>attributes</secondary>
+ </indexterm>
+
+ <indexterm>
+   <primary>role</primary>
+   <secondary>current role</secondary>
+ </indexterm>
+
+ <para>
   It is possible to grant <firstterm>membership</firstterm> in a role to
   another role, thus allowing the member role to use the privileges assigned
   to another role.
+  This acquisition of privilege can happen automatically, if the role given
+  membership has the <literal>INHERIT</literal> attribute, or manually, via
+  a <literal>SET ROLE</literal> to the granted role.
+  But it is important to distinguish between privileges, which are assigned
+  with <literal>GRANT</literal>, and role attributes,
+  like <literal>INHERIT</literal>, <literal>SUPERUSER</literal>, and
+  <literal>CREATEDB</literal>, which are assigned with <literal>CREATE
+  ROLE</literal> or <literal>ALTER ROLE</literal>.
+  Privileges may be inherited, role attributes cannot and are only effective
+  when <literal>SET ROLE</literal> changes the current role.
  </para>
 
  <para>
-- 
2.30.2

v7-0001-Change-section-heading-to-better-reflect-saving-a.patchtext/x-patchDownload
From 122665c4155698abe88e2bd17639a991791b94e3 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:49:30 -0500
Subject: [PATCH v7 01/16] Change section heading to better reflect saving a
 result in variable(s)

The current section title of "Executing a Command with a Single-Row
Result" does not reflect what the section is really about.  Other
sections make clear how to _execute_ commands, single-row result or not.
What this section is about is how to _save_ a single row of results into
variable(s).

It would be nice to talk about saving results into variables in the
section heading but I couldn't come up with anything pithy.  "Saving a
Single-Row of a Command's Result" seems good enough, especially since
there's few other places to save results other than in variables.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index f55e901c7e..8747e84245 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1126,7 +1126,7 @@ PERFORM create_mv('cs_session_page_requests_mv', my_query);
    </sect2>
 
    <sect2 id="plpgsql-statements-sql-onerow">
-    <title>Executing a Command with a Single-Row Result</title>
+    <title>Saving a Single-Row of a Command's Result</title>
 
     <indexterm zone="plpgsql-statements-sql-onerow">
      <primary>SELECT INTO</primary>
-- 
2.30.2

v7-0002-Change-section-heading-to-better-describe-referen.patchtext/x-patchDownload
From 4de4a31d41124dfa793cc5cce0516673811ea414 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 15:52:21 -0500
Subject: [PATCH v7 02/16] Change section heading to better describe reference
 of existing types

The section heading of "Copying Types" does not reflect what the
section is about.  It is not about making copies of data types but
about using the data type of existing columns (or rows) in new type
declarations without having to know what the existing type is.

"Re-Using the Type of Columns and Variables" seems adequate.  Getting
something in there about declartions seems too wordy.  I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to read.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 8747e84245..874578265e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -672,7 +672,7 @@ DECLARE
    </sect2>
 
   <sect2 id="plpgsql-declaration-type">
-   <title>Copying Types</title>
+   <title>Re-Using the Type of Columns and Variables</title>
 
 <synopsis>
 <replaceable>variable</replaceable>%TYPE
-- 
2.30.2

v7-0003-Better-section-heading-for-plpgsql-exception-trap.patchtext/x-patchDownload
From 80c2b8ef7ad6e610f5c7bdc61b827983a87110e2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:29 -0500
Subject: [PATCH v7 03/16] Better section heading for plpgsql exception
 trapping

The docs seem to use "error" and "exception" interchangeably, perhaps
50% each.  But they never say that the are the same thing, and in the
larger world they are not.  Errors tend to be something that drop on
the floor and usually halt execution whereas exceptions can be trapped
and give the programmer more control over the flow of the program.
(Although, to be fair, exceptions are a subset of errors.)  "Trapping
Errors" is not a good section title for these reasons, and because
when it comes to programmatically raising errors in Pl/PgSQL you
don't, you raise exceptions.  The current section heading does not
stand out in a scan of the table of contents when you're looking for
exception handling, IMHO.

"Error Processing and Trapping Exceptions" is a little long but it
does accurately reflect that the section is about how Pl/PgSQL behaves
under error conditions with quite a lot about how the programmer can
trap exceptions, affect the program's flow of control, and process
information about errors.  The "Exception" is at the end, and so
stands out after the section title is read.  (At least, according to
my understanding, the end of a sentence is the most memorable.)  I
left "Error" in the title since the word "error" is used so frequently
in the docs, and the section is also about what happens when there is
any sort of PG error, not just those raised in user code.  Error comes
first to stand upon a visual scan of the table of contents.
---
 doc/src/sgml/plpgsql.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 874578265e..127dd1b337 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2756,7 +2756,7 @@ NOTICE:  row = {10,11,12}
    </sect2>
 
    <sect2 id="plpgsql-error-trapping">
-    <title>Trapping Errors</title>
+    <title>Error Processing and Trapping Exceptions</title>
 
     <indexterm>
      <primary>exceptions</primary>
-- 
2.30.2

v7-0004-Describe-how-to-raise-an-exception-in-the-excepti.patchtext/x-patchDownload
From fcc7f8289c078ac0e7174ce16a030c11a163a1db Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:03:59 -0500
Subject: [PATCH v7 04/16] Describe how to raise an exception in the exception
 section

Most of this section is about managing program control flow, but the
section does not mention how to raise an exception anywhere.  This new
sentence says how, and provides a link into the section on raising
exceptions for those who want to know more.

Line break after end of sentence to simplify reading of future patches.
---
 doc/src/sgml/plpgsql.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 127dd1b337..54402752b2 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2765,8 +2765,11 @@ NOTICE:  row = {10,11,12}
 
     <para>
      By default, any error occurring in a <application>PL/pgSQL</application>
-     function aborts execution of the function and the
-     surrounding transaction.  You can trap errors and recover
+     function aborts execution of the function and the surrounding
+     transaction.
+     You can raise an exception and throw an error
+     with <link linkend="plpgsql-statements-raise">RAISE EXCEPTION ...</link>.
+     You can trap errors and recover
      from them by using a <command>BEGIN</command> block with an
      <literal>EXCEPTION</literal> clause.  The syntax is an extension of the
      normal syntax for a <command>BEGIN</command> block:
-- 
2.30.2

v7-0005-Improve-sentences-in-overview-of-system-configura.patchtext/x-patchDownload
From 1b798d07c6a44855cb3e6e67809f41acd9282ab2 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 25 Sep 2023 15:32:23 -0500
Subject: [PATCH v7 05/16] Improve sentences in overview of system
 configuration parameters

Get rid of "we" wording.  Remove extra words in sentences.

Line break after end of each sentence to ease future patch reading.
---
 doc/src/sgml/config.sgml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
 
   <para>
    There are many configuration parameters that affect the behavior of
-   the database system. In the first section of this chapter we
-   describe how to interact with configuration parameters. The subsequent sections
-   discuss each parameter in detail.
+   the database system.
+   The first section of this chapter describes how to interact with
+   configuration parameters.
+   Subsequent sections discuss each parameter in detail.
   </para>
 
   <sect1 id="config-setting">
-- 
2.30.2

v7-0009-Document-the-oidvector-type.patchtext/x-patchDownload
From 2f4ff2b80572db32428a2284279673f9497ad40f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:36:36 -0500
Subject: [PATCH v7 09/16] Document the oidvector type

The oidvector type is used in pg_proc.proargtypes, and perhaps
elsewhere in the catalogs.  But there is no documentation on how to
get oids out of a oidvector or otherwise manipulate the data type for
those who wish to do so.  This seems the only place where such
documentation would go.
---
 doc/src/sgml/datatype.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 8d32a8c9c5..91cc1e5cb0 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -4754,6 +4754,17 @@ INSERT INTO mytable VALUES(-1);  -- fails
     signed-versus-unsigned confusion if you do this.)
    </para>
 
+   <indexterm zone="datatype-oid">
+    <primary>oidvector</primary>
+   </indexterm>
+
+   <para>
+     The legacy <type>oidvector</type> type can be cast to an array of OIDs,
+     and vice versa, for examination and manipulation.
+     The resultant array of OIDs, unlike a typical array, is indexed
+     zero-relative.
+   </para>
+
    <para>
     The OID alias types have no operations of their own except
     for specialized input and output routines.  These routines are able
-- 
2.30.2

v7-0010-Improve-sentences-about-the-significance-of-the-s.patchtext/x-patchDownload
From c012c0261053ea80a657d53ca0b4bea069c9bc91 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:39:24 -0500
Subject: [PATCH v7 10/16] Improve sentences about the significance of the
 search path's first schema

These two sentences have extra words, and can be improved with small
word re-ordering.  The word "again" could probably be removed as well
but it reads ok with it and it does not hurt to pound the point into
the reader's brain.

Note however that the original last sentence still isn't 100% correct,
because the default configuration includes "$user" at the start of the
search path.  So if an object is in the user's schema an unqualified
mention refers to something in the user's schema.  Hence, the
qualification that comes after the semicolon.  I thought about a
separate sentence, but the 2 parts are closely intertwined.  So,
semicolon.  It's all kind of a lot.  But, although I do believe in
removing extra content from sentences to make them shorter, more
clear, and memorable, I do think it's ok to repeat things when writing
narrative.  And the existing documentation is going for repetition so I
stuck with that.

Line break after each end of sentence to improve readability of future
patches.
---
 doc/src/sgml/ddl.sgml | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 075ff32991..ee30b7b575 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3106,12 +3106,14 @@ SHOW search_path;
    <para>
     The first schema in the search path that exists is the default
     location for creating new objects.  That is the reason that by
-    default objects are created in the public schema.  When objects
-    are referenced in any other context without schema qualification
-    (table modification, data modification, or query commands) the
-    search path is traversed until a matching object is found.
-    Therefore, in the default configuration, any unqualified access
-    again can only refer to the public schema.
+    default objects are created in the public schema.
+    When objects are referenced in a context without schema qualification
+    (table modification, data modification, or query commands) the search path
+    is traversed until a matching object is found.
+    Therefore, again, in the default configuration, any unqualified name
+    refers to an object in the public schema; unless, given the default search
+    path, there is an object with that name accessible in the schema having
+    the name of the current user.
    </para>
 
    <para>
-- 
2.30.2

v7-0011-Add-a-sub-section-to-describe-schema-resolution.patchtext/x-patchDownload
From b3e4455b15a1a5b2dac454058fbca1d1fd4811c8 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 24 Sep 2023 16:59:03 -0500
Subject: [PATCH v7 11/16] Add a sub-section to describe schema resolution

There are some subtleties to schema resolution.  At first glance it
seems like schema resolution is "for runtime", i.e. it matters when
querying or altering database data.  But it takes a little bit of
thought to reason through what schema resolution means for DDL.  It is
almost surprising that the search path in effect at DDL time persists,
in a sense, in a useful way, regardless of the search path in effect
during "regular" database use.

This explanation also sheds light on the use of CREATE OR REPLACE
sorts of syntaxes, and what gets changed when such syntax is used and
what does not, and why.  At least for those who do not poke about in
the system catalogs and understand the oid relationships.

Using the word "manipulate" is a bit awkward, but is what I came up
with and I believe is made clear.  Maybe there's better phrasing.

Lead the reader through the implications of the search path in a DDL
context so they can better reason about the best search path to use in
their problem domain and better understand why PG behaves as it does.
The whole thing is a little bit wordy and repeats some information
present in other sections.  But this allows the new section to stand
on its own.
---
 doc/src/sgml/ddl.sgml | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index ee30b7b575..6fc6c37b1d 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3164,6 +3164,54 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
    </para>
   </sect2>
 
+  <sect2 id="ddl-schema-resolution">
+    <title>Schema Resolution</title>
+
+    <indexterm>
+     <primary>schema</primary>
+     <secondary>resolution</secondary>
+    </indexterm>
+
+    <para>
+      Schema resolution happens when SQL is run.
+
+      Exactly what this means is usually obvious; using an unqualified table
+      name when creating a table creates the table in the first schema of the
+      search path in effect, the current search path is used to find
+      unqualified table names when executing a <literal>SELECT</literal>, and
+      so forth.
+      But there are less obvious implications when it comes to statements
+      that manipulate <link linkend="ddl-others">database objects</link>:
+      tables, triggers, functions and the like.
+    </para>
+
+    <para>
+      Most SQL expressions appearing within the statements that manipulate
+      database objects are resolved at the time of manipulation.
+      Consider the creation of tables and triggers.
+      The schemas of foreign key table references, the functions and operators
+      used in table and column constraint expressions, table partition
+      expressions, and so forth are resolved at the time of table creation.
+      So is the schema of the function named when a trigger is created.
+      These already-resolved tables, functions, operators,
+      etc. need <emphasis>not</emphasis> be in the search path when the
+      constraints or triggers are executed, when the content of the table is
+      modified and the data validation occurs.
+      This is just as if all the objects were fully schema qualified in the
+      SQL that created the table, trigger, or other database object.
+    </para>
+
+    <para>
+      But functions are different.
+      The point of function creation is to store code for execution later.
+      Schemas are resolved within a function body when the function is called,
+      not when the function is created.
+      This has implications for function behavior consistency and
+      <link linkend="sql-createfunction-security">security</link>.
+      For these reasons function bodies can have their own search paths.
+    </para>
+  </sect2>
+
   <sect2 id="ddl-schemas-priv">
    <title>Schemas and Privileges</title>
 
-- 
2.30.2

v7-0012-Explain-role-management.patchtext/x-patchDownload
From 9d7b98d2f0441ee62a65fd48124ac0f362a43050 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sat, 30 Sep 2023 19:29:46 -0500
Subject: [PATCH v7 12/16] Explain role management

It is non-obvious how the permission mechanisms control how
roles are managed, and can be difficult to find the place in
the documentation that describes the details.  When you do,
the details are mixed in with other details un-related to
setting up a management structure for roles.

It is worth providing a concise summary of how roles are managed,
alongside other high-level information related to roles.
---
 doc/src/sgml/user-manag.sgml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 4a26ede8fb..b3422ec4f0 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -52,6 +52,15 @@
   there are only roles.  Any role can act as a user, a group, or both.
  </para>
 
+ <para>
+   The managment of most database objects is by way of granting some role
+   ownership, but roles don't have owners.
+   Instead, roles are <link linkend="role-creation">managed</link> by
+   those roles having the <literal>CREATEROLE</literal> attribute, that
+   are also granted <literal>ADMIN</literal> privileges to the roles
+   which are managed.
+ </para>
+
  <para>
   This chapter describes how to create and manage roles.
   More information about the effects of role privileges on various
-- 
2.30.2

v7-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patchtext/x-patchDownload
From 8e0fd522780311b116e17cb6b8814aa43a374277 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 17:52:22 -0500
Subject: [PATCH v7 13/16] Hyperlink from CREATE FUNCTION reference page to
 parallel safety page

Is is nice to have a link in the reference material to a full discussion.
---
 doc/src/sgml/ref/create_function.sgml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 863d99d1fc..eb16e8adc0 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -429,7 +429,8 @@ CREATE [ OR REPLACE ] FUNCTION
 
     <listitem>
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
-      can't be executed in parallel mode and the presence of such a
+      can't be executed in <link linkend="parallel-labeling">parallel
+      mode</link> and the presence of such a
       function in an SQL statement forces a serial execution plan.  This is
       the default.  <literal>PARALLEL RESTRICTED</literal> indicates that
       the function can be executed in parallel mode, but the execution is
-- 
2.30.2

v7-0014-Add-index-entries-for-parallel-safety.patchtext/x-patchDownload
From c5f9c0beb5710401dfe727ed4e97fd3ffb149247 Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Sun, 1 Oct 2023 18:06:54 -0500
Subject: [PATCH v7 14/16] Add index entries for parallel safety

Always nice to index things, and safety is important.
---
 doc/src/sgml/parallel.sgml            | 10 ++++++++++
 doc/src/sgml/ref/create_function.sgml |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml
index 5acc9537d6..d523592b2a 100644
--- a/doc/src/sgml/parallel.sgml
+++ b/doc/src/sgml/parallel.sgml
@@ -523,6 +523,16 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
     </listitem>
   </itemizedlist>
 
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>functions</secondary>
+  </indexterm>
+
+  <indexterm>
+    <primary>parallel safety</primary>
+    <secondary>aggregates</secondary>
+  </indexterm>
+
  <sect2 id="parallel-labeling">
   <title>Parallel Labeling for Functions and Aggregates</title>
 
diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index eb16e8adc0..419e9b7284 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -428,6 +428,12 @@ CREATE [ OR REPLACE ] FUNCTION
     <term><literal>PARALLEL</literal></term>
 
     <listitem>
+
+     <indexterm>
+       <primary>parallel safety</primary>
+       <secondary>functions</secondary>
+     </indexterm>
+
      <para><literal>PARALLEL UNSAFE</literal> indicates that the function
       can't be executed in <link linkend="parallel-labeling">parallel
       mode</link> and the presence of such a
-- 
2.30.2

v7-0015-Trigger-authors-need-not-worry-about-parallelism.patchtext/x-patchDownload
From 090ff4a33deb04e0cb779830b6ab6e81be43714f Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Mon, 2 Oct 2023 14:55:16 -0500
Subject: [PATCH v7 15/16] Trigger authors need not worry about parallelism

The idea is that it's worth telling the trigger author who comes
across PARALLEL declarations when creating trigger functions that they
don't need to investigate further.

Is this stating the obvious?  Yes.  But it's not obvious until you've
read about PGs parallelism, and read _enough_ to know that there's
only mention of queries and no mention of data modification
statements.  Knowing that something is missing from PG requires at
least passing familiarity with _all_ of the documentation.

Plus, this patch adds an index entry so the new verbage is easy to find
for those who do investigate.

Agreed, documenting everything PG does _not_ do is a terrible idea.
The goal here is to help trigger authors limit what they need to
research.
---
 doc/src/sgml/trigger.sgml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml
index 6e1f370b21..f6ec8d2a97 100644
--- a/doc/src/sgml/trigger.sgml
+++ b/doc/src/sgml/trigger.sgml
@@ -377,6 +377,17 @@
     trigger.
    </para>
 
+   <indexterm>
+     <primary>parallel safety</primary>
+     <secondary>triggers</secondary>
+   </indexterm>
+
+   <para>
+     Trigger authors need not concern themselves with parallel safety.
+     <link linkend="parallel-query">Parallel execution</link>
+     is supported only in queries, 
+   </para>
+
    <para>
     Each programming language that supports triggers has its own method
     for making the trigger input data available to the trigger function.
-- 
2.30.2

v7-0016-Predicate-locks-are-held-per-cluster-not-per-data.patchtext/x-patchDownload
From a3dc599f9295e9461c3646dc764ee8bcf9bee47d Mon Sep 17 00:00:00 2001
From: "Karl O. Pinc" <kop@karlpinc.com>
Date: Tue, 3 Oct 2023 12:11:31 -0500
Subject: [PATCH v7 16/16] Predicate locks are held per-cluster, not
 per-database

I believe this is still true and nothing has changed since
this email thread:
https://www.postgresql.org/message-id/20170518110712.31caaf3b@slate.meme.com

This is a significant corner case and so should be documented.  It is
also somewhat suprising since the databases within a cluster are
otherwise isolated, at least from the user's perspective.

I mention psql pagination because it is easy to overlook the fact that
it is not just end-user applications that generate transactions.

I have not thought about this in a long time and am not 100% certain
that WAL checkpoints on segments are delayed until the predicate lock
for the respective transaction is released.  I'm pretty sure, but this
should be checked.

I am sure that all concurrent predicate locks must be released
together.  See the 2nd to last sentence of ports12:
https://arxiv.org/pdf/1208.4179.pdf

The index entries might be improved.  The idea is to guide someone
who's got a lot of WAL laying around and is using serializable
transactions.
---
 doc/src/sgml/mvcc.sgml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml
index f8f83d463d..b021a2d2de 100644
--- a/doc/src/sgml/mvcc.sgml
+++ b/doc/src/sgml/mvcc.sgml
@@ -829,6 +829,34 @@ ERROR:  could not serialize access due to read/write dependencies among transact
        query execution time.
       </para>
      </listitem>
+     <listitem>
+
+       <indexterm>
+         <primary>WAL</primary>
+         <secondary>Serializeable Snapshot Isolation and
+           WAL checkpoint delay</secondary>
+       </indexterm>
+       
+       <indexterm>
+         <primary>Serializable Snapshot Isolation</primary>
+         <secondary>WAL checkpoint delay</secondary>
+       </indexterm>
+
+       <para>
+         Predicate locks are held per-cluster, not per database.
+         This means that serializeable transactions in one database can have
+         effects in another.
+         Long running serializeable transactions, as might occur accidentally
+         when
+         <link linkend="app-psql-meta-command-pset-pager">pagination</link>
+         halts <link linkend="app-psql">psql</link> output, can have
+         significant inter-database effects.
+         These include exhausting available predicate locks and
+         cluster-wide <link linkend="ports12">WAL checkpoint delay</link>.
+         When making use of serializeable transactions consider having
+         separate clusters for production and non-production use.
+       </para>
+     </listitem>
     </itemizedlist>
    </para>
 
-- 
2.30.2

#13David G. Johnston
david.g.johnston@gmail.com
In reply to: Karl O. Pinc (#12)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Tue, Oct 3, 2023 at 10:56 AM Karl O. Pinc <kop@karlpinc.com> wrote:

On Mon, 2 Oct 2023 15:18:32 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Version 7

0001 - I would just call the section:
Capturing Command Results into Variables
I would add commentary in there that it is only possible for variables to
take on single value at any given time and so in order to handle multiple
row results you need to instantiate a loop as per 43.6.6

0002 - {Inferred | Indirect} Types ?
We are already in the Declarations section so the fact we are declaring new
variables is already covered.
"Instead of literally writing a type name you can write variable%TYPE and
the system will indirectly apply the then-current type of the named
variable to the newly declared variable." (using "copy the then-current"
reads pretty well and makes the existing title usable...)

0003 - The noun "Exception" here means "deviating from the normal flow of
the code", not, "A subclass of error". I don't see this title change being
particularly beneficial.

0004 - Agreed, but "You can raise an error explicitly as described in
"Errors and Messages". I would not use the phrase "raise an exception", it
doesn't fit.

0005 - This tone of voice is used throughout the introductory documentation
sections, this single change doesn't seem warranted.

0006 - Useful. The view itself provides all configuration parameters known
to the system, the "or selected" isn't true of the view itself, and it
seems to go without saying that the user can add a where clause to any
query they write using that view. At most I'd make one of the examples
include a where clause.

0007 - I'm leaning toward this area being due for some improvement,
especially given the v16 changes bring new attention to it, but this patch
doesn't scream "improvement" to me.

0008 - Same as 0007. INHERIT is no longer an attribute though, it is a
property of membership. This seems more acceptable on its own but I'd need
more time to take in the big picture myself.

That's it for now. I'll look over the other 8 when I can.

David J.

#14Karl O. Pinc
kop@karlpinc.com
In reply to: David G. Johnston (#13)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Tue, 3 Oct 2023 14:51:31 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:

0001 - I would just call the section:
Capturing Command Results into Variables

I like your wording a lot. Let's use it!

I would add commentary in there that it is only possible for
variables to take on single value at any given time and so in order
to handle multiple row results you need to instantiate a loop as per
43.6.6

That sounds reasonable. Let me see what I can come up with.
I'll do it in a separate commit.

0002 - {Inferred | Indirect} Types ?
We are already in the Declarations section so the fact we are
declaring new variables is already covered.

I agree. But the problem is that the section title needs
to stand on it's own when the table of contents is scanned.
By that I don't mean that getting context from a "Declaration"
higher level section is somehow out-of-bounds, but that
neither "inferred" nor "indirect" has a recognizable meaning
unless the section body itself is read.

I thought about: Referencing Existing Types
But the problem with that is that the reader does not know
that this has to do with the types of existing objects
rather than working with user-defined types (or something else).

Also, I kind of like "re-using". Shorter, simpler, word.

There is: Re-Using the Type of Objects

"Objects" is not very clear. Variables are very different from
columns. It seemed best to just write it out.

"Instead of literally writing a type name you can write variable%TYPE
and the system will indirectly apply the then-current type of the
named variable to the newly declared variable."

I've no objection to the section leading with a summary sentence like
this. The trouble is coming up with something good. I'd go with
"You can reference the data type of an existing column or variable
with the %TYPE notation. The syntax is:" Shorter and simpler.

Along with this change, it might be nice to move the "By using %TYPE
..." paragraph to after the first example (before the first paragraph).

But this is really feature creep for this commit. :)

(using "copy the
then-current" reads pretty well and makes the existing title
usable...)

I disagree. The title needs to be understandable without reading
the section body.

0003 - The noun "Exception" here means "deviating from the normal
flow of the code", not, "A subclass of error". I don't see this
title change being particularly beneficial.

Isn't the entire section about "deviating from the normal flow of the
code"? That's what makes me want "Exception" in the section title.

0004 - Agreed, but "You can raise an error explicitly as described in
"Errors and Messages". I would not use the phrase "raise an
exception", it doesn't fit.

I like the brevity of your sentence. And you're right that
the sentence does not flow as written. How about:

You can raise an exception to throw an error as described in
"Errors and Messages".

? I remain (overly?) focused on the word "exception", since that's
whats in the brain of the user that's writing RAISE EXCEPTION.
It matters if exceptions and errors are different. If they're
not, then it also matters since it's exceptions that the user's
code raises.

0005 - This tone of voice is used throughout the introductory
documentation sections, this single change doesn't seem warranted.

Ok. I'll drop it unless somebody else chimes in.

0006 - Useful. The view itself provides all configuration parameters
known to the system, the "or selected" isn't true of the view itself,
and it seems to go without saying that the user can add a where
clause to any query they write using that view. At most I'd make one
of the examples include a where clause.

Good points.

I'll get rid of the ", or selected,". May as well leave the
examples as short as possible. Less is more. :)

0007 - I'm leaning toward this area being due for some improvement,
especially given the v16 changes bring new attention to it, but this
patch doesn't scream "improvement" to me.

Let's see how it looks with 0012, which uses the vocabulary.

I do like the "Roles therefore control who has what access to which
objects." sentence. I was shooting for shorter sentences, but then
when I broke the existing sentences into pieces I couldn't resist
adding text.

0008 - Same as 0007. INHERIT is no longer an attribute though, it is
a property of membership.

(!) I'm going to have to pay more attention.

This seems more acceptable on its own but
I'd need more time to take in the big picture myself.

It's the big picture that I'm trying to draw. 0007, 0008, and 0012
all kind of go together. It may be worth forking the email thread,
or something.

Have you any thoughts on the "permissions", "privleges" and
"attributes" vocabulary/concepts used in this area?

Thanks very much for the review. I'm going to wait a bit
before incorporating your suggestions and sending in another
patch set in case Daniel chimes in. (I'm slightly
nervous about the renumbering making the thread hard to follow.)

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#15David G. Johnston
david.g.johnston@gmail.com
In reply to: Karl O. Pinc (#14)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Tue, Oct 3, 2023 at 4:15 PM Karl O. Pinc <kop@karlpinc.com> wrote:

On Tue, 3 Oct 2023 14:51:31 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:

Isn't the entire section about "deviating from the normal flow of the
code"? That's what makes me want "Exception" in the section title.

It is about how error handling in a procedure diverts the flow from the
normal code path to some other code path - what that path is labelled is
less important than the thing that causes the diversion - an error.

? I remain (overly?) focused on the word "exception", since that's
whats in the brain of the user that's writing RAISE EXCEPTION.
It matters if exceptions and errors are different. If they're
not, then it also matters since it's exceptions that the user's
code raises.

It's unfortunate the keyword to raise the message level "ERROR" is
"EXCEPTION" in that command but I'd rather simply handle that one anomaly
that make the rest of the system use the word exception, especially seem to
be fairly consistent in our usage of ERROR already. I'm sympathetic that
other systems out there also encourage the usage of exception in this
context instead of error - but not to the point of opening up this
long-standing decision for rework.

Have you any thoughts on the "permissions", "privleges" and
"attributes" vocabulary/concepts used in this area?

I think we benefit from being able to equate permissions and privileges and
trying to separate them is going to be more harmful than helpful. The
limited things that role attributes permit, and how they fall outside the
privilege/permission concept as we use it, isn't something that I've
noticed is a problem that needs addressing.

(I'm slightly

nervous about the renumbering making the thread hard to follow.)

0009 - Something just seems off with this one. Unless there are more
places with this type in use I would just move the relevant notes (i.e.,
the one in proallargtypes) to that column and be done with it. If there
are multiple places then moving the notes to the main docs and
cross-referencing to them seems warranted. I also wouldn't call it legacy.

0010 -

When creating new objects, if a schema qualification is not given with the
name the first extant entry in the search_path is chosen; then an error
will be raised should the supplied name already exist in that schema.
In contexts where the object must already exist, but its name is not schema
qualified, the extant search_path schemas will be consulted serially until
one of them contains an appropriate object, returning it, or all schemas
are consulted, resulting in an object not found error.

I'm not seeing much value in presenting the additional user/public details
here. Especially as it would then seem appropriate to include pg_temp.
And now we have to deal with the fact that by default the public schema
isn't so public anymore.

David J.

#16David G. Johnston
david.g.johnston@gmail.com
In reply to: David G. Johnston (#15)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Extending my prior email which is now redundant.

On Tue, Oct 3, 2023 at 7:00 PM David G. Johnston <david.g.johnston@gmail.com>
wrote:

On Tue, Oct 3, 2023 at 4:15 PM Karl O. Pinc <kop@karlpinc.com> wrote:

On Tue, 3 Oct 2023 14:51:31 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:

Isn't the entire section about "deviating from the normal flow of the
code"? That's what makes me want "Exception" in the section title.

It is about how error handling in a procedure diverts the flow from the
normal code path to some other code path - what that path is labelled is
less important than the thing that causes the diversion - an error.

? I remain (overly?) focused on the word "exception", since that's
whats in the brain of the user that's writing RAISE EXCEPTION.
It matters if exceptions and errors are different. If they're
not, then it also matters since it's exceptions that the user's
code raises.

It's unfortunate the keyword to raise the message level "ERROR" is
"EXCEPTION" in that command but I'd rather simply handle that one anomaly
that make the rest of the system use the word exception, especially seem to
be fairly consistent in our usage of ERROR already. I'm sympathetic that
other systems out there also encourage the usage of exception in this
context instead of error - but not to the point of opening up this
long-standing decision for rework.

Have you any thoughts on the "permissions", "privleges" and
"attributes" vocabulary/concepts used in this area?

I think we benefit from being able to equate permissions and privileges
and trying to separate them is going to be more harmful than helpful. The
limited things that role attributes permit, and how they fall outside the
privilege/permission concept as we use it, isn't something that I've
noticed is a problem that needs addressing.

(I'm slightly

nervous about the renumbering making the thread hard to follow.)

0009 - Something just seems off with this one. Unless there are more
places with this type in use I would just move the relevant notes (i.e.,
the one in proallargtypes) to that column and be done with it. If there
are multiple places then moving the notes to the main docs and
cross-referencing to them seems warranted. I also wouldn't call it legacy.

0010 -

When creating new objects, if a schema qualification is not given with the
name the first extant entry in the search_path is chosen; then an error
will be raised should the supplied name already exist in that schema.
In contexts where the object must already exist, but its name is not
schema qualified, the extant search_path schemas will be consulted serially
until one of them contains an appropriate object, returning it, or all
schemas are consulted, resulting in an object not found error.

I'm not seeing much value in presenting the additional user/public details
here. Especially as it would then seem appropriate to include pg_temp.
And now we have to deal with the fact that by default the public schema
isn't so public anymore.

0011 - (first pass, going from memory, might have missed some needed
details)

Aside from non-atomic SQL routine bodies (functions and procedures) the
result of the server executing SQL sent by the connected client does not
result in raw SQL, or textual expressions, being stored for later
evaluation. All objects are identified (or created) during execution and
their effects stored within the system catalogs and assigned system
identifiers (oids) to provide an absolute and immutable reference to be
used while establishing inter-object dependencies. In short, indirect
actions taken by the server, based upon stored knowledge, can and often
will execute while in a search_path that only contains the pg_catalog
schema so that the stored knowledge can be found.

For routines written in any language except Atomic SQL the textual body of
the routine is stored as-is within the database. When executing such a
routine the (parent) session basically opens up a new connection to the
server (one per routine) and within that new sub-session sends the SQL
contained within the routine to the server for execution just like any
other client, and therefore any object references present in that SQL need
to be resolved to a schema as previously discussed. By default, upon
connecting, the newly created session is updated so that its settings take
on the current values in the parent session. When authoring a routine this
is often undesirable as the behavior of the routine now depends upon an
environment that is not definitively known to the routine author.
Schema-qualifying object references within the routine body is one tool to
remove such uncertainty. Another is by using the SET clause of the
relevant CREATE SQL Command to specify what the value of important settings
are to be.

The key takeaway from the preceding two paragraphs is that because routines
are stored as text and their settings resolved at execution time, and
indirect server actions can invoke those routines with a pg_catalog only
search_path, any routine that potentially can be invoked in that manner and
makes use of search_path should either be modified to eliminate such use or
define the required search_path via the SET option during its creation or
replacement.

0012 - (this has changed recently too, I'm not sure how this fits within
the rest. I still feel like something is missing even in my revision but
not sure what or if it is covered sufficiently nearby)

All roles are ultimately owned and managed by the bootstrap superuser, who
can establish trees of groups and users upon which the object permission
granting system works. By enabling the CREATEROLE attribute on a user a
superuser can delegate role creation to other people (it is inadvisable to
enable CREATEROLE on a group) who can then construct their own trees of
groups and users.

(not sure how true this is still but something to consider in terms of big
picture role setups)
It is likewise inadvisable to create multiple superusers since in practice
their actions in many cases can be made to look attributable to the
bootstrap superuser. It is necessary to enlist services outside of
PostgreSQL to adequately establish auditing in a multi-superuser setup.

Note my intentional use of users and groups here. We got rid of the
distinction with CREATE ROLE but in terms of system administration they
still have, IMO, significant utility.

0013 - +1
0014 - +1

0015 - I'd almost rather only note in CREATE FUNCTION that PARALLEL does
not matter for a trigger returning function as triggers only execute in
cases of data writing which precludes using parallelism. Which is indeed
what the documentation explicitly calls out in "When Can Parallel Query Be
Used?" so it isn't inference from omission.

I don't have a problem saying in the trigger documentation, maybe at the
very end:

The functions that triggers execute are more appropriately considered
procedures but since the later feature did not exist when triggers were
implemented precedent compels the dba to write their routines as
functions. As a consequence, function attributes such as PARALLEL, and
WINDOW, are possible to define on a function that is to be used as a
trigger but will have no effect. (though I would think at least some of
these get rejected outright)

0016 - not within my knowledge base

David J.

#17Shubham Khanna
khannashubham1197@gmail.com
In reply to: David G. Johnston (#16)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Thu, Nov 30, 2023 at 3:59 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:

Extending my prior email which is now redundant.

On Tue, Oct 3, 2023 at 7:00 PM David G. Johnston <david.g.johnston@gmail.com> wrote:

On Tue, Oct 3, 2023 at 4:15 PM Karl O. Pinc <kop@karlpinc.com> wrote:

On Tue, 3 Oct 2023 14:51:31 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:

Isn't the entire section about "deviating from the normal flow of the
code"? That's what makes me want "Exception" in the section title.

It is about how error handling in a procedure diverts the flow from the normal code path to some other code path - what that path is labelled is less important than the thing that causes the diversion - an error.

? I remain (overly?) focused on the word "exception", since that's
whats in the brain of the user that's writing RAISE EXCEPTION.
It matters if exceptions and errors are different. If they're
not, then it also matters since it's exceptions that the user's
code raises.

It's unfortunate the keyword to raise the message level "ERROR" is "EXCEPTION" in that command but I'd rather simply handle that one anomaly that make the rest of the system use the word exception, especially seem to be fairly consistent in our usage of ERROR already. I'm sympathetic that other systems out there also encourage the usage of exception in this context instead of error - but not to the point of opening up this long-standing decision for rework.

Have you any thoughts on the "permissions", "privleges" and
"attributes" vocabulary/concepts used in this area?

I think we benefit from being able to equate permissions and privileges and trying to separate them is going to be more harmful than helpful. The limited things that role attributes permit, and how they fall outside the privilege/permission concept as we use it, isn't something that I've noticed is a problem that needs addressing.

(I'm slightly
nervous about the renumbering making the thread hard to follow.)

0009 - Something just seems off with this one. Unless there are more places with this type in use I would just move the relevant notes (i.e., the one in proallargtypes) to that column and be done with it. If there are multiple places then moving the notes to the main docs and cross-referencing to them seems warranted. I also wouldn't call it legacy.

0010 -

When creating new objects, if a schema qualification is not given with the name the first extant entry in the search_path is chosen; then an error will be raised should the supplied name already exist in that schema.
In contexts where the object must already exist, but its name is not schema qualified, the extant search_path schemas will be consulted serially until one of them contains an appropriate object, returning it, or all schemas are consulted, resulting in an object not found error.

I'm not seeing much value in presenting the additional user/public details here. Especially as it would then seem appropriate to include pg_temp. And now we have to deal with the fact that by default the public schema isn't so public anymore.

0011 - (first pass, going from memory, might have missed some needed details)

Aside from non-atomic SQL routine bodies (functions and procedures) the result of the server executing SQL sent by the connected client does not result in raw SQL, or textual expressions, being stored for later evaluation. All objects are identified (or created) during execution and their effects stored within the system catalogs and assigned system identifiers (oids) to provide an absolute and immutable reference to be used while establishing inter-object dependencies. In short, indirect actions taken by the server, based upon stored knowledge, can and often will execute while in a search_path that only contains the pg_catalog schema so that the stored knowledge can be found.

For routines written in any language except Atomic SQL the textual body of the routine is stored as-is within the database. When executing such a routine the (parent) session basically opens up a new connection to the server (one per routine) and within that new sub-session sends the SQL contained within the routine to the server for execution just like any other client, and therefore any object references present in that SQL need to be resolved to a schema as previously discussed. By default, upon connecting, the newly created session is updated so that its settings take on the current values in the parent session. When authoring a routine this is often undesirable as the behavior of the routine now depends upon an environment that is not definitively known to the routine author. Schema-qualifying object references within the routine body is one tool to remove such uncertainty. Another is by using the SET clause of the relevant CREATE SQL Command to specify what the value of important settings are to be.

The key takeaway from the preceding two paragraphs is that because routines are stored as text and their settings resolved at execution time, and indirect server actions can invoke those routines with a pg_catalog only search_path, any routine that potentially can be invoked in that manner and makes use of search_path should either be modified to eliminate such use or define the required search_path via the SET option during its creation or replacement.

0012 - (this has changed recently too, I'm not sure how this fits within the rest. I still feel like something is missing even in my revision but not sure what or if it is covered sufficiently nearby)

All roles are ultimately owned and managed by the bootstrap superuser, who can establish trees of groups and users upon which the object permission granting system works. By enabling the CREATEROLE attribute on a user a superuser can delegate role creation to other people (it is inadvisable to enable CREATEROLE on a group) who can then construct their own trees of groups and users.

(not sure how true this is still but something to consider in terms of big picture role setups)
It is likewise inadvisable to create multiple superusers since in practice their actions in many cases can be made to look attributable to the bootstrap superuser. It is necessary to enlist services outside of PostgreSQL to adequately establish auditing in a multi-superuser setup.

Note my intentional use of users and groups here. We got rid of the distinction with CREATE ROLE but in terms of system administration they still have, IMO, significant utility.

0013 - +1
0014 - +1

0015 - I'd almost rather only note in CREATE FUNCTION that PARALLEL does not matter for a trigger returning function as triggers only execute in cases of data writing which precludes using parallelism. Which is indeed what the documentation explicitly calls out in "When Can Parallel Query Be Used?" so it isn't inference from omission.

I don't have a problem saying in the trigger documentation, maybe at the very end:

The functions that triggers execute are more appropriately considered procedures but since the later feature did not exist when triggers were implemented precedent compels the dba to write their routines as functions. As a consequence, function attributes such as PARALLEL, and WINDOW, are possible to define on a function that is to be used as a trigger but will have no effect. (though I would think at least some of these get rejected outright)

0016 - not within my knowledge base

I reviewed the Patch and found a few changes. Please have a look at them:

-v7-0002-Change-section-heading-to-better-describe-referen.patch

"Re-Using the Type of Columns and Variables" seems adequate. Getting
something in there about declartions seems too wordy. I thought
perhaps "Referencing" instead of "Re-Using", but "referencing" isn't
perfect and "re-using" is generic enough, shorter, and simpler to

Here 'declartions' should be replaced with 'declarations'.

-v7-0012-Explain-role-management.patch

+ The managment of most database objects is by way of granting some role

Here 'managment' should be replaced with 'management'.

-v7-0013-Hyperlink-from-CREATE-FUNCTION-reference-page-to-.patch

Is is nice to have a link in the reference material to a full discussion.

Here 'is' should be removed.

-v7-0015-Trigger-authors-need-not-worry-about-parallelism.patch

Plus, this patch adds an index entry so the new verbage is easy to find
for those who do investigate.

Here 'verbage' should be replaced with 'verbiage'.

-v7-0016-Predicate-locks-are-held-per-cluster-not-per-data.patch

This is a significant corner case and so should be documented. It is
also somewhat suprising since the databases within a cluster are
otherwise isolated, at least from the user's perspective.

Here 'suprising' should be replaced with 'surprising'.

Predicate locks are held per-cluster, not per database.
+         This means that serializeable transactions in one database can have
+         effects in another.
+         Long running serializeable transactions, as might occur accidentally
+         when
+         <link linkend="app-psql-meta-command-pset-pager">pagination</link>
+         halts <link linkend="app-psql">psql</link> output, can have
+         significant inter-database effects.
+         These include exhausting available predicate locks and
+         cluster-wide <link linkend="ports12">WAL checkpoint delay</link>.
+         When making use of serializeable transactions consider having
+         separate clusters for production and non-production use.

Here 'serializeable' should be replaced with 'serializable'.

Thanks and Regards,
Shubham Khanna.

#18Karl O. Pinc
kop@karlpinc.com
In reply to: Shubham Khanna (#17)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

Hello,

Thank you all for your help. I won't be able to submit
new patches based on reviews for 2 weeks.

On Thu, 30 Nov 2023 16:02:28 +0530
Shubham Khanna <khannashubham1197@gmail.com> wrote:
<snip>

-v7-0012-Explain-role-management.patch

+ The managment of most database objects is by way of granting some
role

Here 'managment' should be replaced with 'management'.

<snip>

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#19Andrey M. Borodin
x4mmm@yandex-team.ru
In reply to: Karl O. Pinc (#18)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On 1 Dec 2023, at 19:00, Karl O. Pinc <kop@karlpinc.com> wrote:

I won't be able to submit
new patches based on reviews for 2 weeks.

Hi everyone!

Is there any work going on? Maybe is someone interested in moving this forward?

Thanks!

Best regards, Andrey Borodin.

#20Robert Treat
rob@xzilla.net
In reply to: Andrey M. Borodin (#19)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Thu, Mar 28, 2024 at 8:16 AM Andrey M. Borodin <x4mmm@yandex-team.ru> wrote:

On 1 Dec 2023, at 19:00, Karl O. Pinc <kop@karlpinc.com> wrote:

I won't be able to submit
new patches based on reviews for 2 weeks.

Hi everyone!

Is there any work going on? Maybe is someone interested in moving this forward?

Thanks!

Hey Andrey,

I spoke with Karl briefly on this and he is working on getting an
updated patch together. The work now involves incorporating feedback
and some rebasing, but hopefully we will see something in the next few
days.

Robert Treat
https://xzilla.net

#21Karl O. Pinc
kop@karlpinc.com
In reply to: Robert Treat (#20)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On Thu, 28 Mar 2024 08:28:16 -0400
Robert Treat <rob@xzilla.net> wrote:

I spoke with Karl briefly on this and he is working on getting an
updated patch together. The work now involves incorporating feedback
and some rebasing, but hopefully we will see something in the next few
days.

Well, Friday has come and gone and I've not gotten to this.
I'll see if I can spend time tomorrow.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#22Andrey M. Borodin
x4mmm@yandex-team.ru
In reply to: Karl O. Pinc (#21)
Re: Various small doc improvements; plpgsql, schemas, permissions, oidvector

On 30 Mar 2024, at 11:39, Karl O. Pinc <kop@karlpinc.com> wrote:

Well, Friday has come and gone and I've not gotten to this.
I'll see if I can spend time tomorrow.

No worries, Karl! I just wanted to know if anyone is interested in this thread, and, now is obvious that you are. Thanks for your work!

Best regards, Andrey Borodin.