mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
Here is a patch.
I have changed to call pg_exec_query_dest() instead of pg_exec_query(). Thanks. Hiroshi Inoue
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.31 1999/03/15 14:07:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.32 1999/03/16 03:24:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,13 +24,13 @@
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/pg_database.h"
|
||||
#include "catalog/pg_shadow.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "fmgr.h"
|
||||
#include "miscadmin.h" /* for DataDir */
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/fd.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
@@ -42,7 +42,7 @@ static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
|
||||
static void stop_vacuum(char *dbpath, char *dbname);
|
||||
|
||||
void
|
||||
createdb(char *dbname, char *dbpath, int encoding)
|
||||
createdb(char *dbname, char *dbpath, int encoding, CommandDest dest)
|
||||
{
|
||||
Oid db_id;
|
||||
int4 user_id;
|
||||
@@ -87,11 +87,11 @@ createdb(char *dbname, char *dbpath, int encoding)
|
||||
"insert into pg_database (datname, datdba, encoding, datpath)"
|
||||
" values ('%s', '%d', '%d', '%s');", dbname, user_id, encoding, loc);
|
||||
|
||||
pg_exec_query(buf);
|
||||
pg_exec_query_dest(buf, dest, false);
|
||||
}
|
||||
|
||||
void
|
||||
destroydb(char *dbname)
|
||||
destroydb(char *dbname, CommandDest dest)
|
||||
{
|
||||
int4 user_id;
|
||||
Oid db_id;
|
||||
@@ -123,7 +123,7 @@ destroydb(char *dbname)
|
||||
*/
|
||||
snprintf(buf, 512,
|
||||
"delete from pg_database where pg_database.oid = \'%d\'::oid", db_id);
|
||||
pg_exec_query(buf);
|
||||
pg_exec_query_dest(buf ,dest, false);
|
||||
|
||||
/* drop pages for this database that are in the shared buffer cache */
|
||||
DropBuffers(db_id);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: user.c,v 1.24 1999/02/13 23:15:11 momjian Exp $
|
||||
* $Id: user.c,v 1.25 1999/03/16 03:24:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ static void CheckPgUserAclNotNull(void);
|
||||
*/
|
||||
static
|
||||
void
|
||||
UpdatePgPwdFile(char *sql)
|
||||
UpdatePgPwdFile(char *sql, CommandDest dest)
|
||||
{
|
||||
|
||||
char *filename,
|
||||
@@ -71,7 +71,7 @@ UpdatePgPwdFile(char *sql)
|
||||
snprintf(sql, SQL_LENGTH,
|
||||
"copy %s to '%s' using delimiters %s",
|
||||
ShadowRelationName, tempname, CRYPT_PWD_FILE_SEPCHAR);
|
||||
pg_exec_query(sql);
|
||||
pg_exec_query_dest(sql, dest, false);
|
||||
rename(tempname, filename);
|
||||
pfree((void *) tempname);
|
||||
|
||||
@@ -92,7 +92,7 @@ UpdatePgPwdFile(char *sql)
|
||||
*---------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
DefineUser(CreateUserStmt *stmt)
|
||||
DefineUser(CreateUserStmt *stmt, CommandDest dest)
|
||||
{
|
||||
|
||||
char *pg_shadow,
|
||||
@@ -175,13 +175,13 @@ DefineUser(CreateUserStmt *stmt)
|
||||
stmt->password ? stmt->password : "''",
|
||||
stmt->validUntil ? stmt->validUntil : "");
|
||||
|
||||
pg_exec_query(sql);
|
||||
pg_exec_query_dest(sql, dest, false);
|
||||
|
||||
/*
|
||||
* Add the stuff here for groups.
|
||||
*/
|
||||
|
||||
UpdatePgPwdFile(sql);
|
||||
UpdatePgPwdFile(sql, dest);
|
||||
|
||||
/*
|
||||
* This goes after the UpdatePgPwdFile to be certain that two backends
|
||||
@@ -196,7 +196,7 @@ DefineUser(CreateUserStmt *stmt)
|
||||
|
||||
|
||||
extern void
|
||||
AlterUser(AlterUserStmt *stmt)
|
||||
AlterUser(AlterUserStmt *stmt, CommandDest dest)
|
||||
{
|
||||
|
||||
char *pg_shadow,
|
||||
@@ -282,11 +282,11 @@ AlterUser(AlterUserStmt *stmt)
|
||||
|
||||
snprintf(sql, SQL_LENGTH, "%s where usename = '%s'", sql, stmt->user);
|
||||
|
||||
pg_exec_query(sql);
|
||||
pg_exec_query_dest(sql, dest, false);
|
||||
|
||||
/* do the pg_group stuff here */
|
||||
|
||||
UpdatePgPwdFile(sql);
|
||||
UpdatePgPwdFile(sql, dest);
|
||||
|
||||
UnlockRelation(pg_shadow_rel, AccessExclusiveLock);
|
||||
heap_close(pg_shadow_rel);
|
||||
@@ -297,7 +297,7 @@ AlterUser(AlterUserStmt *stmt)
|
||||
|
||||
|
||||
extern void
|
||||
RemoveUser(char *user)
|
||||
RemoveUser(char *user, CommandDest dest)
|
||||
{
|
||||
|
||||
char *pg_shadow;
|
||||
@@ -390,7 +390,7 @@ RemoveUser(char *user)
|
||||
elog(NOTICE, "Dropping database %s", dbase[ndbase]);
|
||||
snprintf(sql, SQL_LENGTH, "drop database %s", dbase[ndbase]);
|
||||
pfree((void *) dbase[ndbase]);
|
||||
pg_exec_query(sql);
|
||||
pg_exec_query_dest(sql, dest, false);
|
||||
}
|
||||
if (dbase)
|
||||
pfree((void *) dbase);
|
||||
@@ -418,9 +418,9 @@ RemoveUser(char *user)
|
||||
*/
|
||||
snprintf(sql, SQL_LENGTH,
|
||||
"delete from %s where usename = '%s'", ShadowRelationName, user);
|
||||
pg_exec_query(sql);
|
||||
pg_exec_query_dest(sql, dest, false);
|
||||
|
||||
UpdatePgPwdFile(sql);
|
||||
UpdatePgPwdFile(sql, dest);
|
||||
|
||||
UnlockRelation(pg_shadow_rel, AccessExclusiveLock);
|
||||
heap_close(pg_shadow_rel);
|
||||
|
Reference in New Issue
Block a user