From a39a828a26d75491c79b1d25ee1606f6bd013f42 Mon Sep 17 00:00:00 2001 From: Sharu Goel Date: Wed, 29 Jan 2025 10:40:10 +0000 Subject: [PATCH] Address comments Signed-off-by: Sharu Goel --- contrib/babelfishpg_tsql/src/pl_exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/babelfishpg_tsql/src/pl_exec.c b/contrib/babelfishpg_tsql/src/pl_exec.c index d5ebb32f9c..2f9cb67bb6 100644 --- a/contrib/babelfishpg_tsql/src/pl_exec.c +++ b/contrib/babelfishpg_tsql/src/pl_exec.c @@ -5500,7 +5500,12 @@ pltsql_update_identity_insert_sequence(PLtsql_expr *expr) datum = SysCacheGetAttr(SYSNAMESPACENAME, schema_tuple, Anum_namespace_ext_dbid, &isnull); db_id = DatumGetInt16(datum); - if (!DbidIsValid(db_id) || db_id != get_cur_db_id()) + if(!DbidIsValid(db_id)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("dbid in babelfish_namespace_ext catalog doesn't exists in babelfish_sysdatabases catalog"))); + + if (db_id != get_cur_db_id()) { char *db_name = get_db_name(db_id); char *user = get_user_for_database(db_name); @@ -5509,6 +5514,7 @@ pltsql_update_identity_insert_sequence(PLtsql_expr *expr) { is_cross_db = true; pfree(db_name); + pfree(user); } else {