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

Commitba26aee

Browse files
committed
Reduce COPY IN lock from AccessExclusive to a more reasonable
RowExclusive (my fault). Also, install a check to prevent peoplefrom trying COPY BINARY to stdout/from stdin. No way that willwork unless we redesign the frontend COPY protocol ... which isnot worth the trouble in the near future ...
1 parent52d95db commitba26aee

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎src/backend/commands/copy.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.105 2000/04/16 04:27:52 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.106 2000/05/18 01:52:45 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -281,12 +281,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
281281

282282
/*
283283
* Open and lock the relation, using the appropriate lock type.
284-
*
285-
* Note: AccessExclusive is probably overkill for copying to a relation,
286-
* but that's what the code grabs on the rel's indices. If this lock
287-
* is relaxed then I think the index locks need relaxed also.
288284
*/
289-
rel=heap_openr(relname, (from ?AccessExclusiveLock :AccessShareLock));
285+
rel=heap_openr(relname, (from ?RowExclusiveLock :AccessShareLock));
290286

291287
result=pg_aclcheck(relname,UserName,required_access);
292288
if (result!=ACLCHECK_OK)
@@ -295,6 +291,12 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
295291
elog(ERROR,"You must have Postgres superuser privilege to do a COPY "
296292
"directly to or from a file. Anyone can COPY to stdout or "
297293
"from stdin. Psql's \\copy command also works for anyone.");
294+
/*
295+
* This restriction is unfortunate, but necessary until the frontend
296+
* COPY protocol is redesigned to be binary-safe...
297+
*/
298+
if (pipe&&binary)
299+
elog(ERROR,"COPY BINARY is not supported to stdout or from stdin");
298300

299301
/*
300302
* Set up variables to avoid per-attribute overhead.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp