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
f11d253e
Commit
f11d253e
authored
Mar 19, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In can_coerce_type, verify that a possible type-coercion function
actually returns the type it is named for.
parent
7d392f25
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+13
-5
No files found.
src/backend/parser/parse_coerce.c
View file @
f11d253e
...
@@ -8,13 +8,13 @@
...
@@ -8,13 +8,13 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.3
6 2000/03/16 06:35:07
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.3
7 2000/03/19 00:15:39
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
#include "postgres.h"
#include "postgres.h"
#include "catalog/pg_proc.h"
#include "optimizer/clauses.h"
#include "optimizer/clauses.h"
#include "parser/parse_coerce.h"
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
...
@@ -126,6 +126,12 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
...
@@ -126,6 +126,12 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
result
=
transformExpr
(
pstate
,
(
Node
*
)
n
,
EXPR_COLUMN_FIRST
);
result
=
transformExpr
(
pstate
,
(
Node
*
)
n
,
EXPR_COLUMN_FIRST
);
/* safety check that we got the right thing */
if
(
exprType
(
result
)
!=
targetTypeId
)
elog
(
ERROR
,
"coerce_type: conversion function %s produced %s"
,
typeTypeName
(
targetType
),
typeidTypeName
(
exprType
(
result
)));
/*
/*
* If the input is a constant, apply the type conversion function
* If the input is a constant, apply the type conversion function
* now instead of delaying to runtime. (We could, of course,
* now instead of delaying to runtime. (We could, of course,
...
@@ -163,6 +169,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
...
@@ -163,6 +169,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
{
{
int
i
;
int
i
;
HeapTuple
ftup
;
HeapTuple
ftup
;
Form_pg_proc
pform
;
Oid
oid_array
[
FUNC_MAX_ARGS
];
Oid
oid_array
[
FUNC_MAX_ARGS
];
/* run through argument list... */
/* run through argument list... */
...
@@ -221,9 +228,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
...
@@ -221,9 +228,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
0
);
0
);
if
(
!
HeapTupleIsValid
(
ftup
))
if
(
!
HeapTupleIsValid
(
ftup
))
return
false
;
return
false
;
/*
/* Make sure the function's result type is as expected, too */
* should also check the function return type just to be safe...
pform
=
(
Form_pg_proc
)
GETSTRUCT
(
ftup
);
*/
if
(
pform
->
prorettype
!=
targetTypeId
)
return
false
;
}
}
return
true
;
return
true
;
...
...
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