Skip to content

Commit

Permalink
COPY's test for read-only transaction was backward; it prohibited COP…
Browse files Browse the repository at this point in the history
…Y TO

where it should prohibit COPY FROM.  Found by Alon Goldshuv.
  • Loading branch information
tglsfdc committed Oct 3, 2005
1 parent 4082f5e commit 31d276d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion doc/src/sgml/release.sgml
@@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.235.2.32 2005/10/03 16:05:09 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.235.2.33 2005/10/03 23:43:42 tgl Exp $
-->

<appendix id="release">
Expand Down Expand Up @@ -41,6 +41,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
Expand Down
5 changes: 3 additions & 2 deletions src/backend/commands/copy.c
Expand Up @@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.213.2.1 2004/01/18 02:15:57 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.213.2.2 2005/10/03 23:43:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Expand Down Expand Up @@ -752,7 +752,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")));
Expand Down

0 comments on commit 31d276d

Please sign in to comment.