From: Tom Lane Date: Mon, 3 Oct 2005 23:43:45 +0000 (+0000) Subject: COPY's test for read-only transaction was backward; it prohibited COPY TO X-Git-Tag: REL7_4_9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31d276d0ed6d26f633a6348c8f9602bfb660650e;p=thirdparty%2Fpostgresql.git COPY's test for read-only transaction was backward; it prohibited COPY TO where it should prohibit COPY FROM. Found by Alon Goldshuv. --- diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index e593e47af56..7888e465c27 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -41,6 +41,11 @@ length when using a multiple-byte character set (Yoshiyuki Asaba) In prior releases, the padding of CHAR() was incorrect because it only padded to the specified number of bytes without considering how many characters were stored. +Fix the sense of the test for read-only transaction +in COPY +The code formerly prohibited COPY TO, where it should +prohibit COPY FROM. + Fix planning problem with outer-join ON clauses that reference only the inner-side relation Further fixes for x FULL JOIN y ON true corner diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 95f860200c0..c4e261549a2 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -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 $ * *------------------------------------------------------------------------- */ @@ -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")));