Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
916d8164
Commit
916d8164
authored
Oct 04, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict CREATE OPERATOR CLASS to superusers, per discussion some weeks
ago.
parent
d2db166c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
doc/src/sgml/ref/create_opclass.sgml
doc/src/sgml/ref/create_opclass.sgml
+5
-4
src/backend/commands/opclasscmds.c
src/backend/commands/opclasscmds.c
+14
-1
No files found.
doc/src/sgml/ref/create_opclass.sgml
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
-->
...
...
@@ -209,9 +209,10 @@ CREATE OPERATOR CLASS
are for different index access methods.
</para>
<para>
The user who defines an operator class becomes its owner. The user
must own the data type for which the operator class is being defined,
and must have execute permission for all referenced operators and functions.
The user who defines an operator class becomes its owner. Presently,
the creating user must be a superuser. (This restriction is made because
an erroneous operator class definition could confuse or even crash the
server.)
</para>
<para>
...
...
src/backend/commands/opclasscmds.c
View file @
916d8164
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
5 2002/09/04 20:31:15 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
6 2002/10/04 22:19:29 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -96,12 +96,25 @@ DefineOpClass(CreateOpClassStmt *stmt)
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 */
typeoid
=
typenameTypeId
(
stmt
->
datatype
);
#ifdef NOT_USED
/* XXX this is unnecessary given the superuser check above */
/* Check we have ownership of the datatype */
if
(
!
pg_type_ownercheck
(
typeoid
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
format_type_be
(
typeoid
));
#endif
/* Storage datatype is optional */
storageoid
=
InvalidOid
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment