Re: general purpose array_sort
От | jian he |
---|---|
Тема | Re: general purpose array_sort |
Дата | |
Msg-id | CACJufxHM7LeLJfjb8LitLRjYp_mY9iVPQEZ58sPFXeWxM-FjCQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: general purpose array_sort (Aleksander Alekseev <aleksander@timescale.com>) |
Ответы |
Re: general purpose array_sort
|
Список | pgsql-hackers |
On Tue, Oct 29, 2024 at 12:48 AM Aleksander Alekseev <aleksander@timescale.com> wrote:. > > 0001: > > > +{ oid => '8810', descr => 'sort array', > > + proname => 'array_sort', provolatile => 'v', prorettype => 'anyarray', > > + proargtypes => 'anyarray', prosrc => 'array_sort'}, > > I would expect that array_sort() should be IMMUTABLE. Is there a > reason for it to be VOLATILE? > https://www.postgresql.org/docs/current/sql-createfunction.html says: IMMUTABLE indicates that the function cannot modify the database and always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not directly present in its argument list. If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value. + { + typentry = lookup_type_cache(elmtyp, TYPECACHE_LT_OPR); + if (!OidIsValid(typentry->lt_opr)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("could not identify ordering operator for type %s", + format_type_be(elmtyp)))); This error can happen. I think this conflicts with the doc IMMUTABLE description.
В списке pgsql-hackers по дате отправления: