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

Commit1acc06a

Browse files
committed
When sorting functions in pg_dump, break ties (same name) by number of arguments
1 parentec86ef7 commit1acc06a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

‎src/bin/pg_dump/pg_dump_sort.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.27 2010/01/02 16:57:59 momjian Exp $
12+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.28 2010/02/15 19:59:47 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -163,7 +163,18 @@ DOTypeNameCompare(const void *p1, const void *p2)
163163
if (cmpval!=0)
164164
returncmpval;
165165

166-
/* Probably shouldn't get here, but if we do, sort by OID */
166+
/* To have a stable sort order, break ties for some object types */
167+
if (obj1->objType==DO_FUNC||obj1->objType==DO_AGG)
168+
{
169+
FuncInfo*fobj1=*(FuncInfo**)p1;
170+
FuncInfo*fobj2=*(FuncInfo**)p2;
171+
172+
cmpval=fobj1->nargs-fobj2->nargs;
173+
if (cmpval!=0)
174+
returncmpval;
175+
}
176+
177+
/* Usually shouldn't get here, but if we do, sort by OID */
167178
returnoidcmp(obj1->catId.oid,obj2->catId.oid);
168179
}
169180

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp