COPY in readonly transaction.

Started by Alon Goldshuvover 20 years ago2 messagesbugs
Jump to latest
#1Alon Goldshuv
agoldshuv@greenplum.com

In the folllowing check (copy.c:DoCopy() ), I *think* that the check for the
is_from flag is mistakenly negated. is_from means -> from file to database,
therefore we should check for <XactReadOnly && is_from>, and not
<XactReadOnly && !is_from>. The current code allows loading and disallows
reading in read-only.

/* check read-only transaction */
if (XactReadOnly && !is_from &&
!isTempNamespace(RelationGetNamespace(cstate->rel)))
ereport(ERROR,
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
errmsg("transaction is read-only")));

Alon.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alon Goldshuv (#1)
Re: COPY in readonly transaction.

"Alon Goldshuv" <agoldshuv@greenplum.com> writes:

In the folllowing check (copy.c:DoCopy() ), I *think* that the check for the
is_from flag is mistakenly negated.

Yeah, it's definitely backward :-( Will fix.

regards, tom lane