Skip to content

Commit 582e22a

Browse files
author
Michael Meskes
committed
Simplified sortby rule
1 parent d3e131e commit 582e22a

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/backend/parser/gram.y

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.581 2007/03/13 00:33:41 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.582 2007/03/17 19:27:12 meskes Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -3869,8 +3869,8 @@ opt_class: any_name { $$ = $1; }
38693869
;
38703870

38713871
opt_asc_desc: ASC { $$ = SORTBY_ASC; }
3872-
| DESC { $$ = SORTBY_DESC; }
3873-
| /*EMPTY*/ { $$ = SORTBY_DEFAULT; }
3872+
| DESC { $$ = SORTBY_DESC; }
3873+
| /*EMPTY*/ { $$ = SORTBY_DEFAULT; }
38743874
;
38753875

38763876
opt_nulls_order: NULLS_FIRST { $$ = SORTBY_NULLS_FIRST; }
@@ -5982,30 +5982,14 @@ sortby: a_expr USING qual_all_Op opt_nulls_order
59825982
$$->sortby_nulls = $4;
59835983
$$->useOp = $3;
59845984
}
5985-
| a_expr ASC opt_nulls_order
5985+
| a_expr opt_asc_desc opt_nulls_order
59865986
{
59875987
$$ = makeNode(SortBy);
59885988
$$->node = $1;
5989-
$$->sortby_dir = SORTBY_ASC;
5989+
$$->sortby_dir = $2;
59905990
$$->sortby_nulls = $3;
59915991
$$->useOp = NIL;
59925992
}
5993-
| a_expr DESC opt_nulls_order
5994-
{
5995-
$$ = makeNode(SortBy);
5996-
$$->node = $1;
5997-
$$->sortby_dir = SORTBY_DESC;
5998-
$$->sortby_nulls = $3;
5999-
$$->useOp = NIL;
6000-
}
6001-
| a_expr opt_nulls_order
6002-
{
6003-
$$ = makeNode(SortBy);
6004-
$$->node = $1;
6005-
$$->sortby_dir = SORTBY_DEFAULT;
6006-
$$->sortby_nulls = $2;
6007-
$$->useOp = NIL;
6008-
}
60095993
;
60105994

60115995

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy