diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 14 | ||||
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 26 |
2 files changed, 30 insertions, 10 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 458ab68749d..c7da14ad7ea 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -3,7 +3,7 @@ * back to source text * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.119 2002/08/29 01:19:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.120 2002/08/31 22:10:46 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -2187,6 +2187,18 @@ get_rule_expr(Node *node, deparse_context *context) } break; + case T_ConstraintTest: + { + ConstraintTest *ctest = (ConstraintTest *) node; + + /* + * We assume that the operations of the constraint node + * need not be explicitly represented in the output. + */ + get_rule_expr(ctest->arg, context); + } + break; + case T_SubLink: get_sublink_expr(node, context); break; diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 66dc58d6c4b..4054b2920e6 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.81 2002/08/29 00:17:05 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.82 2002/08/31 22:10:47 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -1074,12 +1074,12 @@ getBaseType(Oid typid) } /* - * getBaseTypeTypeMod - * If the given type is a domain, return its base type; - * otherwise return the type's own OID. Also return base typmod. + * getBaseTypeMod + * If the given type is a domain, return the typmod it applies to + * its base type; otherwise return the specified original typmod. */ -Oid -getBaseTypeTypeMod(Oid typid, int32 *typmod) +int32 +getBaseTypeMod(Oid typid, int32 typmod) { /* * We loop to find the bottom base type in a stack of domains. @@ -1093,7 +1093,7 @@ getBaseTypeTypeMod(Oid typid, int32 *typmod) ObjectIdGetDatum(typid), 0, 0, 0); if (!HeapTupleIsValid(tup)) - elog(ERROR, "getBaseTypeTypeMod: failed to lookup type %u", typid); + elog(ERROR, "getBaseTypeMod: failed to lookup type %u", typid); typTup = (Form_pg_type) GETSTRUCT(tup); if (typTup->typtype != 'd') { @@ -1102,12 +1102,20 @@ getBaseTypeTypeMod(Oid typid, int32 *typmod) break; } + /* + * The typmod applied to a domain should always be -1. + * + * We substitute the domain's typmod as we switch attention to + * the base type. + */ + Assert(typmod < 0); + typid = typTup->typbasetype; - *typmod = typTup->typtypmod; + typmod = typTup->typtypmod; ReleaseSysCache(tup); } - return typid; + return typmod; } /* |