]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
COPY's test for read-only transaction was backward; it prohibited COPY TO REL8_0_4
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 3 Oct 2005 23:43:29 +0000 (23:43 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 3 Oct 2005 23:43:29 +0000 (23:43 +0000)
where it should prohibit COPY FROM.  Found by Alon Goldshuv.

doc/src/sgml/release.sgml
src/backend/commands/copy.c

index 41584ce24ba4855bef3637f895e442942cc0fe98..70647d7534cab3ab336474ac1798b56201ef8bd1 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.321.4.13 2005/10/03 16:04:51 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.321.4.14 2005/10/03 23:43:27 tgl Exp $
 -->
 
 <appendix id="release">
@@ -46,6 +46,11 @@ DATABASE</></para>
 <para>This should fix recent reports of <quote>index is not a btree</>
 failures when a crash occurs shortly after <command>CREATE
 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</>
 CSV-mode input</para></listitem>
 <listitem><para>Fix <function>date_trunc(week)</> for dates near year
@@ -2817,6 +2822,11 @@ length when using a multiple-byte character set (Yoshiyuki Asaba)</para>
 <para>In prior releases, the padding of <type>CHAR()</> was incorrect
 because it only padded to the specified number of bytes without
 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
 only the inner-side relation</para></listitem>
 <listitem><para>Further fixes for <literal>x FULL JOIN y ON true</> corner
index 79ffac04df020a40725526442e296151c6b2a71e..5db8856963640e8e3de5b5a378594a12d53e54d4 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.236.4.1 2005/05/13 06:35:25 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.236.4.2 2005/10/03 23:43:29 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -900,7 +900,8 @@ DoCopy(const CopyStmt *stmt)
        rel = heap_openrv(relation, (is_from ? RowExclusiveLock : AccessShareLock));
 
        /* check read-only transaction */
-       if (XactReadOnly && !is_from && !isTempNamespace(RelationGetNamespace(rel)))
+       if (XactReadOnly && is_from &&
+               !isTempNamespace(RelationGetNamespace(rel)))
                ereport(ERROR,
                                (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
                                 errmsg("transaction is read-only")));