summaryrefslogtreecommitdiff
path: root/src/backend/commands/comment.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-04-11 20:00:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-04-11 20:00:18 +0000
commit902a6a0a4bc62d619a5ccd1ef0ff7fb3a5d897f1 (patch)
treec5cc85818d8a3ffae03a23bacd3e679945a41dbd /src/backend/commands/comment.c
parent3f6299df6c7d905bdef44eb3a4b19f248ebc14dc (diff)
downloadpostgresql-902a6a0a4bc62d619a5ccd1ef0ff7fb3a5d897f1.tar.gz
Restructure representation of aggregate functions so that they have pg_proc
entries, per pghackers discussion. This fixes aggregates to live in namespaces, and also simplifies/speeds up lookup in parse_func.c. Also, add a 'proimplicit' flag to pg_proc that controls whether a type coercion function may be invoked implicitly, or only explicitly. The current settings of these flags are more permissive than I would like, but we will need to debate and refine the behavior; for now, I avoided breaking regression tests as much as I could.
Diffstat (limited to 'src/backend/commands/comment.c')
-rw-r--r--src/backend/commands/comment.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index b7d57f6cce..b7de77067d 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999-2001, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.39 2002/04/09 20:35:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.40 2002/04/11 19:59:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,15 +25,11 @@
#include "catalog/pg_operator.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_trigger.h"
-#include "catalog/pg_type.h"
#include "commands/comment.h"
#include "miscadmin.h"
-#include "nodes/makefuncs.h"
-#include "parser/parse_agg.h"
#include "parser/parse_func.h"
#include "parser/parse_type.h"
#include "parser/parse.h"
-#include "rewrite/rewriteRemove.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
@@ -573,7 +569,6 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
TypeName *aggtype = (TypeName *) lfirst(arguments);
Oid baseoid,
oid;
- Oid classoid;
/* First, attempt to determine the base aggregate oid */
if (aggtype)
@@ -581,18 +576,13 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
else
baseoid = InvalidOid;
- /* Now, attempt to find the actual tuple in pg_aggregate */
+ /* Now, attempt to find the actual tuple in pg_proc */
- oid = GetSysCacheOid(AGGNAME,
- PointerGetDatum(strVal(lfirst(aggregate))), /* XXX */
- ObjectIdGetDatum(baseoid),
- 0, 0);
- if (!OidIsValid(oid))
- agg_error("CommentAggregate", aggregate, baseoid);
+ oid = find_aggregate_func("CommentAggregate", aggregate, baseoid);
/* Next, validate the user's attempt to comment */
- if (!pg_aggr_ownercheck(oid, GetUserId()))
+ if (!pg_proc_ownercheck(oid, GetUserId()))
{
if (baseoid == InvalidOid)
elog(ERROR, "you are not permitted to comment on aggregate %s for all types",
@@ -602,14 +592,9 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
NameListToString(aggregate), format_type_be(baseoid));
}
- /* pg_aggregate doesn't have a hard-coded OID, so must look it up */
-
- classoid = get_relname_relid(AggregateRelationName, PG_CATALOG_NAMESPACE);
- Assert(OidIsValid(classoid));
-
/* Call CreateComments() to create/drop the comments */
- CreateComments(oid, classoid, 0, comment);
+ CreateComments(oid, RelOid_pg_proc, 0, comment);
}
/*