Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb05ff39

Browse files
committed
Fix binary_oper_exact() so that the heuristic 'an unknown literal on
one side of a binary operator is probably supposed to be the same typeas the other operand' will be applied for domain types. This workedin 7.3 but was broken in 7.4 due to code rearrangements. Mea culpa.
1 parentf98cbb7 commitb05ff39

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

‎src/backend/parser/parse_oper.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.75 2003/09/25 06:58:01 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.76 2003/10/06 20:09:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -386,24 +386,48 @@ oprfuncid(Operator op)
386386
* Check for an "exact" match to the specified operand types.
387387
*
388388
* If one operand is an unknown literal, assume it should be taken to be
389-
* the same type as the other operand for this purpose.
389+
* the same type as the other operand for this purpose. Also, consider
390+
* the possibility that the other operand is a domain type that needs to
391+
* be reduced to its base type to find an "exact" match.
390392
*/
391393
staticOid
392394
binary_oper_exact(Oidarg1,Oidarg2,
393395
FuncCandidateListcandidates)
394396
{
397+
FuncCandidateListcand;
398+
boolwas_unknown= false;
399+
395400
/* Unspecified type for one of the arguments? then use the other */
396401
if ((arg1==UNKNOWNOID)&& (arg2!=InvalidOid))
402+
{
397403
arg1=arg2;
404+
was_unknown= true;
405+
}
398406
elseif ((arg2==UNKNOWNOID)&& (arg1!=InvalidOid))
407+
{
399408
arg2=arg1;
409+
was_unknown= true;
410+
}
400411

401-
while (candidates!=NULL)
412+
for (cand=candidates;cand!=NULL;cand=cand->next)
402413
{
403-
if (arg1==candidates->args[0]&&
404-
arg2==candidates->args[1])
405-
returncandidates->oid;
406-
candidates=candidates->next;
414+
if (arg1==cand->args[0]&&arg2==cand->args[1])
415+
returncand->oid;
416+
}
417+
418+
if (was_unknown)
419+
{
420+
/* arg1 and arg2 are the same here, need only look at arg1 */
421+
Oidbasetype=getBaseType(arg1);
422+
423+
if (basetype!=arg1)
424+
{
425+
for (cand=candidates;cand!=NULL;cand=cand->next)
426+
{
427+
if (basetype==cand->args[0]&&basetype==cand->args[1])
428+
returncand->oid;
429+
}
430+
}
407431
}
408432

409433
returnInvalidOid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp