Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Ranier Vilela
er to postpone the function call until when it is actually necessary. best regards, Ranier Vilela avoid-call-expensive-function-varlena.patch Description: Binary data

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Ranier Vilela
Em seg., 4 de mar. de 2024 às 14:54, Matthias van de Meent < boekewurm+postg...@gmail.com> escreveu: > On Mon, 4 Mar 2024 at 18:39, Ranier Vilela wrote: > > > > Hi, > > > > The function var_strcmp is a critical function. > > Inside the function, there is

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-05 Thread Ranier Vilela
Em seg., 4 de mar. de 2024 às 20:28, Tom Lane escreveu: > Michael Paquier writes: > > On Mon, Mar 04, 2024 at 03:08:03PM -0300, Ranier Vilela wrote: > >> I can't see any user validation at the function > pg_newlocale_from_collation. > > > Matthias is right, lo

Re: code cleanups

2022-12-20 Thread Ranier Vilela
scope of vars: RangeTblEntry *rte Oid userid; + if (varno != relid) + { + RangeTblEntry *rte; + Oid userid; 0005: +1 0006: +1 regards, Ranier Vilela

Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)

2022-12-20 Thread Ranier Vilela
signed. Without a test case for this patch. But also, do not have a test case for the current thinko in head. Pass regress check. regards, Ranier Vilela avoid_lost_result_of_recursion.patch Description: Binary data

Re: Small miscellaneus fixes (Part II)

2022-12-21 Thread Ranier Vilela
Thanks for looking at this. Em ter., 20 de dez. de 2022 às 21:51, Justin Pryzby escreveu: > On Fri, Nov 25, 2022 at 06:27:04PM -0300, Ranier Vilela wrote: > > 5. Use boolean operator with boolean operands > > (b/src/backend/commands/tablecmds.c) > > tablecmds.c: ri

Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)

2022-12-21 Thread Ranier Vilela
Thanks David, for looking at this. Em ter., 20 de dez. de 2022 às 22:45, David Rowley escreveu: > On Wed, 21 Dec 2022 at 13:15, Ranier Vilela wrote: > > IMO, I think that commit a61b1f7, has an oversight. > > Currently is losing the result of recurs

Re: Small miscellaneus fixes (Part II)

2022-12-22 Thread Ranier Vilela
Em qua., 21 de dez. de 2022 às 04:10, Michael Paquier escreveu: > On Tue, Dec 20, 2022 at 06:51:34PM -0600, Justin Pryzby wrote: > > On Fri, Nov 25, 2022 at 06:27:04PM -0300, Ranier Vilela wrote: > > > 5. Use boolean operator with boolean operands > > > (b/src/b

ARRNELEMS Out-of-bounds possible errors

2022-12-22 Thread Ranier Vilela
ARRPTR(ent), nel * sizeof(int32)); } Sources possibly affecteds: contrib\cube\cube.c contrib\intarray\_intbig_gist.c contrib\intarray\_int_bool.c contrib\intarray\_int_gin.c contrib\intarray\_int_gist.c contrib\intarray\_int_op.c contrib\intarray\_int_tool.c: Thoughts? regards, Ranier Vilela

Re: Small miscellaneus fixes (Part II)

2022-12-22 Thread Ranier Vilela
Em ter., 20 de dez. de 2022 às 21:51, Justin Pryzby escreveu: > On Fri, Nov 25, 2022 at 06:27:04PM -0300, Ranier Vilela wrote: > > 5. Use boolean operator with boolean operands > > (b/src/backend/commands/tablecmds.c) > > tablecmds.c: right. Since 074c5cfbf > &g

Re: ARRNELEMS Out-of-bounds possible errors

2022-12-22 Thread Ranier Vilela
ed by caller? > I agreed that it is better to keep old behavior. Even the value 0 is problematic, with calls like this: nel = ARRNELEMS(ent); memcpy(ptr, ARRPTR(ent), nel * sizeof(int32)); regards, Ranier Vilela

Re: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)

2022-12-23 Thread Ranier Vilela
Em sex., 23 de dez. de 2022 às 09:10, David Rowley escreveu: > > I've now pushed your fix plus that test. > Thank you all for getting involved to resolve this. regards, Ranier Vilela

Re: ARRNELEMS Out-of-bounds possible errors

2022-12-26 Thread Ranier Vilela
Em seg., 26 de dez. de 2022 às 15:45, Nikita Malakhov escreveu: > Hi, > > My bad, I was misleaded by unconditional return in ereturn_domain. > Sorry for the noise. > By no means, the mistake was entirely mine, I apologize to you. regards, Ranier Vilela

Re: Optimizing Node Files Support

2023-01-06 Thread Ranier Vilela
there is no need to set NULL on COPY_STRING_FIELD. Regarding COPY_POINTER_FIELD, it is wasteful to cast size_t to size_t. v3 attached. regards, Ranier Vilela > regards, tom lane > > v3-optimize_gen_node_support.patch Description: Binary data

Re: Small miscellaneus fixes (Part II)

2023-01-16 Thread Ranier Vilela
> Another thing that caught my attention is the assumption that unsetting a > bit is so expensive that we have to first check if it's set, so we may as > well remove "IS_BRACKET(Np->Num)" as well. > > The attached is what I mean. I'll commit this this week unless there are > objections. > +1 looks good to me. regards, Ranier Vilela

Re: Small miscellaneus fixes (Part II)

2023-01-17 Thread Ranier Vilela
" as well. > > > > The attached is what I mean. I'll commit this this week unless there are > objections. > > I've pushed this and the cosmetic fix in pg_dump. Those were the only > things I saw that had some interest, so I closed the CF entry. > Thanks for the commits. regards, Ranier Vilela

Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access

2023-03-31 Thread Ranier Vilela
Hi, I think that commit f0d65c0 <https://github.com/postgres/postgres/commit/f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2> has an oversight. Attnum == 0, is system column too, right? All other places at tablecmds.c, has this test: if (attnum <= 0) ereport(ERROR, regards, Rani

Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access

2023-04-01 Thread Ranier Vilela
Em sex., 31 de mar. de 2023 às 16:25, Tom Lane escreveu: > Ranier Vilela writes: > > I think that commit f0d65c0 > > < > https://github.com/postgres/postgres/commit/f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2 > > > > has an oversight. > > Attnum == 0, is sys

Bufmgr possible overflow

2023-04-12 Thread Ranier Vilela
ce. Taking advantage of this, I promoted a scope reduction for some variables, which I thought was opportune. Patch attached. regards, Ranier Vilela 001-fix-bufmgr-extend-variable-index.patch Description: Binary data

Re: Bufmgr possible overflow

2023-04-13 Thread Ranier Vilela
Em qua., 12 de abr. de 2023 às 22:29, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > Perhaps it's a good idea to seprate the patch for each issue. > > Thanks Kyotaro for taking a look. > At Wed, 12 Apr 2023 09:36:14 -0300, Ranier Vilela > wrote in> IM

Re: Incremental sort for access method with ordered scan support (amcanorderbyop)

2023-04-20 Thread Ranier Vilela
delete needs a careful review. >I wonder if we can invent function list_nth_xid to do it, to keep >consistent with list_nth/list_nth_int/list_nth_oid. Perhaps list_nth_xid(const List *list, int n)? regards, Ranier Vilela 0001-add-new-list-functions.patch Description: Binary data

Re: Improve list manipulation in several places

2023-04-21 Thread Ranier Vilela
(const List *list, void *datum) list param pointer can be const here not? regards, Ranier Vilela

Re: Improve list manipulation in several places

2023-04-21 Thread Ranier Vilela
Em sex, 21 de abr de 2023 9:10 AM, David Rowley escreveu: > On Fri, 21 Apr 2023 at 23:16, Ranier Vilela wrote: > > Perhaps list_delete_nth_cell needs to check NIL too? > > + if (list == NIL) > > + return NIL; > > Which cell would you be deleting from

Re: Improve list manipulation in several places

2023-05-08 Thread Ranier Vilela
y one that looks like it could have a performance > advantage is list_copy_move_nth_to_head() (which is the weirdest of the > lot). I'm inclined not to have any of these single-use functions unless > a performance case can be made for them. > I think you missed list_nth_xid, It makes perfect sense to exist. regards, Ranier Vilela

[PATCH] Avoid dereference null relation pointer (src/backend/replication/logical/reorderbuffer.c)

2022-03-31 Thread Ranier Vilela
Hi hackers, Minor oversight with commit 0da92dc <https://github.com/postgres/postgres/commit/0da92dc530c9251735fc70b20cd004d9630a1266> . RelationIdGetRelation can return NULL, then it is necessary to check the return. regards, Ranier Vilela 0001-avoid-dereference-null-relation

support for MERGE

2022-03-31 Thread Ranier Vilela
and >make sure to handle the case where there isn't one. Hi, I think that there is an oversight at 7103ebb <https://github.com/postgres/postgres/commit/7103ebb7aae8ab8076b7e85f335ceb8fe799097c> There is no chance of Assert preventing this bug. regards, Ranier Vilela 0001-avo

Re: support for MERGE

2022-04-02 Thread Ranier Vilela
Em sáb., 2 de abr. de 2022 às 12:01, Alvaro Herrera escreveu: > On 2022-Mar-31, Daniel Gustafsson wrote: > > > > On 31 Mar 2022, at 19:38, Ranier Vilela wrote: > > > > > I think that there is an oversight at 7103ebb > > > There is no chance of Assert

logical decoding and replication of sequences

2022-04-02 Thread Ranier Vilela
9630a1266> . RelationIdGetRelation can return NULL, then it is necessary to check the return. regards, Ranier Vilela 0001-avoid-dereference-null-relation.patch Description: Binary data

Re: shared-memory based stats collector

2022-04-08 Thread Ranier Vilela
Hi, Per Coverity. pgstat_reset_entry does not check if lock it was really blocked. I think if shared_stat_reset_contents is called without lock, is it an issue not? regards, Ranier Vilela 0001-avoid-reset-stats-without-lock.patch Description: Binary data

Re: support for MERGE

2022-04-12 Thread Ranier Vilela
Em ter., 12 de abr. de 2022 às 10:47, Alvaro Herrera < alvhe...@alvh.no-ip.org> escreveu: > On 2022-Apr-02, Ranier Vilela wrote: > > > Em sáb., 2 de abr. de 2022 às 12:01, Alvaro Herrera < > alvhe...@alvh.no-ip.org> > > escreveu: > > > IMHO, actually the

Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-26 Thread Ranier Vilela
ted is: buildstate->bs_spool = (BrinSpool *) palloc0(sizeof(BrinSpool)); - buildstate->bs_spool->heap = buildstate->bs_spool->heap; - buildstate->bs_spool->index = buildstate->bs_spool->index; + buildstate->bs_spool->heap = heap; + buildstate->bs_spool->index = inde

Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-27 Thread Ranier Vilela
Em ter., 26 de dez. de 2023 às 19:07, Tomas Vondra < tomas.von...@enterprisedb.com> escreveu: > > > On 12/26/23 19:10, Ranier Vilela wrote: > > Hi, > > > > The commit b437571 <http://b437571714707bc6466abde1a0af5e69aaade09c> I > > think has an overs

Tidy fill hstv array (src/backend/access/heap/pruneheap.c)

2023-12-28 Thread Ranier Vilela
think it would be more productive to initialize the entire array with -1, and avoid flagging, one by one, the items that should be -1. Patch attached. best regards, Ranier Vilela 001-tidy-fill-htsv-array.patch Description: Binary data

Windows sockets (select missing events?)

2023-12-28 Thread Ranier Vilela
? If not, It would be a good prevention practice, using the correct type, right? Patch attached. best regards, Ranier Vilela 001-fix-socket-select-events.patch Description: Binary data

Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-29 Thread Ranier Vilela
Em qui., 28 de dez. de 2023 às 22:16, Tomas Vondra < tomas.von...@enterprisedb.com> escreveu: > > > On 12/27/23 12:37, Ranier Vilela wrote: > > Em ter., 26 de dez. de 2023 às 19:07, Tomas Vondra > > mailto:tomas.von...@enterprisedb.com>> > > escreveu: > &

Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-29 Thread Ranier Vilela
Em sex., 29 de dez. de 2023 às 10:33, Tomas Vondra < tomas.von...@enterprisedb.com> escreveu: > > > On 12/29/23 12:53, Ranier Vilela wrote: > > Em qui., 28 de dez. de 2023 às 22:16, Tomas Vondra > > mailto:tomas.von...@enterprisedb.com>> > > escreveu: > &

Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-29 Thread Ranier Vilela
Em sex., 29 de dez. de 2023 às 08:53, Ranier Vilela escreveu: > Em qui., 28 de dez. de 2023 às 22:16, Tomas Vondra < > tomas.von...@enterprisedb.com> escreveu: > >> >> >> On 12/27/23 12:37, Ranier Vilela wrote: >> > Em ter., 26 de dez. de 2023 às

Fix copy and paste error (src/bin/pg_basebackup/pg_basebackup.c)

2023-12-30 Thread Ranier Vilela
Hi, Per Coverity. The function StartLogStreamer in (src/bin/pg_basebackup/pg_basebackup.c) Has a copy and paste error. The commit affected is dc212340058b4e7ecfc5a7a81ec50e7a207bf288 <http://dc21234> Trivial patch attached. Best regards, Ranier Vilela fix-copy-and-paste

Fix resource leak (src/bin/pg_combinebackup/pg_combinebackup.c)

2023-12-30 Thread Ranier Vilela
group.org/onlinepubs/009604599/functions/closedir.html> The commit affected is dc21234 <http://dc212340058b4e7ecfc5a7a81ec50e7a207bf288> Trivial patch attached. Best regards, Ranier Vilela fix-resource-leak-pg_combinebackup.patch Description: Binary data

Re: Windows sockets (select missing events?)

2023-12-30 Thread Ranier Vilela
Em qui., 28 de dez. de 2023 às 14:45, Ranier Vilela escreveu: > Hi, > > The type of field fd_count is defined in winsock.h: > typedef unsigned intu_int; > > So in the struct fd_set, > the field fd_count is unsigned int. > > The pgwin32_select function has loop

Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)

2023-12-30 Thread Ranier Vilela
Em sáb., 30 de dez. de 2023 19:19, Tomas Vondra < tomas.von...@enterprisedb.com> escreveu: > On 12/29/23 18:02, Ranier Vilela wrote: > > > > ... > > > > As I wrote, the new patch version was for consideration. > > It seems more like a question of style, so i

Re: Avoid a possible overflow (src/backend/utils/sort/logtape.c)

2023-08-30 Thread Ranier Vilela
h > > watermark number of free pages is pretty small. Even still, I agree > > with your conclusion. There is really no reason to not be consistent > > here. > > Postgres 16 RC1 is now tagged, so applied down to 13. > Thank you, Michael. best regards, Ranier Vilela

Replace some cstring_to_text to cstring_to_text_with_len

2023-08-30 Thread Ranier Vilela
Hi, cstring_to_text has a small overhead, because call strlen for pointer to char parameter. Is it worth the effort to avoid this, where do we know the size of the parameter? best regards, Ranier Vilela 0003-Avoid-unecessary-calls-to-strlen-function.patch Description: Binary data

Re: Replace some cstring_to_text to cstring_to_text_with_len

2023-08-31 Thread Ranier Vilela
Em qui., 31 de ago. de 2023 às 00:22, Michael Paquier escreveu: > On Wed, Aug 30, 2023 at 03:00:13PM -0300, Ranier Vilela wrote: > > cstring_to_text has a small overhead, because call strlen for > > pointer to char parameter. > > > > Is it worth the effort to avoid

Re: Replace some cstring_to_text to cstring_to_text_with_len

2023-08-31 Thread Ranier Vilela
Em qui., 31 de ago. de 2023 às 08:41, John Naylor < john.nay...@enterprisedb.com> escreveu: > > On Thu, Aug 31, 2023 at 6:07 PM Ranier Vilela wrote: > > > > Em qui., 31 de ago. de 2023 às 00:22, Michael Paquier < > mich...@paquier.xyz> escreveu: > >> >

Re: Replace some cstring_to_text to cstring_to_text_with_len

2023-08-31 Thread Ranier Vilela
Em qui., 31 de ago. de 2023 às 09:51, Andrew Dunstan escreveu: > > On 2023-08-31 Th 07:41, John Naylor wrote: > > > On Thu, Aug 31, 2023 at 6:07 PM Ranier Vilela wrote: > > > > Em qui., 31 de ago. de 2023 às 00:22, Michael Paquier < > mich...@paquier.xyz>

Re: Replace some cstring_to_text to cstring_to_text_with_len

2023-08-31 Thread Ranier Vilela
Em qui., 31 de ago. de 2023 às 10:12, Dagfinn Ilmari Mannsåker < ilm...@ilmari.org> escreveu: > Andrew Dunstan writes: > > > On 2023-08-31 Th 07:41, John Naylor wrote: > >> > >> On Thu, Aug 31, 2023 at 6:07 PM Ranier Vilela > wrote: > >> > &

Re: Replace some cstring_to_text to cstring_to_text_with_len

2023-08-31 Thread Ranier Vilela
Em qui., 31 de ago. de 2023 às 12:12, Dagfinn Ilmari Mannsåker < ilm...@ilmari.org> escreveu: > Ranier Vilela writes: > > > Em qui., 31 de ago. de 2023 às 10:12, Dagfinn Ilmari Mannsåker < > > ilm...@ilmari.org> escreveu: > > > >> Andrew Dunstan wri

Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-01 Thread Ranier Vilela
Hi, If a null locale is reached in these paths. elog will dereference a null pointer. best regards, Ranier Vilela 0001-Avoid-a-possible-dereference-a-null-pointer.patch Description: Binary data

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-02 Thread Ranier Vilela
Em sex., 1 de set. de 2023 às 17:17, Robert Haas escreveu: > On Fri, Sep 1, 2023 at 11:47 AM Ranier Vilela wrote: > > If a null locale is reached in these paths. > > elog will dereference a null pointer. > > True. That's sloppy coding. > > I don't know enou

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-04 Thread Ranier Vilela
Em dom., 3 de set. de 2023 às 22:01, Michael Paquier escreveu: > On Sat, Sep 02, 2023 at 09:13:11AM -0300, Ranier Vilela wrote: > > I tried to keep the same behavior as before. > > Note that if the locale equals COLLPROVIDER_LIBC, > > the message to the

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-06 Thread Ranier Vilela
Em seg., 4 de set. de 2023 às 11:27, Ranier Vilela escreveu: > Em dom., 3 de set. de 2023 às 22:01, Michael Paquier > escreveu: > >> On Sat, Sep 02, 2023 at 09:13:11AM -0300, Ranier Vilela wrote: >> > I tried to keep the same behavior as before. >> &g

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-10 Thread Ranier Vilela
Em sex., 8 de set. de 2023 às 03:24, Michael Paquier escreveu: > On Wed, Sep 06, 2023 at 07:57:03AM -0300, Ranier Vilela wrote: > > I think no one objected. > > Looking closer, there is much more inconsistency in this file > depending on the routine called. How about som

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-11 Thread Ranier Vilela
Em seg., 11 de set. de 2023 às 21:03, Michael Paquier escreveu: > On Mon, Sep 11, 2023 at 12:15:49PM -0700, Jeff Davis wrote: > > That's fine with me. > > Okay. Then, please find attached a v4 for HEAD and REL_16_STABLE. > LGTM. best regards, Ranier Vilela

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-12 Thread Ranier Vilela
for HEAD and REL_16_STABLE. > > One question: would it make sense to use __func__? > According to the msvc documentation, __func__ requires C++11. https://learn.microsoft.com/en-us/cpp/cpp/func?view=msvc-170 I think that is not a good idea. best regards, Ranier Vilela

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-14 Thread Ranier Vilela
Em qua., 13 de set. de 2023 às 22:32, Michael Paquier escreveu: > On Wed, Sep 13, 2023 at 08:14:11AM -0700, Jeff Davis wrote: > > Looks good to me, thank you. > > Applied, then. Thanks. > Thank you Michael, for the commit. best regards, Ranier Vilela

Re: Standardize type of variable when extending Buffers

2023-09-19 Thread Ranier Vilela
Em ter., 19 de set. de 2023 às 05:07, Peter Eisentraut escreveu: > On 10.07.23 13:08, Ranier Vilela wrote: > > > > Em seg., 10 de jul. de 2023 às 03:27, Kyotaro Horiguchi > > mailto:horikyota@gmail.com>> escreveu: > > > > At Fri, 7

Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-23 Thread Ranier Vilela
regards, Ranier Vilela 0001-Avoid-possible-out-of-bounds-access.patch Description: Binary data

Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-25 Thread Ranier Vilela
Em seg., 25 de set. de 2023 às 08:23, Ashutosh Bapat < ashutosh.bapat@gmail.com> escreveu: > On Sat, Sep 23, 2023 at 7:29 PM Ranier Vilela wrote: > > > > Hi, > > > > Per Coverity. > > CID 1518088 (#2 of 2): Improper use of negative value

Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-26 Thread Ranier Vilela
directly even stronger. > > I am curious, is the overhead in find_base_rel() impacting overall > performance? > It seems to me that it adds a LEA instruction. https://godbolt.org/z/b4jK3PErE Although it doesn't seem like much, I believe the solution (casting to unsigned) seems better. So +1. best regards, Ranier Vilela

Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-26 Thread Ranier Vilela
Em ter., 26 de set. de 2023 às 09:30, Ranier Vilela escreveu: > Em ter., 26 de set. de 2023 às 07:34, Ashutosh Bapat < > ashutosh.bapat@gmail.com> escreveu: > >> On Tue, Sep 26, 2023 at 3:32 PM David Rowley >> wrote: >> > >> > find_base_rel

Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-27 Thread Ranier Vilela
Em qua., 27 de set. de 2023 às 04:35, David Rowley escreveu: > On Wed, 27 Sept 2023 at 06:10, Ranier Vilela wrote: > > As suggested, casting is the best option that does not add any overhead > and improves the robustness of the find_base_rel function. > > I propose patch v1, w

Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

2023-09-28 Thread Ranier Vilela
Em qua., 27 de set. de 2023 às 22:28, David Rowley escreveu: > On Thu, 28 Sept 2023 at 02:37, Ranier Vilela wrote: > >> Please check [1] for the mention of: > >> > >> "The fastest way to get your patch rejected is to make unrelated > >> changes. Refor

Possible copy and past error? (\usr\backend\commands\analyze.c)

2020-03-27 Thread Ranier Vilela
stats->attr->attstattarget; int num_bins = num_mcv; To silence this alert. best regards, Ranier Vilela

Re: Possible copy and past error? (\usr\backend\commands\analyze.c)

2020-03-28 Thread Ranier Vilela
Em sex., 27 de mar. de 2020 às 20:49, Tom Lane escreveu: > Ranier Vilela writes: > > Can someone check if there is a copy and paste error, at file: > > \usr\backend\commands\analyze.c, at lines 2225 and 2226? > > int num_mcv = stats->attr->attstattarget; >

[PATCH'] Variables assigned with values that is never used.

2020-03-28 Thread Ranier Vilela
Hi, Theses variables, are assigned with values that never is used and, can safely have their values removed. best regards, Ranier Vilela variables_assigned_unused_value.patch Description: Binary data

[PATCH] Redudant initilization

2020-03-28 Thread Ranier Vilela
Hi, This patch fixes some redundant initilization, that are safe to remove. best regards, Ranier Vilela redudant_initialization.patch Description: Binary data

Re: [PATCH] Redudant initilization

2020-03-30 Thread Ranier Vilela
Em dom., 29 de mar. de 2020 às 21:57, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > Hello. > > At Sat, 28 Mar 2020 19:04:00 -0300, Ranier Vilela > wrote in > > Hi, > > This patch fixes some redundant initilization, that are safe to remove. > > &g

Re: Possible copy and past error? (\usr\backend\commands\analyze.c)

2020-03-30 Thread Ranier Vilela
Em seg., 30 de mar. de 2020 às 05:16, Michael Paquier escreveu: > On Sat, Mar 28, 2020 at 07:48:22AM -0300, Ranier Vilela wrote: > > I completely disagree. My tools have proven their worth, including > finding > > serious errors in the code, which fortunately have b

Re: Possible copy and past error? (\usr\backend\commands\analyze.c)

2020-03-30 Thread Ranier Vilela
Em seg., 30 de mar. de 2020 às 06:06, Magnus Hagander escreveu: > On Sat, Mar 28, 2020 at 11:49 AM Ranier Vilela > wrote: > > > > Em sex., 27 de mar. de 2020 às 20:49, Tom Lane > escreveu: > >> > >> Ranier Vilela writes: > >> > Can someon

[PATCH] Remove some reassigned values.

2020-03-30 Thread Ranier Vilela
Hi, This patch remove reassigned values, with safety. Plancat.c, needs a more careful review. Best regards Ranier Vilela remove_reassigned_values.patch Description: Binary data

[PATCH] remove condition always true (/src/backend/access/heap/vacuumlazy.c)

2020-03-30 Thread Ranier Vilela
does, apparently it checks before unlocking. best regards, Ranier Vilela remove_condition_always_true.patch Description: Binary data

Re: [PATCH] remove condition always true (/src/backend/access/heap/vacuumlazy.c)

2020-03-30 Thread Ranier Vilela
Em seg., 30 de mar. de 2020 às 18:14, Andres Freund escreveu: > Hi, > > On 2020-03-30 14:10:29 -0700, Andres Freund wrote: > > On 2020-03-30 17:08:01 -0300, Ranier Vilela wrote: > > > Em seg., 30 de mar. de 2020 às 16:05, Andres Freund < > and...@anarazel.de>

Re: [PATCH] remove condition always true (/src/backend/access/heap/vacuumlazy.c)

2020-03-31 Thread Ranier Vilela
Hi, Thanks for the commit. Ranier Vilela

[PATCH] Fix type var declaration (src/backend/access/brin/brin.c)

2020-03-31 Thread Ranier Vilela
Hi, bringetbitmap function returns int64 value, but internally uses int. For prevent future bugs, fix to right type. best regards, Ranier Vilela fix_int64_brin.patch Description: Binary data

Re: [PATCH] Redudant initilization

2020-04-01 Thread Ranier Vilela
Hi, New patch with yours suggestions. best regards, Ranier Vilela v2_redundant_initialization.patch Description: Binary data

[PATCH] Improve function toast_delete_external (src/backend/access/table/toast_helper.c)

2022-02-09 Thread Ranier Vilela
Hi, I think this change can improve this particular function by avoiding touching value if not needed. Test if not isnull is cheaper than test TupleDescAttr is -1. best regards, Ranier Vilela v1_tiny_improvemnt_toast_helper.patch Description: Binary data

Possible uninitialized use of the variables (src/backend/access/transam/twophase.c)

2022-02-09 Thread Ranier Vilela
think thay forgot initialize these fields in the function StartPrepare because, when calling function save_state_data(&hdr, sizeof(TwoPhaseFileHeader)); I have one report about possible uninitialized usage of the variables. Best regards, Ranier Vi

Re: Plug minor memleak in pg_dump

2022-02-09 Thread Ranier Vilela
>No, but I was distracted by other things leaving this on the TODO list. It's >been pushed now. Hi, IMO I think that still have troubles here. ReadStr can return NULL, so the fix can crash. regards, Ranier Vilela v1_fix_possible_null_dereference_pg_backup_archiver.patch Descript

Re: [PATCH] Improve function toast_delete_external (src/backend/access/table/toast_helper.c)

2022-02-09 Thread Ranier Vilela
Em qua., 9 de fev. de 2022 às 20:10, Dong Wook Lee escreveu: > Yes, now I understand it. > Thank you for letting me know about that. > You are welcome. Best regards, Ranier Vilela

Re: Plug minor memleak in pg_dump

2022-02-10 Thread Ranier Vilela
Em qua., 9 de fev. de 2022 às 23:16, Michael Paquier escreveu: > On Wed, Feb 09, 2022 at 02:48:35PM -0300, Ranier Vilela wrote: > > IMO I think that still have troubles here. > > > > ReadStr can return NULL, so the fix can crash. > > - sscanf(tmp, &q

Re: Plug minor memleak in pg_dump

2022-02-10 Thread Ranier Vilela
Em qui., 10 de fev. de 2022 às 08:14, Ranier Vilela escreveu: > Em qua., 9 de fev. de 2022 às 23:16, Michael Paquier > escreveu: > >> On Wed, Feb 09, 2022 at 02:48:35PM -0300, Ranier Vilela wrote: >> > IMO I think that still have troubles here. >> > >> &g

Re: Plug minor memleak in pg_dump

2022-02-10 Thread Ranier Vilela
Em qui., 10 de fev. de 2022 às 10:57, Daniel Gustafsson escreveu: > > On 10 Feb 2022, at 12:14, Ranier Vilela wrote: > > Em qua., 9 de fev. de 2022 às 23:16, Michael Paquier < > mich...@paquier.xyz <mailto:mich...@paquier.xyz>> escreveu: > > > This patch ma

Re: Signed vs. Unsigned (some)

2022-02-13 Thread Ranier Vilela
Em sex., 11 de jun. de 2021 às 23:05, Ranier Vilela escreveu: > Hi, > > Removing legitimate warnings can it be worth it? > > -1 CAST can be wrong, when there is an invalid value defined > (InvalidBucket, InvalidBlockNumber). > I think depending on the compiler -1 CAST

Re: [PATCH] Dereference null return value (NULL_RETURNS) (src/backend/commands/statscmds.c)

2022-02-13 Thread Ranier Vilela
Em ter., 25 de ago. de 2020 às 12:42, Ranier Vilela escreveu: > Hi Tom, > > Per Coverity. > > The SearchSysCache1 allows return NULL and at function AlterStatistics, > has one mistake, lack of, check of return, which enables a dereference > NULL pointer, > at fu

[PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Ranier Vilela
, Ranier Vilela avoid_open_and_lock_table_if_not_owner.patch Description: Binary data

Re: [PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Ranier Vilela
Em dom., 13 de fev. de 2022 às 18:43, Andres Freund escreveu: > Hi, > > On 2022-02-13 18:21:38 -0300, Ranier Vilela wrote: > > Why open and lock the table Extended Statistics if it is not the owner. > > Check and return to avoid this. > > I was about to say that this

Re: Possible uninitialized use of the variables (src/backend/access/transam/twophase.c)

2022-02-14 Thread Ranier Vilela
dPrepare() anymore if there is no origin data, no? It would be good > > to comment that these are filled in EndPrepare(), I guess, once you do > > the initialization in StartPrepare(). > > That still looked better on a fresh look in terms of consistency, so > applied this way. > Thanks. regards, Ranier Vilela

Postgres 14.2 Windows can't rename temporary statistics file

2022-02-14 Thread Ranier Vilela
12.215 db_25214.stat 14/02/2022 21:15 1.335 global.stat 3 arquivo(s) 15.220 bytes The point is we can not relies on the "rename" function at Windows Side. The local installation is made with user with full rights and permissions, but Postgres Windows

Re: Postgres 14.2 Windows can't rename temporary statistics file

2022-02-14 Thread Ranier Vilela
Em seg., 14 de fev. de 2022 às 21:58, Justin Pryzby escreveu: > On Mon, Feb 14, 2022 at 09:19:54PM -0300, Ranier Vilela wrote: > > I've reported this issue, but without success in fixing it. > > It'd be helpful to provide a link to the prior discussions, and

Re: Postgres 14.2 Windows can't rename temporary statistics file

2022-02-15 Thread Ranier Vilela
Em seg., 14 de fev. de 2022 às 22:58, Thomas Munro escreveu: > On Tue, Feb 15, 2022 at 2:09 PM Ranier Vilela wrote: > > Em seg., 14 de fev. de 2022 às 21:58, Justin Pryzby < > pry...@telsasoft.com> escreveu: > >> On Mon, Feb 14, 2022 at 09:19:54PM -0300, Ranie

[PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-15 Thread Ranier Vilela
&filePath=%2Fdll%2Fpostgres%2Fpostgres%2Fsrc%2Fbackend%2Futils%2Fmb%2Fmbutils.c&fileStart=1546&fileEnd=1605> ] 633retval = pg_verify_mbstr_len(src_encoding, src_str, len, false); 634 Trivial patch attached. regards, Ranier Vilela fix_out_of_bounds_wchar.patch Description: Binary data

Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-16 Thread Ranier Vilela
Em qua., 16 de fev. de 2022 às 00:12, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > At Tue, 15 Feb 2022 09:17:34 -0300, Ranier Vilela > wrote in > > Per Coverity. > > Thanks for the source:) > > > Like the function pg_encoding_max_length_sql &g

Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-17 Thread Ranier Vilela
Em qui., 17 de fev. de 2022 às 05:25, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > At Thu, 17 Feb 2022 15:50:09 +0800, Julien Rouhaud > wrote in > > On Thu, Feb 17, 2022 at 03:51:26PM +0900, Kyotaro Horiguchi wrote: > > > So, the function doesn't return 63 for all registered names and

Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-17 Thread Ranier Vilela
if Why does this ifdef exist? If the correct is this? #define DEF_ENC2NAME(name, codepage) { #name, PG_##name, codepage } 2. This path: #define DEF_ENC2NAME(name, codepage) { #name, PG_##name } DEF_ENC2NAME(EUC_JP, 20932), What happens if pg_encoding_max_length is called with Database->encoding equals 20932 ? Can you test the v2 of the patch? regards, Ranier Vilela v2_fix_out_of_bounds_wchar.patch Description: Binary data

[PATCH] Fix possible minor memory leak (src/backend/catalog/heap.c)

2022-02-17 Thread Ranier Vilela
Hi, Per Coverity. Maybe this is a mistake, but, Is it necessary or not to free the memory allocated by nodeToString? If yes, the patch attached fixes this. regards, Ranier Vilela fix_minor_memory_leak_heap.patch Description: Binary data

Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-17 Thread Ranier Vilela
Em qui., 17 de fev. de 2022 às 09:52, Daniel Gustafsson escreveu: > > On 17 Feb 2022, at 13:19, Ranier Vilela wrote: > > > 1. One #ifdef with a mistake, the correct is _WIN32 and not WIN32. > > Can you elaborate on this, we are using WIN32 pretty extensively in the > cod

Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)

2022-02-17 Thread Ranier Vilela
Em qui., 17 de fev. de 2022 às 10:18, Daniel Gustafsson escreveu: > > On 17 Feb 2022, at 13:59, Ranier Vilela wrote: > > > > Em qui., 17 de fev. de 2022 às 09:52, Daniel Gustafsson <mailto:dan...@yesql.se>> escreveu: > > > On 17 Feb 2022, at 13:19, Ranier

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-10 Thread Ranier Vilela
Em qui., 10 de nov. de 2022 às 05:16, Michael Paquier escreveu: > On Thu, Sep 01, 2022 at 08:42:15AM -0300, Ranier Vilela wrote: > > Let's wait for the patch to be accepted and committed, so we can try to > > change it. > > FWIW, I think that this switch is a go

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-12 Thread Ranier Vilela
Em sex., 11 de nov. de 2022 às 01:54, Michael Paquier escreveu: > On Thu, Nov 10, 2022 at 08:56:25AM -0300, Ranier Vilela wrote: > > For CopyStatistics() have performance checks. > > You are not giving all the details of your tests, though, Windows 10 64 bits SSD 256

<    1   2   3   4   5   6   7   8   9   10   >