Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1eb6cee

Browse files
Clarify that COPY FREEZE is not a hard rule.
Remove message when FREEZE not honoured, clarify reasons in comments and docs.
1 parent 31a8918 commit 1eb6cee

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

doc/src/sgml/ref/copy.sgml

+5-3
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,19 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
186186
<term><literal>FREEZE</literal></term>
187187
<listitem>
188188
<para>
189-
Specifies copying the data with rows already frozen, just as they
189+
Requests copying the data with rows already frozen, just as they
190190
would be after running the <command>VACUUM FREEZE</> command.
191191
This is intended as a performance option for initial data loading.
192192
Rows will be frozen only if the table being loaded has been created
193193
in the current subtransaction, there are no cursors open and there
194194
are no older snapshots held by this transaction. If those conditions
195195
are not met the command will continue without error though will not
196-
freeze rows.
196+
freeze rows. It is also possible in rare cases that the request
197+
cannot be honoured for internal reasons, hence <literal>FREEZE</literal>
198+
is more of a guideline than a hard rule.
197199
</para>
198200
<para>
199-
Note that all sessions will immediately be able to see the data
201+
Note that all other sessions will immediately be able to see the data
200202
once it has been successfully loaded. This violates the normal rules
201203
of MVCC visibility and by specifying this option the user acknowledges
202204
explicitly that this is understood.

src/backend/commands/copy.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,11 @@ CopyFrom(CopyState cstate)
19931993
* after xact cleanup. Note that the stronger test of exactly
19941994
* which subtransaction created it is crucial for correctness
19951995
* of this optimisation.
1996+
*
1997+
* Note that because the test is unreliable in case of relcache reset
1998+
* we cannot guarantee that we can honour the request to FREEZE.
1999+
* If we cannot honour the request we do so silently, firstly to
2000+
* avoid noise for the user and also to avoid obscure test failures.
19962001
*/
19972002
if (cstate->freeze &&
19982003
ThereAreNoPriorRegisteredSnapshots() &&
@@ -2001,11 +2006,6 @@ CopyFrom(CopyState cstate)
20012006
hi_options |= HEAP_INSERT_FROZEN;
20022007
}
20032008

2004-
if (cstate->freeze && (hi_options & HEAP_INSERT_FROZEN) == 0)
2005-
ereport(NOTICE,
2006-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2007-
errmsg("FREEZE option specified but pre-conditions not met")));
2008-
20092009
/*
20102010
* We need a ResultRelInfo so we can use the regular executor's
20112011
* index-entry-making machinery. (There used to be a huge amount of code

0 commit comments

Comments
 (0)