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

Commit0fd8cfb

Browse files
committed
GetPublicationByName: Don't repeat ourselves
Use get_publication_oid() instead of reimplementing it.Discussion:https://postgr.es/m/20191220201017.GA17292@alvherre.pgsql
1 parent696cc3a commit0fd8cfb

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

‎src/backend/catalog/pg_publication.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ GetPublication(Oid pubid)
374374
Form_pg_publicationpubform;
375375

376376
tup=SearchSysCache1(PUBLICATIONOID,ObjectIdGetDatum(pubid));
377-
378377
if (!HeapTupleIsValid(tup))
379378
elog(ERROR,"cache lookup failed for publication %u",pubid);
380379

@@ -403,19 +402,9 @@ GetPublicationByName(const char *pubname, bool missing_ok)
403402
{
404403
Oidoid;
405404

406-
oid=GetSysCacheOid1(PUBLICATIONNAME,Anum_pg_publication_oid,
407-
CStringGetDatum(pubname));
408-
if (!OidIsValid(oid))
409-
{
410-
if (missing_ok)
411-
returnNULL;
412-
413-
ereport(ERROR,
414-
(errcode(ERRCODE_UNDEFINED_OBJECT),
415-
errmsg("publication \"%s\" does not exist",pubname)));
416-
}
405+
oid=get_publication_oid(pubname,missing_ok);
417406

418-
returnGetPublication(oid);
407+
returnOidIsValid(oid) ?GetPublication(oid) :NULL;
419408
}
420409

421410
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp