Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5881~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5881
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Aug 2, 2025

  1. array_random

    we can not use function signature as array_random(anyelement, anyelement, int[]
    [, int[]]) because currently, we cannot resolve the conflict for array_random(1,
    2::bigint). In this case, the first argument should be promoted to bigint.
    
    For example:
    create or replace function polyf(x anyelement, y anyelement) returns anyelement as $$
    select x + 1
    $$ language sql;
    
    select polyf(1, 2::bigint);
    ERROR:  function polyf(integer, bigint) does not exist
    
    select polyf(1::bigint, 2);
    ERROR:  function polyf(bigint, integer) does not exist
    
    So, we define three separate functions for array_random, similar to the approach
    used for the random() function.
    now it looks like:
    \df array_random
                                                                 List of functions
       Schema   |     Name     | Result data type |                                 Argument data types                                 | Type
    ------------+--------------+------------------+-------------------------------------------------------------------------------------+------
     pg_catalog | array_random | bigint[]         | min bigint, max bigint, dims integer[], lbounds integer[] DEFAULT NULL::integer[]   | func
     pg_catalog | array_random | integer[]        | min integer, max integer, dims integer[], lbounds integer[] DEFAULT NULL::integer[] | func
     pg_catalog | array_random | numeric[]        | min numeric, max numeric, dims integer[], lbounds integer[] DEFAULT NULL::integer[] | func
    (3 rows)
    
    original discussion: https://postgr.es/m/87plssezpc.fsf@163.com
    discussion: https://postgr.es/m/CACJufxF8_VzCFRHRt4OHHF74QtB8tj5Z=djsy7Y31OHKG5s1-w@mail.gmail.com
    jianhe-fun authored and Commitfest Bot committed Aug 2, 2025
    Configuration menu
    Copy the full SHA
    cb20f36 View commit details
    Browse the repository at this point in the history
  2. [CF 5881] v2 - array_random

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5881
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CACJufxH89EiwapAfOQOqMMQWw11RYb=N68N=BF17KJ7x=O9dFQ@mail.gmail.com
    Author(s): Jian He
    Commitfest Bot committed Aug 2, 2025
    Configuration menu
    Copy the full SHA
    6116a4f View commit details
    Browse the repository at this point in the history
Loading