|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.59 2003/01/15 19:35:39 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.60 2003/01/22 19:26:35 tgl Exp $ |
12 | 12 | * |
13 | 13 | * HISTORY |
14 | 14 | * AUTHORDATEMAJOR EVENT |
@@ -362,24 +362,43 @@ print_expr(Node *expr, List *rtable) |
362 | 362 | printf("%s",outputstr); |
363 | 363 | pfree(outputstr); |
364 | 364 | } |
365 | | -elseif (IsA(expr,Expr)) |
| 365 | +elseif (IsA(expr,OpExpr)) |
366 | 366 | { |
367 | | -Expr*e= (Expr*)expr; |
| 367 | +OpExpr*e= (OpExpr*)expr; |
| 368 | +char*opname; |
368 | 369 |
|
369 | | -if (is_opclause(expr)) |
| 370 | +opname=get_opname(e->opno); |
| 371 | +if (length(e->args)>1) |
370 | 372 | { |
371 | | -char*opname; |
372 | | - |
373 | | -print_expr(get_leftop(e),rtable); |
374 | | -opname=get_opname(((OpExpr*)e)->opno); |
| 373 | +print_expr(get_leftop((Expr*)e),rtable); |
375 | 374 | printf(" %s ", ((opname!=NULL) ?opname :"(invalid operator)")); |
376 | | -print_expr(get_rightop(e),rtable); |
| 375 | +print_expr(get_rightop((Expr*)e),rtable); |
377 | 376 | } |
378 | 377 | else |
379 | | -printf("an expr"); |
| 378 | +{ |
| 379 | +/* we print prefix and postfix ops the same... */ |
| 380 | +printf("%s ", ((opname!=NULL) ?opname :"(invalid operator)")); |
| 381 | +print_expr(get_leftop((Expr*)e),rtable); |
| 382 | +} |
| 383 | +} |
| 384 | +elseif (IsA(expr,FuncExpr)) |
| 385 | +{ |
| 386 | +FuncExpr*e= (FuncExpr*)expr; |
| 387 | +char*funcname; |
| 388 | +List*l; |
| 389 | + |
| 390 | +funcname=get_func_name(e->funcid); |
| 391 | +printf("%s(", ((funcname!=NULL) ?funcname :"(invalid function)")); |
| 392 | +foreach(l,e->args) |
| 393 | +{ |
| 394 | +print_expr(lfirst(l),rtable); |
| 395 | +if (lnext(l)) |
| 396 | +printf(","); |
| 397 | +} |
| 398 | +printf(")"); |
380 | 399 | } |
381 | 400 | else |
382 | | -printf("not an expr"); |
| 401 | +printf("unknown expr"); |
383 | 402 | } |
384 | 403 |
|
385 | 404 | /* |
|