Fix bug in checking permissions on table being COPY'd.
This commit is contained in:
parent
d27c28fdc0
commit
fa608ad2a6
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.3 1996/10/31 09:08:10 bryanh Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.4 1996/11/02 02:03:13 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -196,47 +196,23 @@ ProcessUtility(Node *parsetree,
|
||||||
case T_CopyStmt:
|
case T_CopyStmt:
|
||||||
{
|
{
|
||||||
CopyStmt *stmt = (CopyStmt *)parsetree;
|
CopyStmt *stmt = (CopyStmt *)parsetree;
|
||||||
char *filename;
|
|
||||||
char *delim;
|
|
||||||
bool isBinary;
|
|
||||||
bool isOids;
|
|
||||||
bool isFrom;
|
|
||||||
bool pipe = false;
|
|
||||||
|
|
||||||
commandTag = "COPY";
|
commandTag = "COPY";
|
||||||
CHECK_IF_ABORTED();
|
CHECK_IF_ABORTED();
|
||||||
|
|
||||||
relname = stmt->relname;
|
|
||||||
isBinary = stmt->binary;
|
|
||||||
isOids = stmt->oids;
|
|
||||||
|
|
||||||
isFrom = (bool)(stmt->direction == FROM);
|
|
||||||
filename = stmt->filename;
|
|
||||||
delim = stmt->delimiter;
|
|
||||||
|
|
||||||
#ifndef NO_SECURITY
|
|
||||||
if (isFrom) {
|
|
||||||
if (!pg_aclcheck(relname, userName, ACL_RD))
|
|
||||||
elog(WARN, "%s %s", relname, ACL_NO_PRIV_WARNING);
|
|
||||||
} else {
|
|
||||||
if (!pg_aclcheck(relname, userName, ACL_WR))
|
|
||||||
elog(WARN, "%s %s", relname, ACL_NO_PRIV_WARNING);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Free up file descriptors - going to do a read... */
|
/* Free up file descriptors - going to do a read... */
|
||||||
|
|
||||||
closeOneVfd();
|
closeOneVfd();
|
||||||
|
|
||||||
/*
|
DoCopy(stmt->relname,
|
||||||
* use stdin/stdout if filename is null.
|
stmt->binary,
|
||||||
|
stmt->oids,
|
||||||
|
(bool)(stmt->direction == FROM),
|
||||||
|
(bool)(stmt->filename == NULL),
|
||||||
|
/* null filename means copy to/from stdout/stdin,
|
||||||
|
rather than to/from a file.
|
||||||
*/
|
*/
|
||||||
if (filename == NULL)
|
stmt->filename,
|
||||||
pipe = true;
|
stmt->delimiter);
|
||||||
|
|
||||||
if (pipe && IsUnderPostmaster) dest = CopyEnd;
|
|
||||||
|
|
||||||
DoCopy(relname, isBinary, isOids, isFrom, pipe, filename, delim);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue