1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Standardize get_whatever_oid functions for other object types.

- Rename TSParserGetPrsid to get_ts_parser_oid.
- Rename TSDictionaryGetDictid to get_ts_dict_oid.
- Rename TSTemplateGetTmplid to get_ts_template_oid.
- Rename TSConfigGetCfgid to get_ts_config_oid.
- Rename FindConversionByName to get_conversion_oid.
- Rename GetConstraintName to get_constraint_oid.
- Add new functions get_opclass_oid, get_opfamily_oid, get_rewrite_oid,
  get_rewrite_oid_without_relid, get_trigger_oid, and get_cast_oid.

The name of each function matches the corresponding catalog.

Thanks to KaiGai Kohei for the review.
This commit is contained in:
Robert Haas
2010-08-05 15:25:36 +00:00
parent 2a6ef3445c
commit fd1843ff89
22 changed files with 401 additions and 504 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.41 2010/02/14 18:42:14 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.42 2010/08/05 15:25:35 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@ -142,23 +142,13 @@ DropConversionsCommand(DropStmt *drop)
Form_pg_conversion con;
ObjectAddress object;
conversionOid = FindConversionByName(name);
conversionOid = get_conversion_oid(name, drop->missing_ok);
if (!OidIsValid(conversionOid))
{
if (!drop->missing_ok)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("conversion \"%s\" does not exist",
NameListToString(name))));
}
else
{
ereport(NOTICE,
(errmsg("conversion \"%s\" does not exist, skipping",
NameListToString(name))));
}
ereport(NOTICE,
(errmsg("conversion \"%s\" does not exist, skipping",
NameListToString(name))));
continue;
}
@ -202,12 +192,7 @@ RenameConversion(List *name, const char *newname)
rel = heap_open(ConversionRelationId, RowExclusiveLock);
conversionOid = FindConversionByName(name);
if (!OidIsValid(conversionOid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("conversion \"%s\" does not exist",
NameListToString(name))));
conversionOid = get_conversion_oid(name, false);
tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -255,12 +240,7 @@ AlterConversionOwner(List *name, Oid newOwnerId)
rel = heap_open(ConversionRelationId, RowExclusiveLock);
conversionOid = FindConversionByName(name);
if (!OidIsValid(conversionOid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("conversion \"%s\" does not exist",
NameListToString(name))));
conversionOid = get_conversion_oid(name, false);
AlterConversionOwner_internal(rel, conversionOid, newOwnerId);