Does TRUNCATE emit changes with REPLICA IDENTITY FULL?

2019-11-11 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/sql-truncate.html
Description:

Hi,

The documentation says that TRUNCATE ignores ON DELETE triggers, but it
doesn't explicitly mention what happens if we use `wal_level = logical` and
`REPLICA IDENTITY FULL`. Does TRUNCATE emit changes for each row and clog
the WAL, or will it still be blazing fast?

Kind Regards,,
m.


Re: Does 'instead of delete' trigger support modification of OLD

2019-11-11 Thread Liudmila Mantrova


> 8 нояб. 2019 г., в 0:26, Bruce Momjian  написал(а):
> 
> First, notice "only", which was missing from the later sentence:
> 
>For INSERT and UPDATE
>operations [only], the trigger may modify the
>NEW row before returning it.
> 
> which I have now added with my applied patch to all supported releases. 
> 

Hi Bruce, 

I happened to browse recent documentation-related commits and I didn’t see this 
patch in REL_12_STABLE. Judging by the commit message, it should be applied 
there too.



Re: The word "virgin" used incorrectly and probably better off replaced

2019-11-11 Thread Tom Lane
Alvaro Herrera  writes:
> One problem with doing it that way is that the proposed parenthical
> comment partly duplicates the text immediately following it, so I'm no
> longer so sure that adding it is good; I think that changing "local
> additions" to "local additions and changes" might be sufficient, or
> maybe that is too obscure for novices?  For create_database.sgml it does
> seem to make a little more sense, but I'm not 100% there either.

I think we should stick to the wording we've agreed to be clearer.
Maybe do manage-ag.sgml like so:

 By instructing CREATE DATABASE to copy template0 instead of
 template1, you can create a pristine user database, that is one where
 no user-defined objects exist and where system objects have not been
 altered.  This is particularly handy ...

regards, tom lane




Re: The word "virgin" used incorrectly and probably better off replaced

2019-11-11 Thread Alvaro Herrera
On 2019-Nov-08, Tom Lane wrote:

> Alvaro Herrera  writes:
> > On 2019-Nov-08, Tom Lane wrote:
> >> So the patch becomes s/virgin/pristine/g plus add a parenthetical
> >> definition for the first use?  Works for me.
> 
> > Well, there are three uses of the word "virgin".  The first is for
> > "virgin user", and the patch turns that into just "user".
> 
> Uh, no, read the next lines.  In both cases those are referring
> to "virgin user database" or "virgin database", and this patch
> is removing an important qualifier.  It needs to be s/virgin/pristine/
> in all these places.

Doh, right.

One problem with doing it that way is that the proposed parenthical
comment partly duplicates the text immediately following it, so I'm no
longer so sure that adding it is good; I think that changing "local
additions" to "local additions and changes" might be sufficient, or
maybe that is too obscure for novices?  For create_database.sgml it does
seem to make a little more sense, but I'm not 100% there either.

Maybe "changes" can become "database-local system changes"? i.e.,

By instructing CREATE DATABASE to copy template0 instead of
template1, you can create a pristine user database that contains
none of the site-local additions and database-local system changes
in template1.

... though, argh, "-local" appearing twice makes that look bad too :-(
(I'm not sure that it is clear what a "database-local system change" is.)

-- 
Álvaro Herrerahttps://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
diff --git a/doc/src/sgml/manage-ag.sgml b/doc/src/sgml/manage-ag.sgml
index 0154064e50..00ecc2d843 100644
--- a/doc/src/sgml/manage-ag.sgml
+++ b/doc/src/sgml/manage-ag.sgml
@@ -199,11 +199,11 @@ createdb -O rolename dbnameCREATE DATABASE to copy template0 instead
-   of template1, you can create a virgin user
-   database that contains none of the site-local additions in
+   of template1, you can create a pristine user
+   database that contains none of the site-local additions and changes in
template1.  This is particularly handy when restoring a
pg_dump dump: the dump script should be restored in a
-   virgin database to ensure that one recreates the correct contents
+   pristine database to ensure that one recreates the correct contents
of the dumped database, without conflicting with objects that
might have been added to template1 later on.
   
diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml
index 4014f6703b..7b48263364 100644
--- a/doc/src/sgml/ref/create_database.sgml
+++ b/doc/src/sgml/ref/create_database.sgml
@@ -54,8 +54,10 @@ CREATE DATABASE name
system database template1.  A different template can be
specified by writing TEMPLATE
name.  In particular,
-   by writing TEMPLATE template0, you can create a virgin
-   database containing only the standard objects predefined by your
+   by writing TEMPLATE template0, you can create a
+   pristine database (one where no user-defined objects exist and where
+   system objects have not been altered)
+   containing only the standard objects predefined by your
version of PostgreSQL.  This is useful
if you wish to avoid copying
any installation-local objects that might have been added to