Commit 060d13f7 authored by Tom Lane's avatar Tom Lane

COPY's test for read-only transaction was backward; it prohibited COPY TO

where it should prohibit COPY FROM.  Found by Alon Goldshuv.
parent 53e47cdd
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.387 2005/10/03 16:04:13 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.388 2005/10/03 23:43:06 tgl Exp $
Typical markup: Typical markup:
...@@ -2097,6 +2097,11 @@ DATABASE</></para> ...@@ -2097,6 +2097,11 @@ DATABASE</></para>
<para>This should fix recent reports of <quote>index is not a btree</> <para>This should fix recent reports of <quote>index is not a btree</>
failures when a crash occurs shortly after <command>CREATE failures when a crash occurs shortly after <command>CREATE
DATABASE</>.</para></listitem> DATABASE</>.</para></listitem>
<listitem><para>Fix the sense of the test for read-only transaction
in <command>COPY</></para>
<para>The code formerly prohibited <command>COPY TO</>, where it should
prohibit <command>COPY FROM</>.
</para></listitem>
<listitem><para>Handle consecutive embedded newlines in <command>COPY</> <listitem><para>Handle consecutive embedded newlines in <command>COPY</>
CSV-mode input</para></listitem> CSV-mode input</para></listitem>
<listitem><para>Fix <function>date_trunc(week)</> for dates near year <listitem><para>Fix <function>date_trunc(week)</> for dates near year
...@@ -4868,6 +4873,11 @@ length when using a multiple-byte character set (Yoshiyuki Asaba)</para> ...@@ -4868,6 +4873,11 @@ length when using a multiple-byte character set (Yoshiyuki Asaba)</para>
<para>In prior releases, the padding of <type>CHAR()</> was incorrect <para>In prior releases, the padding of <type>CHAR()</> was incorrect
because it only padded to the specified number of bytes without because it only padded to the specified number of bytes without
considering how many characters were stored.</para></listitem> considering how many characters were stored.</para></listitem>
<listitem><para>Fix the sense of the test for read-only transaction
in <command>COPY</></para>
<para>The code formerly prohibited <command>COPY TO</>, where it should
prohibit <command>COPY FROM</>.
</para></listitem>
<listitem><para>Fix planning problem with outer-join ON clauses that reference <listitem><para>Fix planning problem with outer-join ON clauses that reference
only the inner-side relation</para></listitem> only the inner-side relation</para></listitem>
<listitem><para>Further fixes for <literal>x FULL JOIN y ON true</> corner <listitem><para>Further fixes for <literal>x FULL JOIN y ON true</> corner
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.251 2005/09/24 22:54:36 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.252 2005/10/03 23:43:09 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -857,7 +857,7 @@ DoCopy(const CopyStmt *stmt) ...@@ -857,7 +857,7 @@ DoCopy(const CopyStmt *stmt)
(is_from ? RowExclusiveLock : AccessShareLock)); (is_from ? RowExclusiveLock : AccessShareLock));
/* check read-only transaction */ /* check read-only transaction */
if (XactReadOnly && !is_from && if (XactReadOnly && is_from &&
!isTempNamespace(RelationGetNamespace(cstate->rel))) !isTempNamespace(RelationGetNamespace(cstate->rel)))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION), (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment