Re: poc - possibility to write window function in PL languages - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: poc - possibility to write window function in PL languages
Date
Msg-id CALNJ-vRvrmqO5uHiAVox_Mi42rf6oFP1w-mgY6sX-Gb5eD0UeQ@mail.gmail.com
Whole thread Raw
In response to Re: poc - possibility to write window function in PL languages  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: poc - possibility to write window function in PL languages  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Hi, Pavel:
Happy New Year.

+   command with clause <literal>WINDOW</literal>. The specific feature of
+   this functions is a possibility to two special storages with

this functions -> this function

possibility to two special storages: there is no verb.

'store with stored one value': store is repeated.

+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group

It would be better to change 2020 to 2021 in the new files.

For some functions, such as windowobject_get_func_arg_frame, it would be better to add comment explaining their purposes.

For estimate_partition_context_size():
+                    errmsg("size of value is greather than limit (1024 bytes)")));

Please include the value of typlen in the message. There is similar error message in the else block where value of size should be included.

+       return *realsize;
+   }
+   else

The 'else' is not needed since the if block ends with return.

+           size += size / 3;

Please add a comment for the choice of constant 3.

+           /* by default we allocate 30 bytes */
+           *realsize = 0;

The value 30 may not be accurate - from the caller:

+   if (PG_ARGISNULL(2))
+       minsize = VARLENA_MINSIZE;
+   else
+       minsize = PG_GETARG_INT32(2);

VARLENA_MINSIZE is 32.

Cheers

On Fri, Jan 1, 2021 at 3:29 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:
Hi

rebase

Regards

Pavel

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Safety/validity of resetting permissions by updating system tables
Next
From: Andrey Borodin
Date:
Subject: Re: Spurious "apparent wraparound" via SimpleLruTruncate() rounding