From 3dfec7f73ef3a4e281648f1c0e1a7deaf1850320 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 3 Oct 2005 23:43:29 +0000 Subject: [PATCH] COPY's test for read-only transaction was backward; it prohibited COPY TO where it should prohibit COPY FROM. Found by Alon Goldshuv. --- doc/src/sgml/release.sgml | 12 +++++++++++- src/backend/commands/copy.c | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index 41584ce24b..70647d7534 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -46,6 +46,11 @@ DATABASE This should fix recent reports of index is not a btree failures when a crash occurs shortly after CREATE DATABASE. +Fix the sense of the test for read-only transaction +in COPY +The code formerly prohibited COPY TO, where it should +prohibit COPY FROM. + Handle consecutive embedded newlines in COPY CSV-mode input Fix date_trunc(week) for dates near year @@ -2817,6 +2822,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 79ffac04df..5db8856963 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -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"))); -- 2.50.1