Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb56b83a

Browse files
committed
Simplify some code in getObjectTypeDescription()
This routine is designed to never return an empty description or NULL,providing description fallbacks even if missing objects are accepted,but it included a code path where this was considered possible. All thecallers of this routine already consider NULL as not possible, sochange a bit the code to map with the assumptions of the callers, andadd more comments close to the callers of this routine to outline thebehavior expected.This code is new as of2a10fdc, so no backpatch is needed.Discussion:https://postgr.es/m/YMNY6RGPBRCeLmFb@paquier.xyz
1 parentbfd96b7 commitb56b83a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/backend/catalog/objectaddress.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,7 +4278,7 @@ pg_identify_object_as_address(PG_FUNCTION_ARGS)
42784278

42794279
tupdesc=BlessTupleDesc(tupdesc);
42804280

4281-
/* object type */
4281+
/* object type, which can never be NULL */
42824282
values[0]=CStringGetTextDatum(getObjectTypeDescription(&address, true));
42834283
nulls[0]= false;
42844284

@@ -4490,9 +4490,8 @@ getObjectTypeDescription(const ObjectAddress *object, bool missing_ok)
44904490
*/
44914491
}
44924492

4493-
/* an empty string is equivalent to no object found */
4494-
if (buffer.len==0)
4495-
returnNULL;
4493+
/* the result can never be empty */
4494+
Assert(buffer.len>0);
44964495

44974496
returnbuffer.data;
44984497
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp