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
9f442cbf
Commit
9f442cbf
authored
Jul 06, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct unsafe use of strcmp(). See rant of same date posted to pghackers.
parent
f0b4ae69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/ruleutils.c
+16
-16
No files found.
src/backend/utils/adt/ruleutils.c
View file @
9f442cbf
...
...
@@ -3,7 +3,7 @@
* out of its tuple
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.5
6 2000/07/06 05:48:11
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.5
7 2000/07/06 23:03:37
tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
...
...
@@ -818,7 +818,8 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc)
query
=
(
Query
*
)
lfirst
(
actions
);
if
(
ev_type
!=
'1'
||
ev_attr
>=
0
||
!
is_instead
||
strcmp
(
ev_qual
,
"<>"
))
if
(
ev_type
!=
'1'
||
ev_attr
>=
0
||
!
is_instead
||
strcmp
(
ev_qual
,
"<>"
)
!=
0
)
{
appendStringInfo
(
buf
,
"Not a view"
);
return
;
...
...
@@ -929,9 +930,9 @@ get_select_query_def(Query *query, deparse_context *context)
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
if
(
rte
->
ref
==
NULL
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
==
0
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
==
0
)
continue
;
rt_constonly
=
FALSE
;
...
...
@@ -948,7 +949,7 @@ get_select_query_def(Query *query, deparse_context *context)
sep
=
" "
;
foreach
(
l
,
query
->
targetList
)
{
bool
tell_as
=
FALSE
;
bool
tell_as
=
false
;
tle
=
(
TargetEntry
*
)
lfirst
(
l
);
appendStringInfo
(
buf
,
sep
);
...
...
@@ -959,7 +960,7 @@ get_select_query_def(Query *query, deparse_context *context)
/* Check if we must say AS ... */
if
(
!
IsA
(
tle
->
expr
,
Var
))
tell_as
=
strcmp
(
tle
->
resdom
->
resname
,
"?column?"
);
tell_as
=
(
strcmp
(
tle
->
resdom
->
resname
,
"?column?"
)
!=
0
);
else
{
Var
*
var
=
(
Var
*
)
(
tle
->
expr
);
...
...
@@ -967,8 +968,7 @@ get_select_query_def(Query *query, deparse_context *context)
rte
=
get_rte_for_var
(
var
,
context
);
attname
=
get_attribute_name
(
rte
->
relid
,
var
->
varattno
);
if
(
strcmp
(
attname
,
tle
->
resdom
->
resname
))
tell_as
=
TRUE
;
tell_as
=
(
strcmp
(
attname
,
tle
->
resdom
->
resname
)
!=
0
);
}
/* and do if so */
...
...
@@ -990,9 +990,9 @@ get_select_query_def(Query *query, deparse_context *context)
if
(
rte
->
ref
==
NULL
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
==
0
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
==
0
)
continue
;
appendStringInfo
(
buf
,
sep
);
...
...
@@ -1107,9 +1107,9 @@ get_insert_query_def(Query *query, deparse_context *context)
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
if
(
rte
->
ref
==
NULL
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
==
0
)
continue
;
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
)
if
(
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
==
0
)
continue
;
rt_constonly
=
FALSE
;
...
...
@@ -1280,9 +1280,9 @@ get_rule_expr(Node *node, deparse_context *context)
if
(
rte
->
ref
==
NULL
)
appendStringInfo
(
buf
,
"%s."
,
quote_identifier
(
rte
->
relname
));
else
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
)
else
if
(
strcmp
(
rte
->
ref
->
relname
,
"*NEW*"
)
==
0
)
appendStringInfo
(
buf
,
"new."
);
else
if
(
!
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
)
else
if
(
strcmp
(
rte
->
ref
->
relname
,
"*OLD*"
)
==
0
)
appendStringInfo
(
buf
,
"old."
);
else
appendStringInfo
(
buf
,
"%s."
,
...
...
@@ -1520,14 +1520,14 @@ get_func_expr(Expr *expr, deparse_context *context)
*/
if
(
procStruct
->
pronargs
==
1
&&
procStruct
->
proargtypes
[
0
]
==
InvalidOid
)
{
if
(
!
strcmp
(
proname
,
"nullvalue"
)
)
if
(
strcmp
(
proname
,
"nullvalue"
)
==
0
)
{
appendStringInfoChar
(
buf
,
'('
);
get_rule_expr
((
Node
*
)
lfirst
(
expr
->
args
),
context
);
appendStringInfo
(
buf
,
" ISNULL)"
);
return
;
}
if
(
!
strcmp
(
proname
,
"nonnullvalue"
)
)
if
(
strcmp
(
proname
,
"nonnullvalue"
)
==
0
)
{
appendStringInfoChar
(
buf
,
'('
);
get_rule_expr
((
Node
*
)
lfirst
(
expr
->
args
),
context
);
...
...
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