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
681c587d
Commit
681c587d
authored
Feb 23, 1999
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do a better job of selecting candidates among functions
when no exact match. Clean up elog error messages.
parent
b4def324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
47 deletions
+48
-47
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+48
-47
No files found.
src/backend/parser/parse_func.c
View file @
681c587d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.3
8 1999/02/13 23:17:08 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.3
9 1999/02/23 07:51:53 thomas
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -828,66 +828,67 @@ func_select_candidate(int nargs,
...
@@ -828,66 +828,67 @@ func_select_candidate(int nargs,
}
}
}
}
if
(
ncandidates
==
1
)
return
candidates
->
args
;
/*
/*
* Still too many candidates?
* Still too many candidates?
* Try assigning types for the unknown columns.
* Try assigning types for the unknown columns.
*/
*/
if
(
ncandidates
>
1
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
{
{
for
(
i
=
0
;
i
<
nargs
;
i
++
)
if
(
input_typeids
[
i
]
==
UNKNOWNOID
)
{
{
if
(
input_typeids
[
i
]
==
UNKNOWNOID
)
slot_category
=
INVALID_TYPE
;
slot_type
=
InvalidOid
;
for
(
current_candidate
=
candidates
;
current_candidate
!=
NULL
;
current_candidate
=
current_candidate
->
next
)
{
{
slot_category
=
INVALID_TYPE
;
current_typeids
=
current_candidate
->
args
;
slot_type
=
InvalidOid
;
current_type
=
current_typeids
[
i
];
for
(
current_candidate
=
candidates
;
current_category
=
TypeCategory
(
current_typeids
[
i
]);
current_candidate
!=
NULL
;
current_candidate
=
current_candidate
->
next
)
{
current_typeids
=
current_candidate
->
args
;
current_type
=
current_typeids
[
i
];
current_category
=
TypeCategory
(
current_typeids
[
i
]);
if
(
slot_category
==
InvalidOid
)
if
(
slot_category
==
InvalidOid
)
{
slot_category
=
current_category
;
slot_type
=
current_type
;
}
else
if
((
current_category
!=
slot_category
)
&&
IS_BUILTIN_TYPE
(
current_type
))
{
return
NULL
;
}
else
if
(
current_type
!=
slot_type
)
{
if
(
IsPreferredType
(
slot_category
,
current_type
))
{
{
slot_category
=
current_category
;
slot_type
=
current_type
;
slot_type
=
current_type
;
candidates
=
current_candidate
;
}
}
else
if
((
current_category
!=
slot_category
)
else
if
(
IsPreferredType
(
slot_category
,
slot_type
))
&&
IS_BUILTIN_TYPE
(
current_type
))
{
{
return
NULL
;
candidates
->
next
=
current_candidate
->
next
;
}
}
else
if
(
current_type
!=
slot_type
)
{
if
(
IsPreferredType
(
slot_category
,
current_type
))
{
slot_type
=
current_type
;
candidates
=
current_candidate
;
}
else
{
}
}
}
if
(
slot_type
!=
InvalidOid
)
{
input_typeids
[
i
]
=
slot_type
;
}
}
}
}
else
if
(
slot_type
!=
InvalidOid
)
{
{
input_typeids
[
i
]
=
slot_type
;
}
}
}
}
else
ncandidates
=
0
;
{
for
(
current_candidate
=
candidates
;
}
current_candidate
!=
NULL
;
current_candidate
=
current_candidate
->
next
)
ncandidates
++
;
}
}
ncandidates
=
0
;
for
(
current_candidate
=
candidates
;
current_candidate
!=
NULL
;
current_candidate
=
current_candidate
->
next
)
ncandidates
++
;
if
(
ncandidates
==
1
)
if
(
ncandidates
==
1
)
return
candidates
->
args
;
return
candidates
->
args
;
...
@@ -964,7 +965,7 @@ func_get_detail(char *funcname,
...
@@ -964,7 +965,7 @@ func_get_detail(char *funcname,
ftup
=
SearchSysCacheTuple
(
PRONAME
,
ftup
=
SearchSysCacheTuple
(
PRONAME
,
PointerGetDatum
(
funcname
),
PointerGetDatum
(
funcname
),
Int32GetDatum
(
nargs
),
Int32GetDatum
(
nargs
),
PointerGetDatum
(
*
true_typeids
),
PointerGetDatum
(
*
true_typeids
),
0
);
0
);
Assert
(
HeapTupleIsValid
(
ftup
));
Assert
(
HeapTupleIsValid
(
ftup
));
}
}
...
@@ -976,8 +977,8 @@ func_get_detail(char *funcname,
...
@@ -976,8 +977,8 @@ func_get_detail(char *funcname,
else
if
(
ncandidates
>
1
)
else
if
(
ncandidates
>
1
)
{
{
*
true_typeids
=
func_select_candidate
(
nargs
,
*
true_typeids
=
func_select_candidate
(
nargs
,
current_input_typeids
,
current_input_typeids
,
current_function_typeids
);
current_function_typeids
);
/* couldn't decide, so quit */
/* couldn't decide, so quit */
if
(
*
true_typeids
==
NULL
)
if
(
*
true_typeids
==
NULL
)
...
@@ -991,9 +992,9 @@ func_get_detail(char *funcname,
...
@@ -991,9 +992,9 @@ func_get_detail(char *funcname,
else
else
{
{
ftup
=
SearchSysCacheTuple
(
PRONAME
,
ftup
=
SearchSysCacheTuple
(
PRONAME
,
PointerGetDatum
(
funcname
),
PointerGetDatum
(
funcname
),
Int32GetDatum
(
nargs
),
Int32GetDatum
(
nargs
),
PointerGetDatum
(
*
true_typeids
),
PointerGetDatum
(
*
true_typeids
),
0
);
0
);
Assert
(
HeapTupleIsValid
(
ftup
));
Assert
(
HeapTupleIsValid
(
ftup
));
}
}
...
@@ -1012,7 +1013,7 @@ func_get_detail(char *funcname,
...
@@ -1012,7 +1013,7 @@ func_get_detail(char *funcname,
{
{
tp
=
typeidType
(
oid_array
[
0
]);
tp
=
typeidType
(
oid_array
[
0
]);
if
(
typeTypeFlag
(
tp
)
==
'c'
)
if
(
typeTypeFlag
(
tp
)
==
'c'
)
elog
(
ERROR
,
"
func_get_detail:
No such attribute or function '%s'"
,
funcname
);
elog
(
ERROR
,
"No such attribute or function '%s'"
,
funcname
);
}
}
}
}
else
else
...
...
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