diff --git a/contrib/babelfishpg_tsql/runtime/functions.c b/contrib/babelfishpg_tsql/runtime/functions.c index 05849839ff..640ffb2438 100644 --- a/contrib/babelfishpg_tsql/runtime/functions.c +++ b/contrib/babelfishpg_tsql/runtime/functions.c @@ -2893,9 +2893,7 @@ has_dbaccess(PG_FUNCTION_ARGS) } if (!user) - { PG_RETURN_INT32(0); - } else { pfree(user); diff --git a/contrib/babelfishpg_tsql/src/catalog.c b/contrib/babelfishpg_tsql/src/catalog.c index 9bd6885127..d1187ffda1 100644 --- a/contrib/babelfishpg_tsql/src/catalog.c +++ b/contrib/babelfishpg_tsql/src/catalog.c @@ -5017,7 +5017,7 @@ user_exists_for_db(const char *db_name, const char *user_name) Relation bbf_authid_user_ext_rel; HeapTuple tuple_user_ext; ScanKeyData key[2]; - TableScanDesc scan; + TableScanDesc scan; NameData *rolname; bool user_exists = false; diff --git a/contrib/babelfishpg_tsql/src/dbcmds.c b/contrib/babelfishpg_tsql/src/dbcmds.c index e13148e971..fadf774279 100644 --- a/contrib/babelfishpg_tsql/src/dbcmds.c +++ b/contrib/babelfishpg_tsql/src/dbcmds.c @@ -413,14 +413,14 @@ static void create_bbf_db_internal(ParseState *pstate, const char *dbname, List *options, const char *owner, int16 dbid) { int16 old_dbid; - char *old_dbname; + char *old_dbname; Oid datdba; - Datum *new_record; - bool *new_record_nulls; + Datum *new_record; + bool *new_record_nulls; Relation sysdatabase_rel; HeapTuple tuple; - List *parsetree_list; - ListCell *parsetree_item; + List *parsetree_list; + ListCell *parsetree_item; char *dbo_scm = NULL; char *dbo_role = NULL; char *db_owner_role = NULL; @@ -428,13 +428,13 @@ create_bbf_db_internal(ParseState *pstate, const char *dbname, List *options, co NameData default_collation; NameData owner_namedata; char *guest = NULL; - int stmt_number = 0; - int save_sec_context; - bool is_set_userid = false; - Oid save_userid; + int stmt_number = 0; + int save_sec_context; + bool is_set_userid = false; + Oid save_userid; const char *old_createrole_self_grant; ListCell *option; - const char *database_collation_name = NULL; + const char *database_collation_name = NULL; /* Check options */ foreach(option, options) @@ -658,21 +658,21 @@ create_bbf_db_internal(ParseState *pstate, const char *dbname, List *options, co void drop_bbf_db(const char *dbname, bool missing_ok, bool force_drop) { - volatile Relation sysdatabase_rel; - HeapTuple tuple; - Form_sysdatabases bbf_db; - int16 dbid; - char *schema_name = NULL; - char *db_owner_role = NULL; - char *dbo_role = NULL; - char *guest_schema_name = NULL; - List *db_users_list; - List *parsetree_list; - ListCell *parsetree_item; - const char *prev_current_user; - int save_sec_context; - bool is_set_userid = false; - Oid save_userid; + volatile Relation sysdatabase_rel; + HeapTuple tuple; + Form_sysdatabase bbf_db; + int16 dbid; + char *schema_name = NULL; + char *db_owner_role = NULL; + char *dbo_role = NULL; + char *guest_schema_name = NULL; + List *db_users_list; + List *parsetree_list; + ListCell *parsetree_item; + const char *prev_current_user; + int save_sec_context; + bool is_set_userid = false; + Oid save_userid; if ((strlen(dbname) == 6 && (strncmp(dbname, "master", 6) == 0)) || ((strlen(dbname) == 6 && strncmp(dbname, "tempdb", 6) == 0)) || diff --git a/contrib/babelfishpg_tsql/src/pl_exec-2.c b/contrib/babelfishpg_tsql/src/pl_exec-2.c index 37530d000a..0f9b80d21e 100644 --- a/contrib/babelfishpg_tsql/src/pl_exec-2.c +++ b/contrib/babelfishpg_tsql/src/pl_exec-2.c @@ -3228,31 +3228,31 @@ void exec_stmt_dbcc_checkident(PLtsql_stmt_dbcc *stmt) struct dbcc_checkident dbcc_stmt = stmt->dbcc_stmt_data.dbcc_checkident; Relation rel; TupleDesc tupdesc; - char *db_name = NULL; - char *max_identity_value_str = NULL; - char *query = NULL; - char *attname; - char *token; + char *db_name = NULL; + char *max_identity_value_str = NULL; + char *query = NULL; + char *attname; + char *token; const char *schema_name; char *nsp_name = NULL; const char *user; char *guest_role_name = NULL; char *dbo_role_name = NULL; const char *login; - int64 max_identity_value = 0; - int64 cur_identity_value = 0; - int attnum; - int rc = 0; - int64 reseed_value = 0; - Oid nsp_oid; - Oid table_oid; - Oid seqid = InvalidOid; - Oid current_user_id = GetUserId(); - volatile bool cur_value_is_null = true; - bool login_is_db_owner; + int64 max_identity_value = 0; + int64 cur_identity_value = 0; + int attnum; + int rc = 0; + int64 reseed_value = 0; + Oid nsp_oid; + Oid table_oid; + Oid seqid = InvalidOid; + Oid current_user_id = GetUserId(); + volatile bool cur_value_is_null = true; + bool login_is_db_owner; StringInfoData msg; - bool is_float_value; - bool is_cross_db = false; + bool is_float_value; + bool is_cross_db = false; if(dbcc_stmt.new_reseed_value) diff --git a/contrib/babelfishpg_tsql/src/pl_handler.c b/contrib/babelfishpg_tsql/src/pl_handler.c index cb901878d0..9012df0a01 100644 --- a/contrib/babelfishpg_tsql/src/pl_handler.c +++ b/contrib/babelfishpg_tsql/src/pl_handler.c @@ -3337,11 +3337,11 @@ bbf_ProcessUtility(PlannedStmt *pstmt, char *user_name; const char *db_principal_type = drop_user ? "user" : "role"; char *db_owner_name; - int role_oid; - int rolename_len; + int role_oid; + int rolename_len; bool is_tsql_db_principal = false; bool is_psql_db_principal = false; - Oid dbowner; + Oid dbowner; user_name = get_physical_user_name(db_name, rolspec->rolename, false, true); db_owner_name = get_db_owner_name(db_name);