Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
916d8164
Commit
916d8164
authored
22 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Restrict CREATE OPERATOR CLASS to superusers, per discussion some weeks
ago.
parent
d2db166c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/ref/create_opclass.sgml
+5
-4
5 additions, 4 deletions
doc/src/sgml/ref/create_opclass.sgml
src/backend/commands/opclasscmds.c
+14
-1
14 additions, 1 deletion
src/backend/commands/opclasscmds.c
with
19 additions
and
5 deletions
doc/src/sgml/ref/create_opclass.sgml
+
5
−
4
View file @
916d8164
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.
3
2002/
09/21 18:32:54 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.
4
2002/
10/04 22:19:29 tgl
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -209,9 +209,10 @@ CREATE OPERATOR CLASS
...
@@ -209,9 +209,10 @@ CREATE OPERATOR CLASS
are for different index access methods.
are for different index access methods.
</para>
</para>
<para>
<para>
The user who defines an operator class becomes its owner. The user
The user who defines an operator class becomes its owner. Presently,
must own the data type for which the operator class is being defined,
the creating user must be a superuser. (This restriction is made because
and must have execute permission for all referenced operators and functions.
an erroneous operator class definition could confuse or even crash the
server.)
</para>
</para>
<para>
<para>
...
...
This diff is collapsed.
Click to expand it.
src/backend/commands/opclasscmds.c
+
14
−
1
View file @
916d8164
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
5
2002/0
9
/04 2
0:31:15 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
6
2002/
1
0/04 2
2:19:29 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -96,12 +96,25 @@ DefineOpClass(CreateOpClassStmt *stmt)
...
@@ -96,12 +96,25 @@ DefineOpClass(CreateOpClassStmt *stmt)
ReleaseSysCache
(
tup
);
ReleaseSysCache
(
tup
);
/*
* Currently, we require superuser privileges to create an opclass.
* This seems necessary because we have no way to validate that the
* offered set of operators and functions are consistent with the AM's
* expectations. It would be nice to provide such a check someday,
* if it can be done without solving the halting problem :-(
*/
if
(
!
superuser
())
elog
(
ERROR
,
"Must be superuser to create an operator class"
);
/* Look up the datatype */
/* Look up the datatype */
typeoid
=
typenameTypeId
(
stmt
->
datatype
);
typeoid
=
typenameTypeId
(
stmt
->
datatype
);
#ifdef NOT_USED
/* XXX this is unnecessary given the superuser check above */
/* Check we have ownership of the datatype */
/* Check we have ownership of the datatype */
if
(
!
pg_type_ownercheck
(
typeoid
,
GetUserId
()))
if
(
!
pg_type_ownercheck
(
typeoid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
format_type_be
(
typeoid
));
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
format_type_be
(
typeoid
));
#endif
/* Storage datatype is optional */
/* Storage datatype is optional */
storageoid
=
InvalidOid
;
storageoid
=
InvalidOid
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment