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

Commit350e6b8

Browse files
committed
pg_dump: provide a stable sort order for rules.
Previously, we sorted rules by schema name and then rule name;if that wasn't unique, we sorted by rule OID. This can beproblematic for comparing dumps from databases with differenthistories, especially since certain rule names like "_RETURN"are very common. Let's make the sort key schema name, rule name,table name, which should be unique. (This is the same behaviorwe've long used for triggers and RLS policies.)Andreas KarlssonDiscussion:https://postgr.es/m/b4e468d8-0cd6-42e6-ac8a-1d6afa6e0cf1@proxel.se
1 parent215f7af commit350e6b8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎src/bin/pg_dump/pg_dump_sort.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,17 @@ DOTypeNameCompare(const void *p1, const void *p2)
294294
if (cmpval!=0)
295295
returncmpval;
296296
}
297+
elseif (obj1->objType==DO_RULE)
298+
{
299+
RuleInfo*robj1=*(RuleInfo*const*)p1;
300+
RuleInfo*robj2=*(RuleInfo*const*)p2;
301+
302+
/* Sort by table name (table namespace was considered already) */
303+
cmpval=strcmp(robj1->ruletable->dobj.name,
304+
robj2->ruletable->dobj.name);
305+
if (cmpval!=0)
306+
returncmpval;
307+
}
297308
elseif (obj1->objType==DO_TRIGGER)
298309
{
299310
TriggerInfo*tobj1=*(TriggerInfo*const*)p1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp