Thread

Commits

  1. Fix typos in operatorcmds.c

  2. Multirange datatypes

  3. Add ALTER OPERATOR command, for changing selectivity estimator functions.

  1. Some doubious error messages and comments

    Kyotaro Horiguchi <horikyota.ntt@gmail.com> — 2021-04-28T08:36:33Z

    Hello.
    
    0001: I found some typos in a error message and a comment.
    
    multirangetypes.c: 1420
    > errmsg("range_intersect_agg must be called with a multirange")));
    
    This "range_intersect_agg" looks like a typo of "multirange_..".
    
    operatorcmds.c:303
    > * Look up a join estimator function ny name, and verify that it has the
    
    "ny" looks like a typo of "by".
    
    
    
    0002: The following messages are substantially same and are uselessly
    split into separate messages. I'm not sure any compiler complains
    about using %zu for int, explicit casting would work in that case.
    
    be-secure-gssapi.c:351
    >	(errmsg("oversize GSSAPI packet sent by the client (%zu > %zu)",
    >			(size_t) input.length,
    >			PQ_GSS_RECV_BUFFER_SIZE - sizeof(uint32))));
    be-secure-gssapi.c:570
    >	(errmsg("oversize GSSAPI packet sent by the client (%zu > %d)",
    >			(size_t) input.length,
    >			PQ_GSS_RECV_BUFFER_SIZE)));
    
    
    
    0003: The messages below seems to be a bit unclear.  I'm not sure they
    worth doing.
    
    conversioncmds.c: 130
     errmsg("encoding conversion function %s returned incorrect result for empty input",
    
    This is not wrong at all, but another message just above is saying
    that "encoding conversion function %s must return type %s".  Why
    aren't we explicit here, like this?
    
    "encoding conversion function %s must return zero for empty input"
    
    
    typecmds.c:4294
    >	if (requireSuper)
    >		if (!superuser())
    >			ereport(ERROR,
    >					 errmsg("must be superuser to alter a type")));
    
    Where, requireSuper varies depending on the set of operations but the
    description looks like describing general behavior. I'm not sure but
    something like the following might be better?
    
    +		 errmsg("must be superuser to perform all operations")));
    +		 errmsg("some of the operations require superuser privilege")));
    
    Any opinions or suggestions?
    
    regards.
    
    -- 
    Kyotaro Horiguchi
    NTT Open Source Software Center
    
  2. Re: Some doubious error messages and comments

    Justin Pryzby <pryzby@telsasoft.com> — 2021-04-28T13:11:47Z

    On Wed, Apr 28, 2021 at 05:36:33PM +0900, Kyotaro Horiguchi wrote:
    > 0001: I found some typos in a error message and a comment.
    > 
    > multirangetypes.c: 1420
    > > errmsg("range_intersect_agg must be called with a multirange")));
    > 
    > This "range_intersect_agg" looks like a typo of "multirange_..".
    > 
    > operatorcmds.c:303
    > > * Look up a join estimator function ny name, and verify that it has the
    > 
    > "ny" looks like a typo of "by".
    
    "ny name" shows up a 2nd time.
    
    I have another "comment typos" patch - maybe someone will want to push them
    together.
    
    commit 32e979c652c68ca5e3a7f308d677058e0c08547b
    Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
    Date:   Wed Apr 28 17:23:52 2021 +0900
    
        Fix typos
        
        ny name: 321eed5f0f7563a0cabb3d7a98132856287c1ad1
        multirange: 6df7a9698bb036610c1e8c6d375e1be38cb26d5f
    
    diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
    index 809043c5d1..fbd7d8d062 100644
    --- a/src/backend/commands/operatorcmds.c
    +++ b/src/backend/commands/operatorcmds.c
    @@ -265,7 +265,7 @@ DefineOperator(List *names, List *parameters)
     }
     
     /*
    - * Look up a restriction estimator function ny name, and verify that it has
    + * Look up a restriction estimator function by name, and verify that it has
      * the correct signature and we have the permissions to attach it to an
      * operator.
      */
    @@ -300,7 +300,7 @@ ValidateRestrictionEstimator(List *restrictionName)
     }
     
     /*
    - * Look up a join estimator function ny name, and verify that it has the
    + * Look up a join estimator function by name, and verify that it has the
      * correct signature and we have the permissions to attach it to an
      * operator.
      */
    diff --git a/src/backend/utils/adt/multirangetypes.c b/src/backend/utils/adt/multirangetypes.c
    index 0b81649779..2583ddeedf 100644
    --- a/src/backend/utils/adt/multirangetypes.c
    +++ b/src/backend/utils/adt/multirangetypes.c
    @@ -1417,7 +1417,7 @@ multirange_intersect_agg_transfn(PG_FUNCTION_ARGS)
     	if (!type_is_multirange(mltrngtypoid))
     		ereport(ERROR,
     				(errcode(ERRCODE_DATATYPE_MISMATCH),
    -				 errmsg("range_intersect_agg must be called with a multirange")));
    +				 errmsg("multirange_intersect_agg must be called with a multirange")));
     
     	typcache = multirange_get_typcache(fcinfo, mltrngtypoid);
     
    
    commit 8247b4034ed4c68241be9fbdec249bc967ceafd4
    Author: Justin Pryzby <pryzbyj@telsasoft.com>
    Date:   Tue Apr 27 07:57:50 2021 -0500
    
        Comment typos: extended stats a4d75c86b and 518442c7f
    
    diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
    index 9dd30370da..eb9e63f4a8 100644
    --- a/src/backend/parser/parse_utilcmd.c
    +++ b/src/backend/parser/parse_utilcmd.c
    @@ -1943,7 +1943,7 @@ generateClonedExtStatsStmt(RangeVar *heapRel, Oid heapRelid,
     	 * simply append them after simple column references.
     	 *
     	 * XXX Some places during build/estimation treat expressions as if they
    -	 * are before atttibutes, but for the CREATE command that's entirely
    +	 * are before attributes, but for the CREATE command that's entirely
     	 * irrelevant.
     	 */
     	datum = SysCacheGetAttr(STATEXTOID, ht_stats,
    diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
    index 7e11cb9d5f..5e53783ea6 100644
    --- a/src/backend/statistics/extended_stats.c
    +++ b/src/backend/statistics/extended_stats.c
    @@ -1796,7 +1796,7 @@ statext_mcv_clauselist_selectivity(PlannerInfo *root, List *clauses, int varReli
     				continue;
     
     			/*
    -			 * Now we know the clause is compatible (we have either atttnums
    +			 * Now we know the clause is compatible (we have either attnums
     			 * or expressions extracted from it), and was not estimated yet.
     			 */
     
    
    
    
    
  3. Re: Some doubious error messages and comments

    Michael Paquier <michael@paquier.xyz> — 2021-05-10T06:52:15Z

    On Wed, Apr 28, 2021 at 08:11:47AM -0500, Justin Pryzby wrote:
    > On Wed, Apr 28, 2021 at 05:36:33PM +0900, Kyotaro Horiguchi wrote:
    >> 0001: I found some typos in a error message and a comment.
    >> 
    >> multirangetypes.c: 1420
    >> > errmsg("range_intersect_agg must be called with a multirange")));
    >> 
    >> This "range_intersect_agg" looks like a typo of "multirange_..".
    >> 
    >> operatorcmds.c:303
    >> > * Look up a join estimator function ny name, and verify that it has the
    >> 
    >> "ny" looks like a typo of "by".
    > 
    > "ny name" shows up a 2nd time.
    > 
    > I have another "comment typos" patch - maybe someone will want to push them
    > together.
    
    Thanks.  Two of them were already fixed, two of them are correct but
    went missing so I have applied a fix for these.  The change in
    multirange_intersect_agg_transfn() is incorrect as the error refers to
    the SQL function range_intersect_agg().
    --
    Michael
    
  4. Re: Some doubious error messages and comments

    Kyotaro Horiguchi <horikyota.ntt@gmail.com> — 2021-05-14T06:06:39Z

    At Mon, 10 May 2021 15:52:15 +0900, Michael Paquier <michael@paquier.xyz> wrote in 
    > On Wed, Apr 28, 2021 at 08:11:47AM -0500, Justin Pryzby wrote:
    > > On Wed, Apr 28, 2021 at 05:36:33PM +0900, Kyotaro Horiguchi wrote:
    > >> 0001: I found some typos in a error message and a comment.
    > >> 
    > >> multirangetypes.c: 1420
    > >> > errmsg("range_intersect_agg must be called with a multirange")));
    > >> 
    > >> This "range_intersect_agg" looks like a typo of "multirange_..".
    > >> 
    > >> operatorcmds.c:303
    > >> > * Look up a join estimator function ny name, and verify that it has the
    > >> 
    > >> "ny" looks like a typo of "by".
    > > 
    > > "ny name" shows up a 2nd time.
    > > 
    > > I have another "comment typos" patch - maybe someone will want to push them
    > > together.
    > 
    > Thanks.  Two of them were already fixed, two of them are correct but
    > went missing so I have applied a fix for these.  The change in
    
    Thanks.
    
    > multirange_intersect_agg_transfn() is incorrect as the error refers to
    > the SQL function range_intersect_agg().
    
    Uh!! It seems to be a never-shown message.  Thaks for checking that.
    
    regards.
    
    -- 
    Kyotaro Horiguchi
    NTT Open Source Software Center