Skip to content

Commit 4a0c3a6

Browse files
committed
Department of second thoughts: suppressing implicit casts everywhere in
ruleutils display is not such a great idea. For arguments of functions and operators I think we'd better keep the historical behavior of showing such casts explicitly, to ensure that the function/operator is reparsed the same way when the rule is reloaded. This also makes the output of EXPLAIN less obscurantist about exactly what's happening.
1 parent b26dfb9 commit 4a0c3a6

File tree

6 files changed

+93
-71
lines changed

6 files changed

+93
-71
lines changed

src/backend/catalog/heap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.227 2002/09/18 21:35:20 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.228 2002/09/19 22:48:33 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1179,7 +1179,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin)
11791179
adsrc = deparse_expression(expr,
11801180
deparse_context_for(RelationGetRelationName(rel),
11811181
RelationGetRelid(rel)),
1182-
false);
1182+
false, false);
11831183

11841184
/*
11851185
* Make the pg_attrdef entry.
@@ -1277,7 +1277,7 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
12771277
ccsrc = deparse_expression(expr,
12781278
deparse_context_for(RelationGetRelationName(rel),
12791279
RelationGetRelid(rel)),
1280-
false);
1280+
false, false);
12811281

12821282
/*
12831283
* Find columns of rel that are used in ccbin

src/backend/commands/explain.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994-5, Regents of the University of California
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.87 2002/09/04 20:31:15 momjian Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.88 2002/09/19 22:48:33 tgl Exp $
99
*
1010
*/
1111

@@ -682,7 +682,7 @@ show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
682682
NIL);
683683

684684
/* Deparse the expression */
685-
exprstr = deparse_expression(node, context, (outercontext != NULL));
685+
exprstr = deparse_expression(node, context, (outercontext != NULL), false);
686686

687687
/* And add to str */
688688
for (i = 0; i < indent; i++)
@@ -729,7 +729,7 @@ show_upper_qual(List *qual, const char *qlabel,
729729

730730
/* Deparse the expression */
731731
node = (Node *) make_ands_explicit(qual);
732-
exprstr = deparse_expression(node, context, (inner_plan != NULL));
732+
exprstr = deparse_expression(node, context, (inner_plan != NULL), false);
733733

734734
/* And add to str */
735735
for (i = 0; i < indent; i++)
@@ -795,8 +795,9 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
795795

796796
if (target->resdom->reskey == keyno)
797797
{
798-
/* Deparse the expression */
799-
exprstr = deparse_expression(target->expr, context, useprefix);
798+
/* Deparse the expression, showing any top-level cast */
799+
exprstr = deparse_expression(target->expr, context,
800+
useprefix, true);
800801
/* And add to str */
801802
if (keyno > 1)
802803
appendStringInfo(str, ", ");

src/backend/commands/typecmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.13 2002/09/04 20:31:16 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.14 2002/09/19 22:48:33 tgl Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -514,7 +514,7 @@ DefineDomain(CreateDomainStmt *stmt)
514514
defaultValue = deparse_expression(defaultExpr,
515515
deparse_context_for(domainName,
516516
InvalidOid),
517-
false);
517+
false, false);
518518
defaultValueBin = nodeToString(defaultExpr);
519519
break;
520520

0 commit comments

Comments
 (0)