Skip to content

Commit 3f701d1

Browse files
author
Rahul Parande
committed
Removed unused variable relname.
Changed some logic in objectproperty for IsSchemaBound Signed-off-by: Rahul Parande <rparande@amazon.com>
1 parent df7d4dd commit 3f701d1

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

contrib/babelfishpg_tsql/runtime/functions.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4482,12 +4482,13 @@ objectproperty_internal(PG_FUNCTION_ARGS)
44824482
if (pg_strcasecmp(property, "isschemabound") == 0)
44834483
{
44844484
bool is_weak_view = false;
4485+
bool is_view = (type == OBJECT_TYPE_VIEW);
44854486

4486-
if (type == OBJECT_TYPE_VIEW)
4487+
if (is_view)
44874488
check_is_tsql_view(object_id, &is_weak_view);
44884489

44894490
pfree(property);
4490-
PG_RETURN_INT32(((int) !is_weak_view));
4491+
PG_RETURN_INT32(is_view ? ((int) !is_weak_view) : 0);
44914492
}
44924493
/*
44934494
* For ExecIsQuotedIdentOn and ExecIsAnsiNullsOn, we hardcoded it to 1

contrib/babelfishpg_tsql/src/hooks.c

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6764,17 +6764,10 @@ update_bbf_view_flags(Oid viewOid, uint64 flags_to_set, uint64 flags_to_clear, b
67646764
flag_validity;
67656765
bool isnull;
67666766
bool updated = false;
6767-
char *relname = NULL;
67686767

67696768
Datum values[BBF_VIEW_DEF_NUM_COLS];
67706769
bool nulls[BBF_VIEW_DEF_NUM_COLS];
67716770
bool replaces[BBF_VIEW_DEF_NUM_COLS];
6772-
6773-
relname = get_rel_name(viewOid);
6774-
if (!relname)
6775-
ereport(ERROR,
6776-
(errcode(ERRCODE_UNDEFINED_TABLE),
6777-
errmsg("view with OID %u does not exist", viewOid)));
67786771

67796772
brel = table_open(get_bbf_view_def_oid(), RowExclusiveLock);
67806773
tuple = search_bbf_view_def(brel, viewOid);
@@ -7383,23 +7376,21 @@ handle_bbf_view_binding_on_object_drop(const ObjectAddress *droppedObject, Relat
73837376
if (OidIsValid(viewOid) && !list_member_oid(processed_views, viewOid))
73847377
{
73857378
processed_views = lappend_oid(processed_views, viewOid);
7386-
if (!is_alter_view)
7379+
7380+
/* DROP operation: if dependent is weak view, mark broken */
7381+
is_weak_view = false;
7382+
if (check_is_tsql_view(viewOid, &is_weak_view) && is_weak_view)
73877383
{
7388-
/* DROP operation: if dependent is weak view, mark broken */
7389-
is_weak_view = false;
7390-
if (check_is_tsql_view(viewOid, &is_weak_view) && is_weak_view)
7384+
/* Mark view as broken */
7385+
updated = bbf_view_set_broken(viewOid, true);
7386+
7387+
/* If the view was successfully marked as broken, create a dummy query */
7388+
if (updated)
73917389
{
7392-
/* Mark view as broken */
7393-
updated = bbf_view_set_broken(viewOid, true);
7394-
7395-
/* If the view was successfully marked as broken, create a dummy query */
7396-
if (updated)
7397-
{
7398-
Query *dummyQuery = create_dummy_view_query_for_broken_view(viewOid);
7399-
StoreViewQuery(viewOid, dummyQuery, true);
7400-
}
7401-
CommandCounterIncrement();
7390+
Query *dummyQuery = create_dummy_view_query_for_broken_view(viewOid);
7391+
StoreViewQuery(viewOid, dummyQuery, true);
74027392
}
7393+
CommandCounterIncrement();
74037394
}
74047395
else if (is_alter_view && pltsql_weak_view_binding)
74057396
{

0 commit comments

Comments
 (0)