Re: Rethinking pg_dump's function sorting code

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Rethinking pg_dump's function sorting code
Дата
Msg-id 20150306083328.GA121893@tornado.leadboat.com
обсуждение исходный текст
Ответ на Rethinking pg_dump's function sorting code  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Rethinking pg_dump's function sorting code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, Mar 05, 2015 at 07:28:33PM -0500, Tom Lane wrote:
> In bug #12832 Marko Tiikkaja points out that commit
> 7b583b20b1c95acb621c71251150beef958bb603 created a rather unnecessary
> dump failure hazard, since it applies pg_get_function_identity_arguments()
> to every function in the database, even those that won't get dumped.
> I think we should fix this by getting rid of pg_dump's use of that
> function altogether.  A low-tech way to sort functions of identical names
> would be to compare argument type OIDs, as in the attached simple patch.
> If people feel it's important to avoid depending on numerical OID order,
> we could instead look up type names locally and compare them as in the
> attached less-simple patch.

Comparing argument type names sounds fine.  Comparing argument type OID does
not offer enough to justify the loss of cross-cluster sort equivalence.

> Neither patch will exactly preserve the sort behavior of the current
> code, but I don't think that's important.

Agreed.

> --- 291,313 ----
>       {
>           FuncInfo   *fobj1 = *(FuncInfo *const *) p1;
>           FuncInfo   *fobj2 = *(FuncInfo *const *) p2;
> +         int            i;
>   
>           cmpval = fobj1->nargs - fobj2->nargs;
>           if (cmpval != 0)
>               return cmpval;
> !         for (i = 0; i < fobj1->nargs; i++)
> !         {
> !             TypeInfo   *argtype1 = findTypeByOid(fobj1->argtypes[i]);
> !             TypeInfo   *argtype2 = findTypeByOid(fobj2->argtypes[i]);
> ! 
> !             if (argtype1 && argtype2)
> !             {
> !                 cmpval = strcmp(argtype1->dobj.name, argtype2->dobj.name);
> !                 if (cmpval != 0)
> !                     return cmpval;
> !             }
> !         }

So as to stably compare f(nsp0.t) to f(nsp1.t), this should also compare the
dobj.namespace name.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: Rethinking pg_dump's function sorting code
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Clamping reulst row number of joins.