Skip to content

Commit

Permalink
Set current db_id along with db_name for parallel workers
Browse files Browse the repository at this point in the history
Signed-off-by: Sumit Jaiswal <[email protected]>
  • Loading branch information
Sumit Jaiswal committed Dec 27, 2024
1 parent 5d23254 commit 623304e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/babelfishpg_tsql/src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void
set_cur_db_name_for_parallel_worker(const char* logical_db_name)
{
int len;
int16 db_id;

if (logical_db_name == NULL)
ereport(ERROR,
Expand All @@ -80,13 +81,15 @@ set_cur_db_name_for_parallel_worker(const char* logical_db_name)

Assert(len <= MAX_BBF_NAMEDATALEND);

if(!DbidIsValid(get_db_id(logical_db_name)))
db_id = get_db_id(logical_db_name);
if(!DbidIsValid(db_id))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", logical_db_name)));

strncpy(current_db_name, logical_db_name, MAX_BBF_NAMEDATALEND);
current_db_name[len] = '\0';
current_db_id = db_id;
}


Expand Down

0 comments on commit 623304e

Please sign in to comment.