Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita9cf48a

Browse files
author
Amit Kapila
committed
Make COPY TO keep locks until the transaction end.
COPY TO released the ACCESS SHARE lock immediately when it was done ratherthan holding on to it until the end of the transaction.This breaks the case where a REPEATABLE READ transaction could see anempty table if it repeats a COPY statement and somebody truncated thetable in the meantime.Before4dded12 the lock was also released after COPY FROM, but thecommit failed to notice the irregularity in COPY TO.This is old behavior but doesn't seem important enough to backpatch.Author: Laurenz Albe, based on suggestion by Robert Haas and Tom LaneReviewed-by: Amit KapilaDiscussion:https://postgr.es/m/7bcfc39d4176faf85ab317d0c26786953646a411.camel@cybertec.at
1 parent39e7bcb commita9cf48a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

‎src/backend/commands/copy.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,13 +1081,8 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
10811081
EndCopyTo(cstate);
10821082
}
10831083

1084-
/*
1085-
* Close the relation. If reading, we can release the AccessShareLock we
1086-
* got; if writing, we should hold the lock until end of transaction to
1087-
* ensure that updates will be committed before lock is released.
1088-
*/
10891084
if (rel!=NULL)
1090-
table_close(rel,(is_from ?NoLock :AccessShareLock));
1085+
table_close(rel,NoLock);
10911086
}
10921087

10931088
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp