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

Commite41acf4

Browse files
committed
Tweak prettyprinting rules for saner indenting of UNION, INTERSECT,
EXCEPT constructs.
1 parent453c670 commite41acf4

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

‎src/backend/utils/adt/ruleutils.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*back to source text
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.179 2004/08/29 05:06:49 momjian Exp $
6+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.180 2004/09/01 23:58:38 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -2202,15 +2202,15 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
22022202
{
22032203
caseSETOP_UNION:
22042204
appendContextKeyword(context,"UNION ",
2205-
-PRETTYINDENT_STD,0,0);
2205+
-PRETTYINDENT_STD,PRETTYINDENT_STD,0);
22062206
break;
22072207
caseSETOP_INTERSECT:
22082208
appendContextKeyword(context,"INTERSECT ",
2209-
-PRETTYINDENT_STD,0,0);
2209+
-PRETTYINDENT_STD,PRETTYINDENT_STD,0);
22102210
break;
22112211
caseSETOP_EXCEPT:
22122212
appendContextKeyword(context,"EXCEPT ",
2213-
-PRETTYINDENT_STD,0,0);
2213+
-PRETTYINDENT_STD,PRETTYINDENT_STD,0);
22142214
break;
22152215
default:
22162216
elog(ERROR,"unrecognized set op: %d",
@@ -2220,7 +2220,7 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
22202220
appendStringInfo(buf,"ALL ");
22212221

22222222
if (PRETTY_INDENT(context))
2223-
appendStringInfoChar(buf,'\n');
2223+
appendContextKeyword(context,"",0,0,0);
22242224

22252225
need_paren= !IsA(op->rarg,RangeTblRef);
22262226

@@ -2869,22 +2869,18 @@ appendContextKeyword(deparse_context *context, const char *str,
28692869
if (PRETTY_INDENT(context))
28702870
{
28712871
context->indentLevel+=indentBefore;
2872-
if (context->indentLevel<0)
2873-
context->indentLevel=0;
28742872

28752873
appendStringInfoChar(context->buf,'\n');
28762874
appendStringInfoSpaces(context->buf,
2877-
context->indentLevel+indentPlus);
2878-
}
2879-
2880-
appendStringInfoString(context->buf,str);
2875+
Max(context->indentLevel,0)+indentPlus);
2876+
appendStringInfoString(context->buf,str);
28812877

2882-
if (PRETTY_INDENT(context))
2883-
{
28842878
context->indentLevel+=indentAfter;
28852879
if (context->indentLevel<0)
28862880
context->indentLevel=0;
28872881
}
2882+
else
2883+
appendStringInfoString(context->buf,str);
28882884
}
28892885

28902886
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp