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
8acc568a
Commit
8acc568a
authored
Jan 12, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CommentProc was careless about too many arguments.
parent
421d4f9b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
51 deletions
+50
-51
src/backend/commands/comment.c
src/backend/commands/comment.c
+50
-51
No files found.
src/backend/commands/comment.c
View file @
8acc568a
...
...
@@ -101,10 +101,11 @@ void CommentObject(int objtype, char *objname, char *objproperty,
CommentTrigger
(
objname
,
objproperty
,
comment
);
break
;
default:
elog
(
ERROR
,
"An attempt was made to comment on a unkown type: %i"
,
elog
(
ERROR
,
"An attempt was made to comment on a unk
n
own type: %i"
,
objtype
);
}
}
/*------------------------------------------------------------------
...
...
@@ -586,8 +587,8 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
*------------------------------------------------------------------
*/
void
CommentProc
(
char
*
function
,
List
*
arguments
,
char
*
comment
)
{
void
CommentProc
(
char
*
function
,
List
*
arguments
,
char
*
comment
)
{
HeapTuple
argtuple
,
functuple
;
Oid
oid
,
argoids
[
FUNC_MAX_ARGS
];
char
*
user
,
*
argument
;
...
...
@@ -595,35 +596,38 @@ void CommentProc(char *function, List *arguments, char *comment) {
/*** First, initialize function's argument list with their type oids ***/
argcount
=
length
(
arguments
);
if
(
argcount
>
0
)
{
MemSet
(
argoids
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
argcount
=
length
(
arguments
);
if
(
argcount
>
FUNC_MAX_ARGS
)
elog
(
ERROR
,
"functions cannot have more than %d arguments"
,
FUNC_MAX_ARGS
);
for
(
i
=
0
;
i
<
argcount
;
i
++
)
{
argument
=
strVal
(
lfirst
(
arguments
));
arguments
=
lnext
(
arguments
);
if
(
strcmp
(
argument
,
"opaque"
)
==
0
)
{
if
(
strcmp
(
argument
,
"opaque"
)
==
0
)
{
argoids
[
i
]
=
0
;
}
else
{
argtuple
=
SearchSysCacheTuple
(
TYPENAME
,
PointerGetDatum
(
argument
),
}
else
{
argtuple
=
SearchSysCacheTuple
(
TYPENAME
,
PointerGetDatum
(
argument
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
argtuple
))
{
if
(
!
HeapTupleIsValid
(
argtuple
))
elog
(
ERROR
,
"function argument type '%s' does not exist"
,
argument
);
}
argoids
[
i
]
=
argtuple
->
t_data
->
t_oid
;
}
}
}
/*** Now, validate the user's ability to comment on this function ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
user
=
GetPgUserName
();
if
(
!
pg_func_ownercheck
(
user
,
function
,
argcount
,
argoids
))
{
if
(
!
pg_func_ownercheck
(
user
,
function
,
argcount
,
argoids
))
elog
(
ERROR
,
"you are not permitted to comment on function '%s'"
,
function
);
}
#endif
#endif
/*** Now, find the corresponding oid for this procedure ***/
...
...
@@ -631,19 +635,14 @@ void CommentProc(char *function, List *arguments, char *comment) {
Int32GetDatum
(
argcount
),
PointerGetDatum
(
argoids
),
0
);
/*** Deallocate our argument oids and check the function tuple ***/
if
(
!
HeapTupleIsValid
(
functuple
))
{
if
(
!
HeapTupleIsValid
(
functuple
))
elog
(
ERROR
,
"function '%s' with the supplied %s does not exist"
,
function
,
"argument list"
);
}
oid
=
functuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
}
/*------------------------------------------------------------------
...
...
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