Clarify that COPY FREEZE is not a hard rule.
Remove message when FREEZE not honoured, clarify reasons in comments and docs.
This commit is contained in:
parent
31a891857a
commit
1eb6cee499
@ -186,17 +186,19 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
|
|||||||
<term><literal>FREEZE</literal></term>
|
<term><literal>FREEZE</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Specifies copying the data with rows already frozen, just as they
|
Requests copying the data with rows already frozen, just as they
|
||||||
would be after running the <command>VACUUM FREEZE</> command.
|
would be after running the <command>VACUUM FREEZE</> command.
|
||||||
This is intended as a performance option for initial data loading.
|
This is intended as a performance option for initial data loading.
|
||||||
Rows will be frozen only if the table being loaded has been created
|
Rows will be frozen only if the table being loaded has been created
|
||||||
in the current subtransaction, there are no cursors open and there
|
in the current subtransaction, there are no cursors open and there
|
||||||
are no older snapshots held by this transaction. If those conditions
|
are no older snapshots held by this transaction. If those conditions
|
||||||
are not met the command will continue without error though will not
|
are not met the command will continue without error though will not
|
||||||
freeze rows.
|
freeze rows. It is also possible in rare cases that the request
|
||||||
|
cannot be honoured for internal reasons, hence <literal>FREEZE</literal>
|
||||||
|
is more of a guideline than a hard rule.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Note that all sessions will immediately be able to see the data
|
Note that all other sessions will immediately be able to see the data
|
||||||
once it has been successfully loaded. This violates the normal rules
|
once it has been successfully loaded. This violates the normal rules
|
||||||
of MVCC visibility and by specifying this option the user acknowledges
|
of MVCC visibility and by specifying this option the user acknowledges
|
||||||
explicitly that this is understood.
|
explicitly that this is understood.
|
||||||
|
@ -1993,6 +1993,11 @@ CopyFrom(CopyState cstate)
|
|||||||
* after xact cleanup. Note that the stronger test of exactly
|
* after xact cleanup. Note that the stronger test of exactly
|
||||||
* which subtransaction created it is crucial for correctness
|
* which subtransaction created it is crucial for correctness
|
||||||
* of this optimisation.
|
* of this optimisation.
|
||||||
|
*
|
||||||
|
* Note that because the test is unreliable in case of relcache reset
|
||||||
|
* we cannot guarantee that we can honour the request to FREEZE.
|
||||||
|
* If we cannot honour the request we do so silently, firstly to
|
||||||
|
* avoid noise for the user and also to avoid obscure test failures.
|
||||||
*/
|
*/
|
||||||
if (cstate->freeze &&
|
if (cstate->freeze &&
|
||||||
ThereAreNoPriorRegisteredSnapshots() &&
|
ThereAreNoPriorRegisteredSnapshots() &&
|
||||||
@ -2001,11 +2006,6 @@ CopyFrom(CopyState cstate)
|
|||||||
hi_options |= HEAP_INSERT_FROZEN;
|
hi_options |= HEAP_INSERT_FROZEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cstate->freeze && (hi_options & HEAP_INSERT_FROZEN) == 0)
|
|
||||||
ereport(NOTICE,
|
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
|
||||||
errmsg("FREEZE option specified but pre-conditions not met")));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need a ResultRelInfo so we can use the regular executor's
|
* We need a ResultRelInfo so we can use the regular executor's
|
||||||
* index-entry-making machinery. (There used to be a huge amount of code
|
* index-entry-making machinery. (There used to be a huge amount of code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user