summaryrefslogtreecommitdiff
path: root/src/backend/catalog/pg_constraint.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-08-05 15:25:36 +0000
committerRobert Haas <rhaas@postgresql.org>2010-08-05 15:25:36 +0000
commitfd1843ff8979c0461fb3f1a9eab61140c977e32d (patch)
tree9a4201b5ddc009b89ce7385470b7b7fa9eacf87d /src/backend/catalog/pg_constraint.c
parent2a6ef3445c73473edb222abf108b323fb7f002dc (diff)
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.
Diffstat (limited to 'src/backend/catalog/pg_constraint.c')
-rw-r--r--src/backend/catalog/pg_constraint.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 84dab8eb218..4fb96d21002 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.53 2010/02/26 02:00:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.54 2010/08/05 15:25:35 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -727,12 +727,12 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
}
/*
- * GetConstraintByName
+ * get_constraint_oid
* Find a constraint on the specified relation with the specified name.
* Returns constraint's OID.
*/
Oid
-GetConstraintByName(Oid relid, const char *conname)
+get_constraint_oid(Oid relid, const char *conname, bool missing_ok)
{
Relation pg_constraint;
HeapTuple tuple;
@@ -773,7 +773,7 @@ GetConstraintByName(Oid relid, const char *conname)
systable_endscan(scan);
/* If no such constraint exists, complain */
- if (!OidIsValid(conOid))
+ if (!OidIsValid(conOid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("constraint \"%s\" for table \"%s\" does not exist",