Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
4dded12f
Commit
4dded12f
authored
Nov 27, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
COPY to a relation should keep write lock till transaction commit.
Thanks to Hiroshi for spotting the problem.
parent
37432f5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
src/backend/commands/copy.c
src/backend/commands/copy.c
+15
-8
No files found.
src/backend/commands/copy.c
View file @
4dded12f
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.9
1 1999/11/22 17:56:00 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.9
2 1999/11/27 21:52:53 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -257,14 +257,16 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
Relation
rel
;
extern
char
*
UserName
;
/* defined in global.c */
const
AclMode
required_access
=
from
?
ACL_WR
:
ACL_RD
;
LOCKMODE
required_lock
=
from
?
AccessExclusiveLock
:
AccessShareLock
;
/* Note: AccessExclusive is probably overkill for copying to a relation,
* but that's what the existing code grabs on the rel's indices. If
* this is relaxed then I think the index locks need relaxed also.
*/
int
result
;
rel
=
heap_openr
(
relname
,
required_lock
);
/*
* Open and lock the relation, using the appropriate lock type.
*
* Note: AccessExclusive is probably overkill for copying to a relation,
* but that's what the code grabs on the rel's indices. If this lock is
* relaxed then I think the index locks need relaxed also.
*/
rel
=
heap_openr
(
relname
,
(
from
?
AccessExclusiveLock
:
AccessShareLock
));
result
=
pg_aclcheck
(
relname
,
UserName
,
required_access
);
if
(
result
!=
ACLCHECK_OK
)
...
...
@@ -349,7 +351,12 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
}
}
heap_close
(
rel
,
required_lock
);
/*
* Close the relation. If reading, we can release the AccessShareLock
* we got; if writing, we should hold the lock until end of transaction
* to ensure that updates will be committed before lock is released.
*/
heap_close
(
rel
,
(
from
?
NoLock
:
AccessShareLock
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment