Re: someone else to do the list of acknowledgments

2025-09-17 Thread Ranier Vilela
her name-looking things that aren't people (ex. > Microsoft Windows) screened out. Even with all that automation it is still > over 50k lines, so if you want to double check that, make sure you have a > comfy chair. > I think that "Rainier Vilela" is a mistake and should be removed. The correct is "Ranier Vilela" best regards, Ranier Vilela

Re: REPACK and naming

2025-09-17 Thread Ranier Vilela
ent from VACUUM > > It seems if we add REPACK as a command, it is somewhere between VACUUM > FULL and VACUUM in severity/impact. Should we be rethinking the naming > in this area? > SqlServer has similar feature. SHRINK best regards, Ranier Vilela

Avoid resource leak (src/test/modules/test_binaryheap/test_binaryheap.c)

2025-09-12 Thread Ranier Vilela
Hi. Per Coverity. Coverity reports this resource leak in test_binaryheap module. I think that is right. Trivial patch attached. best regards, Ranier Vilela avoid-resource-leak-test_binaryheap.patch Description: Binary data

Re: Making type Datum be 8 bytes everywhere

2025-09-11 Thread Ranier Vilela
Em qui., 11 de set. de 2025 às 12:36, Tom Lane escreveu: > Ranier Vilela writes: > > Em qua., 10 de set. de 2025 às 17:35, Tom Lane > escreveu: > >> This is silently assuming that sizeof(SortItem) is a multiple of > >> alignof(Datum), which on a 32-bit-pointer

Re: Making type Datum be 8 bytes everywhere

2025-09-11 Thread Ranier Vilela
SortItem)); + items = (SortItem *) palloc(MAXALIGN(numrows * sizeof(SortItem))); 2. Function build_distinct_groups (src/backend/statistics/mcv.c) - SortItem *groups = (SortItem *) palloc(ngroups * sizeof(SortItem)); + SortItem *groups = (SortItem *) palloc(MAXALIGN(ngroups * sizeof(SortItem))); best regards, Ranier Vilela

Re: PgStat_HashKey padding issue when passed by reference

2025-09-04 Thread Ranier Vilela
workaround: > > 1/ pg_noinline pgstat_get_entry_ref_cached > 2/ making volatile the PgStat_HashKey key in the > pgstat_get_entry_ref_cached parameter > 3/ Passing the key by reference instead of by value > 4/ set SH_SCOPE to "external" rather than "static inline" in pgstat_shmem.c > > it seems, at least for this case, the best option is to pass the key > by reference, like > in the attached patch. > +1 Not to mention that it is faster to pass the parameter by reference. best regards, Ranier Vilela

Re: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c

2025-09-03 Thread Ranier Vilela
ranch, but the code > is > nearly identical in Postgres 13-17 so I suggest backporting it to other > supported versions. > > The patch changes pgstat_init_entry()'s behaviour, returning NULL if memory > allocation failed. I'm wondering if it wouldn't be better to raise elog(ERROR), and avoid many checks for this NULL. best regards, Ranier Vilela

Re: Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

2025-09-03 Thread Ranier Vilela
Em ter., 2 de set. de 2025 às 16:44, Tom Lane escreveu: > Ranier Vilela writes: > > In libpq-fe.h has an artifact pre C99, pqbool. > > IMO this is not more necessary, once Postgres supports C99 > > and bool becomes standard. > > > So get ride of pqbool and use boo

Re: Avoid use of uninitialized variable (src/pl/plperl/plperl.c)

2025-09-02 Thread Ranier Vilela
Em ter., 2 de set. de 2025 às 14:42, Andres Freund escreveu: > Hi, > > On 2025-09-02 14:39:44 -0300, Ranier Vilela wrote: > > In (src/pl/plperl/plperl.c) if *PERL_SYS_INIT3* is defined and > > *MYMALLOC* is not, is possible use of variable > > *perl_sys_init_done

Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

2025-09-02 Thread Ranier Vilela
Hi. In libpq-fe.h has an artifact pre C99, pqbool. IMO this is not more necessary, once Postgres supports C99 and bool becomes standard. So get ride of pqbool and use bool instead. trivial patch attached. best regards, Ranier Vilela v1-001-get-ride-pqbool-libpq-fe.patch Description: Binary

Re: Use bool with synced field (src/include/replication/slot.h)

2025-09-02 Thread Ranier Vilela
to the archives. Please forgive the brain fade. > Don't worry, thanks for the commit. best regards, Ranier Vilela

Avoid use of uninitialized variable (src/pl/plperl/plperl.c)

2025-09-02 Thread Ranier Vilela
, Ranier Vilela v1-001-avoid-use-uninitialized-variable-plperl.patch Description: Binary data

Use bool with synced field (src/include/replication/slot.h)

2025-09-02 Thread Ranier Vilela
Hi. IMO in the struct ReplicationSlotPersistentData, the field *synced* has wrong type declaration. The intention was *bool* not *char* type. Since it is only used in Boolean comparison. trivial patch attached. best regards, Ranier Vilela v1-001-use-bool-for-synced-field-slot.patch

Re: Avoid overwiriting cache entry (src/backend/utils/cache/relcache.c)

2025-08-29 Thread Ranier Vilela
Em sex., 29 de ago. de 2025 às 07:58, Álvaro Herrera escreveu: > On 2025-Aug-26, Ranier Vilela wrote: > > > In function *CheckNNConstraintFetch* the array index is > > incremented only when "null combin" is not found. > > > > IMO the last cache entry can

Re: Aggregate Function corr does not always return the correct value

2025-08-26 Thread Ranier Vilela
y FROM generate_series(0, 5) AS x) SELECT corr(x, y) FROM dataset; But I can't say if this answer (NaN) makes things worse. best regards, Ranier Vilela

Avoid overwiriting cache entry (src/backend/utils/cache/relcache.c)

2025-08-26 Thread Ranier Vilela
ll. patch attached. best regards, Ranier Vilela v1-001-avoid-overwiriting-cache-entry-relcache.patch Description: Binary data

Re: use PqMsg macros in fe-protocol3.c

2025-08-25 Thread Ranier Vilela
Em seg., 25 de ago. de 2025 às 16:11, Nathan Bossart < nathandboss...@gmail.com> escreveu: > On Mon, Aug 25, 2025 at 02:03:11PM -0300, Ranier Vilela wrote: > > If you don't mind I think that have one more source. > > Good catch. Committed. > Thanks. best regards, Ranier Vilela

Re: use PqMsg macros in fe-protocol3.c

2025-08-25 Thread Ranier Vilela
ticed a couple more opportunities to use the PqMsg_* macros. > > > > Nice. LGTM! > > Thanks, committed. > If you don't mind I think that have one more source. patch attached. best regards, Ranier Vilela 0001-Use-PqMsg-macros-in-applyparallelworker.patch Description: Binary data

Re: Weird error message from Postgres 18

2025-08-21 Thread Ranier Vilela
Em qui., 21 de ago. de 2025 às 12:17, Tom Lane escreveu: > Ranier Vilela writes: > > create table inserttest (col1 serial PRIMARY KEY, col2 int4 NOT NULL, > col3 > > text NOT NULL, col4 text NULL); > > insert into inserttest select 0 AS col2, NULL AS col3, NULL AS col4

Weird error message from Postgres 18

2025-08-21 Thread Ranier Vilela
2" of relation "inserttest" violates not-null constraint DETAIL: Failing row contains (0, null, null, null). drop table inserttest; It seems that the message is confusing. col2 and col3 IS NOT NULL, but col2 has value 0. best regards, Ranier Vilela insert_into_select_test.sql Description: Binary data

Fixes possible api misuse when connecting with server

2025-06-23 Thread Ranier Vilela
. Patches attached. best regards, Ranier Vilela fix-connection-api-miuse-connect_utils.patch Description: Binary data fix-connection-api-miuse-ecpg.patch Description: Binary data fix-connection-api-miuse-pg_rewind.patch Description: Binary data fix-connection-api-miuse-psql.patch Description

Re: Fix copy-and-past thinko (src/interfaces/libpq/fe-cancel.c)

2025-06-18 Thread Ranier Vilela
Em ter., 17 de jun. de 2025 às 10:42, Daniel Gustafsson escreveu: > > On 17 Jun 2025, at 15:40, Ranier Vilela wrote: > > > In the function *PQcancelCreate* there is a copy-and-past thinko. > > The pointer that must be checked is cancelConn. > > > > Trivial pat

Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)

2025-06-18 Thread Ranier Vilela
Em qua., 18 de jun. de 2025 às 07:29, Etsuro Fujita escreveu: > On Tue, Jun 17, 2025 at 11:03 PM Fujii Masao > wrote: > > On 2025/06/17 20:37, Ranier Vilela wrote: > > > Em ter., 17 de jun. de 2025 às 06:09, Etsuro Fujita < > etsuro.fuj...@gmail.com <mailto:etsu

Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

2025-06-17 Thread Ranier Vilela
nsus that there will not be a segfault. If a segfault will never occur, ok. IMO, this is not a query-dependent issue. But the table in question is never corrupted or invalid. best regards, Ranier Vilela

Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

2025-06-17 Thread Ranier Vilela
t adding a "elog(ERROR)" here would be misleading, as > it implies it's something we expect. And mostly pointless. I can imagine > adding an Assert, but I don't quite see how is that better than just > hitting a segfault a couple lines later. > To me this is a contradiction, whether you consider waiting for a segfault or consider adding an Assert. For the user it is better to have a log, where he can quickly find the problem, rather than having to investigate on his own. best regards, Ranier Vilela

Re: Fix copy-and-past thinko (src/interfaces/libpq/fe-cancel.c)

2025-06-17 Thread Ranier Vilela
Em ter., 17 de jun. de 2025 às 10:42, Daniel Gustafsson escreveu: > > On 17 Jun 2025, at 15:40, Ranier Vilela wrote: > > > In the function *PQcancelCreate* there is a copy-and-past thinko. > > The pointer that must be checked is cancelConn. > > > > Trivial pat

Fix copy-and-past thinko (src/interfaces/libpq/fe-cancel.c)

2025-06-17 Thread Ranier Vilela
Hi. In the function *PQcancelCreate* there is a copy-and-past thinko. The pointer that must be checked is cancelConn. Trivial patch attached. best regards, Ranier Vilela fix-copy-and-past-thinko-fe-cancel.patch Description: Binary data

Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

2025-06-17 Thread Ranier Vilela
can rest assured. > Since this code doesn't crash. No, you can't be sure. > I suspect this is > one of such cases. Unless you are aware of a specific scenario that > makes the code crash of course. > ScanPgRelation really can fail, better make sure. best regards, Ranier Vilela

Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

2025-06-17 Thread Ranier Vilela
ll paths, this check is done, why would this be the only exception? best regards, Ranier Vilela

Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)

2025-06-17 Thread Ranier Vilela
es in fpinfo so we don't need to do it again to generate the * basic foreign path. */ estimate_path_cost_size(root, baserel, NIL, NIL, NULL, &fpinfo->rows, &fpinfo->width, &fpinfo->disabled_nodes, &fpinfo->startup_cost, &fpinfo->total_cost); best regards, Ranier Vilela

Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)

2025-06-16 Thread Ranier Vilela
Hi. In the function *estimate_path_cost_size* the parameter fpextra can be NULL. It is necessary to always check its validity, as is already done in other parts of the source. patch attached. Best regards, Ranier Vilela fix-possible-dereference-null-pointer-postgres_fdw.patch Description

Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

2025-06-16 Thread Ranier Vilela
Hi. The function *ScanPgRelation* can return a invalid tuple. It is necessary to check the function's return, as is already done in other parts of the source. patch attached. Best regards, Ranier Vilela fix-possible-dereference-null-pointer-relcache.patch Description: Binary data

Re: jsonapi: scary new warnings with LTO enabled

2025-04-16 Thread Ranier Vilela
e FREE() call is reached only if > the JSONLEX_FREE_STRUCT flag is set, which it should not be for these > call sites. See the function *makeJsonLexContextCstringLen* (line 400) The JSONLEX_FREE_STRUCT is enabled, no? fe-auth-oauth.c (line 507) makeJsonLexContextCstringLen(&lex, msg, msglen, PG_UTF8, true); Worst, on a second call, with lex not NULL, the flags is reseted and the struct will no longer be released? best regards, Ranier Vilela

Re: Fix a resource leak (src/backend/utils/adt/rowtypes.c)

2025-04-15 Thread Ranier Vilela
Em seg., 14 de abr. de 2025 às 18:11, Tom Lane escreveu: > Robert Haas writes: > > On Sun, Apr 13, 2025 at 7:34 PM Ranier Vilela > wrote: > >> The function *record_in* has a new report about resource leak. > >> I think Coverity is right. > > > I agree,

Silence using uninitialized value

2025-04-15 Thread Ranier Vilela
1244} There a common pattern in the source code: value = (Datum) 0; null = true; So I believe it is worth changing to the standard used. patch attached. best regards, Ranier Vilela fix_read_unitialized_variable_tablecmds.patch Description: Binary data fix-uninitialized-read-variable-tablespace.

Re: Fix a resource leak (src/backend/utils/adt/rowtypes.c)

2025-04-14 Thread Ranier Vilela
Em seg., 14 de abr. de 2025 às 16:59, Robert Haas escreveu: > On Sun, Apr 13, 2025 at 7:34 PM Ranier Vilela wrote: > > CID 1608916: (#1 of 1): Resource leak (RESOURCE_LEAK) > > 52. leaked_storage: Variable buf going out of scope leaks the storage > buf.data points to. &g

Re: Add pg_get_injection_points() for information of injection points

2025-04-14 Thread Ranier Vilela
Em seg., 14 de abr. de 2025 às 09:46, Ranier Vilela escreveu: > Hi Michael. > > Em dom., 13 de abr. de 2025 às 21:36, Michael Paquier > escreveu: > >> Hi all, >> >> One thing that's been lacking in injection points is the possibility >> to look at

Fix a resource leak (src/backend/utils/adt/rowtypes.c)

2025-04-13 Thread Ranier Vilela
and *nulls* should also be released. While there, move the creation of stringdata, to ensure that in case of failure, the buf.data variable is released correctly. Attached a path. best regards, Ranier Vilela fix-resource-leak-rowtypes.patch Description: Binary data

Re: Silence resource leaks alerts

2025-04-13 Thread Ranier Vilela
Em sex., 11 de abr. de 2025 às 08:27, Ranier Vilela escreveu: > Thanks Michael, for looking at this. > > > Em sex., 11 de abr. de 2025 às 02:09, Michael Paquier > escreveu: > >> On Thu, Apr 10, 2025 at 03:10:02PM -0300, Ranier Vilela wrote: >> > While it is argu

Re: Non-text mode for pg_dumpall

2025-04-12 Thread Ranier Vilela
Hi Andrew. I just saw the fix commit. My fault. I'm sorry. best regards, Ranier Vilela

Re: Silence resource leaks alerts

2025-04-11 Thread Ranier Vilela
Em sex., 11 de abr. de 2025 às 02:37, Tom Lane escreveu: > Michael Paquier writes: > > On Thu, Apr 10, 2025 at 03:10:02PM -0300, Ranier Vilela wrote: > >> While it is arguable that this is a false warning, there is a benefit in > >> moving the initialization of the s

Re: Silence resource leaks alerts

2025-04-11 Thread Ranier Vilela
Thanks Michael, for looking at this. Em sex., 11 de abr. de 2025 às 02:09, Michael Paquier escreveu: > On Thu, Apr 10, 2025 at 03:10:02PM -0300, Ranier Vilela wrote: > > While it is arguable that this is a false warning, there is a benefit in > > moving the initialization of th

Re: Non-text mode for pg_dumpall

2025-04-10 Thread Ranier Vilela
Em qui., 10 de abr. de 2025 20:09, Andrew Dunstan escreveu: > > On 2025-04-10 Th 5:45 PM, Ranier Vilela wrote: > > > Em qui., 10 de abr. de 2025 às 15:58, Andrew Dunstan > escreveu: > >> >> On 2025-04-10 Th 2:38 PM, Ranier Vilela wrote: >> >> >&

Re: Non-text mode for pg_dumpall

2025-04-10 Thread Ranier Vilela
Em qui., 10 de abr. de 2025 às 15:58, Andrew Dunstan escreveu: > > On 2025-04-10 Th 2:38 PM, Ranier Vilela wrote: > > >> >> Thanks. I have pushed these now with a few further small tweaks. >> > Sorry if it is not the right place. > Coverity has another re

Re: Non-text mode for pg_dumpall

2025-04-10 Thread Ranier Vilela
.com > > Thanks Andrew for the updated patches. > > Here, I am attaching a delta patch with some more TAP-test cases. > > > Here, I am attaching an updated delta patch which has some more TAP > tests. Please include these tests also. This patch can be applied on &g

Silence resource leaks alerts

2025-04-10 Thread Ranier Vilela
. ruleutils.c best regards, Ranier Vilela postpone_string_buffer_creation_pg_overexplain.patch Description: Binary data postpone_string_buffer_creation_ruleutils.patch Description: Binary data

Re: Possible api miuse bms_next_member

2025-04-09 Thread Ranier Vilela
Em qua., 9 de abr. de 2025 às 10:27, Matthias van de Meent < boekewurm+postg...@gmail.com> escreveu: > On Wed, 9 Apr 2025 at 15:01, Ranier Vilela wrote: > > > > Hi. > > > > Per Coverity. > > > > CID 1608872: (#1 of 1): Improper use of negative valu

Possible api miuse bms_next_member

2025-04-09 Thread Ranier Vilela
fdw.c Function: postgresBeginForeignScan Check the return of bms_next_member and abort if fail. Function: postgresExplainForeignScan Check the return of bms_next_member and abort if fail. The patchs are attempts, not definitive fixes. best regards, Ranier Vilela avoid-miuse-api-bms_next_member-equivclass.patch Descr

Re: Show WAL write and fsync stats in pg_stat_io

2025-04-05 Thread Ranier Vilela
<http://a051e71e28a12342a4fb39a3c149a197159f9c46> I think it left an oversight. Copy and past thinko? Attached a trivial patch. best regards, Ranier Vilela fix-possible-copy-and-paste-thinko.patch Description: Binary data

Re: AIO v2.5

2025-04-03 Thread Ranier Vilela
Em qui., 3 de abr. de 2025 às 15:35, Andres Freund escreveu: > Hi, > > On 2025-04-03 13:46:39 -0300, Ranier Vilela wrote: > > Em qua., 2 de abr. de 2025 às 08:58, Andres Freund > > escreveu: > > > > > Hi, > > > > > > I've pushed fixes

Re: AIO v2.5

2025-04-03 Thread Ranier Vilela
initialize the *result* field. 2. result_one can be reduced scope. best regards, Ranier Vilela

Re: libpq support for NegotiateProtocolVersion

2025-04-03 Thread Ranier Vilela
Coverity alert is valid. The function never returns 0. best regards, Ranier Vilela

Re: Small optimization set tuple block/tableOid once

2025-04-03 Thread Ranier Vilela
rebased heapam.c and heapam_handler.c best regards, Ranier Vilela v1-heapam_set_tuple_block_once.patch Description: Binary data v1-heapam_handler_set_tuple_block_once.patch Description: Binary data

Small optimization set tuple block/tableOid once

2025-04-02 Thread Ranier Vilela
_visibility.c contrib/pgstattuple/pgstatapprox.c src/backend/access/heap/heapam.c src/backend/access/heap/heapam_handler.c src/backend/access/heap/pruneheap.c src/backend/access/heap/vacuumlazy.c src/backend/commands/dbcommands.c Attached all patchs. best regards, Ranier Vilela [1] Re: AIO writes vs h

Re: Small memory fixes for pg_createsubcriber

2025-04-01 Thread Ranier Vilela
Em ter., 1 de abr. de 2025 às 15:39, Noah Misch escreveu: > On Thu, Feb 27, 2025 at 10:23:31AM -0300, Ranier Vilela wrote: > > Em qui., 27 de fev. de 2025 às 02:51, Michael Paquier < > mich...@paquier.xyz> > > escreveu: > > > > > On Tue, Feb 25, 2025 a

Re: Small memory fixes for pg_createsubcriber

2025-04-01 Thread Ranier Vilela
Em ter., 1 de abr. de 2025 às 15:39, Noah Misch escreveu: > On Thu, Feb 27, 2025 at 10:23:31AM -0300, Ranier Vilela wrote: > > Em qui., 27 de fev. de 2025 às 02:51, Michael Paquier < > mich...@paquier.xyz> > > escreveu: > > > > > On Tue, Feb 25, 2025 a

Re: Allow default \watch interval in psql to be configured

2025-03-27 Thread Ranier Vilela
dae11ee5da8318b646b9d47129c> left a minor oversight. Typo comparison? a trivial fix attached. best regards, Ranier Vilela fix-typo-comparison-variables.patch Description: Binary data

Re: Removing unneeded self joins

2025-03-21 Thread Ranier Vilela
case of > > duplicated clause in regression tests. > > > > I've changed 'inner' and 'outer' vise versa in > > remove_self_joins_one_group() for better readability (I believe that > > was discussed upthread but lost). Also, I did a round of improvement > > for comments and commit message. > > I've corrected some spelling error reported by Alexander Lakhin > privately to me. Also, I've revised comments around ChangeVarNodes() > and ChangeVarNodesExtended(). I'm going to continue nitpicking this > patch during next couple days then push it if no objections. > I think a small optimization is possible here. The whole block that append *rinfo* to exprs is controlled by extra_clause not NULL. So It's worth moving the test to the beginning of the block and avoiding it altogether if that's the case. trivial patch attached. best regards, Ranier Vilela avoid-expensive-function-indxpath.patch Description: Binary data

Re: Show WAL write and fsync stats in pg_stat_io

2025-03-19 Thread Ranier Vilela
t makes queries of pg_stat_io a bit cheaper. Will fix in a bit. > Thank you Michael. best regards, Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-18 Thread Ranier Vilela
Em seg., 17 de mar. de 2025 às 16:17, Ranier Vilela escreveu: > Em sex., 7 de mar. de 2025 às 16:14, Ranier Vilela > escreveu: > >> >> >> Em sex., 7 de mar. de 2025 às 16:01, Álvaro Herrera < >> alvhe...@alvh.no-ip.org> escreveu: >> >>> On 2

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-18 Thread Ranier Vilela
Em seg., 17 de mar. de 2025 às 16:17, Ranier Vilela escreveu: > Em sex., 7 de mar. de 2025 às 16:14, Ranier Vilela > escreveu: > >> >> >> Em sex., 7 de mar. de 2025 às 16:01, Álvaro Herrera < >> alvhe...@alvh.no-ip.org> escreveu: >> >>> On 2

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-17 Thread Ranier Vilela
Em sex., 7 de mar. de 2025 às 16:14, Ranier Vilela escreveu: > > > Em sex., 7 de mar. de 2025 às 16:01, Álvaro Herrera < > alvhe...@alvh.no-ip.org> escreveu: > >> On 2025-Mar-07, Álvaro Herrera wrote: >> >> > Anyway, my version of this is attached.

Re: table_tuple_lock's snapshot argument

2025-03-11 Thread Ranier Vilela
's no guarantee that the index scan > found the same row version that table_tuple_lock() will lock, if the TID > alone doesn't uniquely identify it. But that's still OK as long as the > key column hasn't changed, like with heapam's HOT updates. I couldn't > convince myself that it's broken nor that it's guaranteed to be correct > with other AMs. > Just for curiosity. *RelationFindReplTupleSeq* on the same source, does not suffer from the same issue? PushActiveSnapshot(GetLatestSnapshot()); res = table_tuple_lock(rel, &(outslot->tts_tid), GetLatestSnapshot(), best regards, Ranier Vilela

Re: table_tuple_lock's snapshot argument

2025-03-11 Thread Ranier Vilela
Em seg., 10 de mar. de 2025 às 13:52, Heikki Linnakangas escreveu: > On 10/03/2025 18:20, Ranier Vilela wrote: > > Just for curiosity. > > *RelationFindReplTupleSeq* on the same source, does not suffer > > from the same issue? > > > > PushActiveSnapshot(

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-07 Thread Ranier Vilela
nfig('search_path', '', false); REINDEX INDEX public.bar1; RESET search_path; SELECT c.relname, ns.nspname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace ns WHERE c.relnamespace OPERATOR(pg_catalog.=) ns.oid AND c.oid OPERATOR(pg_catalog.=) 'public.bar2'::pg_catalog.regclass; SELECT pg_catalog.set_config('search_path', '', false); REINDEX INDEX public.bar2; best regards, Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-07 Thread Ranier Vilela
de espacios en blanco. > > > Anyway, my version of this is attached. It fixes the problems with your > patch, but not Orlov's fundamental bug. Without fixing that bug, this > program does not deserve this supposedly parallel mode that doesn't > actually deliver. I wonder if we shouldn't just revert 47f99a407de2 > completely. > > You, on the other hand, really need to be much more careful with the > patches you submit. > Yes of course, thank you for making the necessary corrections. best regards, Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-03-07 Thread Ranier Vilela
Em qui., 6 de mar. de 2025 às 15:51, Álvaro Herrera escreveu: > On 2025-Feb-28, Ranier Vilela wrote: > > > v2 attached, please comment if you have any further objections. > > I think running the tests would have been a good idea, as would checking > for compiler warnin

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-02-28 Thread Ranier Vilela
Hi Álvaro. Em qui., 27 de fev. de 2025 às 16:50, Álvaro Herrera < alvhe...@alvh.no-ip.org> escreveu: > On 2025-Feb-14, Ranier Vilela wrote: > > > Attached is the prototype version v1. > > What do you think? > > I think this is still a bit confused. The new function

Re: Small memory fixes for pg_createsubcriber

2025-02-28 Thread Ranier Vilela
Em qui., 27 de fev. de 2025 às 22:19, Michael Paquier escreveu: > On Thu, Feb 27, 2025 at 10:23:31AM -0300, Ranier Vilela wrote: > > Yeah, I also think it would look good like this. > > It's the least confusing option, indeed. I've reduced a bit the diffs > and d

Re: Confine vacuum skip logic to lazy_scan_skip

2025-02-27 Thread Ranier Vilela
used when per buffer data is used. Adding a check > for > > per_buffer_data and assigning something to it is nonsensical. > Perhaps. But the fast path and the parameter void **per_buffer_data, IMHO, is a serious risk in my opinion. Of course, when in runtime. best regards, Ranier Vilela

Re: Confine vacuum skip logic to lazy_scan_skip

2025-02-27 Thread Ranier Vilela
; failed to do what we expect and did not set per_buffer_data, > > we'd be certain to get a null-pointer core dump rather than > > accessing data from a previous buffer. > > Done and pushed. Thanks! > Per Coverity. CID 1592454: (#1 of 1): Explicit null dereferenced (FORW

Re: Small memory fixes for pg_createsubcriber

2025-02-27 Thread Ranier Vilela
Em qui., 27 de fev. de 2025 às 02:51, Michael Paquier escreveu: > On Tue, Feb 25, 2025 at 08:54:31AM -0300, Ranier Vilela wrote: > > @@ -455,7 +455,9 @@ set_locale_and_encoding(void) > > locale->db_locale, > > strlen(locale->db_locale)); > > else > >

Re: Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

2025-02-27 Thread Ranier Vilela
Em qui., 27 de fev. de 2025 às 02:08, Michael Paquier escreveu: > On Wed, Feb 26, 2025 at 07:04:25PM +0530, vignesh C wrote: > > On Tue, 18 Feb 2025 at 18:18, Ranier Vilela wrote: > >> Similar to commit 5b94e27 [1] > >> The correct function when freeing memory in t

Re: Small memory fixes for pg_createsubcriber

2025-02-25 Thread Ranier Vilela
nd_encoding(void) locale->db_locale, strlen(locale->db_locale)); else - datlocale_literal = pg_strdup("NULL"); + datlocale_literal = PQescapeLiteral(conn_new_template1, + "NULL", + strlen("NULL")); best regards, Ranier Vilela avoid-mix-api-pg_upgrade.patch Description: Binary data

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-02-21 Thread Ranier Vilela
Em sex., 14 de fev. de 2025 às 10:19, Ranier Vilela escreveu: > Em sex., 14 de fev. de 2025 às 09:13, Ranier Vilela > escreveu: > >> Hi Álvaro. >> >> Em qui., 13 de fev. de 2025 às 18:38, Álvaro Herrera < >> alvhe...@alvh.no-ip.org> escreveu: >

Re: Improve cleaning files on Postgres crashes

2025-02-19 Thread Ranier Vilela
Em qua., 19 de fev. de 2025 às 14:48, Ranier Vilela escreveu: > Em ter., 18 de fev. de 2025 às 13:29, Ranier Vilela > escreveu: > >> >> Em ter., 18 de fev. de 2025 13:21, Tom Lane escreveu: >> >>> Ranier Vilela writes: >>> > There are some

Re: Improve cleaning files on Postgres crashes

2025-02-19 Thread Ranier Vilela
Em ter., 18 de fev. de 2025 às 13:29, Ranier Vilela escreveu: > > Em ter., 18 de fev. de 2025 13:21, Tom Lane escreveu: > >> Ranier Vilela writes: >> > There are some reports that Postgres does not handle correctly cleaning >> the >> > files used when it

Re: Improve cleaning files on Postgres crashes

2025-02-18 Thread Ranier Vilela
Em ter., 18 de fev. de 2025 13:21, Tom Lane escreveu: > Ranier Vilela writes: > > There are some reports that Postgres does not handle correctly cleaning > the > > files used when it crashes. [1] > > I think that function *fcloseall* can help a little bit. > > M

Improve cleaning files on Postgres crashes

2025-02-18 Thread Ranier Vilela
files created by tmpfile function. */ patch attached. best regards, Ranier Vilela [1] https://www.postgresql.org/message-id/CAE9k0Pno%3DMns7J5HA4%2BbbXzb%3DyCZnCtSF_wf1ZipCQxardKDjA%40mail.gmail.com improve-cleaning-on-fatal-and-panic-elog.patch Description: Binary data

Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

2025-02-18 Thread Ranier Vilela
Hi. Similar to commit 5b94e27 <http://5b94e2753439b699b78aacbb53e89bf0e814becc> [1] The correct function when freeing memory in the frontend, using the function PQescapeIdentifier, must be PQfreemem. Trivial patch attached. best regards, Ranier Vilela [1] https://www.postgresql.org/mess

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-02-14 Thread Ranier Vilela
Em sex., 14 de fev. de 2025 às 09:13, Ranier Vilela escreveu: > Hi Álvaro. > > Em qui., 13 de fev. de 2025 às 18:38, Álvaro Herrera < > alvhe...@alvh.no-ip.org> escreveu: > >> On 2025-Feb-13, Ranier Vilela wrote: >> >> > Hi. >> > >> >

Re: pg17.3 PQescapeIdentifier() ignores len

2025-02-14 Thread Ranier Vilela
done under extreme time > pressure. I wonder if they have any other issues. More eyes on those > patches would be welcome, now that they are public. > Passes on standard tests at Windows 64 bits, msvc 2022 64 bits. best regards, Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-02-14 Thread Ranier Vilela
Hi Álvaro. Em qui., 13 de fev. de 2025 às 18:38, Álvaro Herrera < alvhe...@alvh.no-ip.org> escreveu: > On 2025-Feb-13, Ranier Vilela wrote: > > > Hi. > > > > Coverity complained about possible dereference null pointer > > in *reindex_one_database* function.

Re: pg17.3 PQescapeIdentifier() ignores len

2025-02-13 Thread Ranier Vilela
Em qui., 13 de fev. de 2025 às 16:05, Tom Lane escreveu: > Ranier Vilela writes: > > Interesting, Coverity has some new reports regarding PQescapeIdentifier. > > > CID 1591290: (#1 of 1): Out-of-bounds access (OVERRUN) > > 2. alloc_strlen: Allocating insufficient memory

Re: pg17.3 PQescapeIdentifier() ignores len

2025-02-13 Thread Ranier Vilela
> len. > Interesting, Coverity has some new reports regarding PQescapeIdentifier. CID 1591290: (#1 of 1): Out-of-bounds access (OVERRUN) 2. alloc_strlen: Allocating insufficient memory for the terminating null of the string. [Note: The source code implementation of the function has been overridden by a builtin model.] Until now, I was in disbelief. best regards, Ranier Vilela

Simplify the logic a bit (src/bin/scripts/reindexdb.c)

2025-02-13 Thread Ranier Vilela
Hi. Coverity complained about possible dereference null pointer in *reindex_one_database* function. That's not really true. But the logic is unnecessarily complicated. Let's simplify it to humans and machines. patch attached. Best regards, Ranier Vilela simplifies-reindex-on

Re: Small memory fixes for pg_createsubcriber

2025-02-13 Thread Ranier Vilela
Em qua., 12 de fev. de 2025 às 18:17, Tom Lane escreveu: > Ranier Vilela writes: > > Coverity has some reports about pg_createsubcriber. > > > CID 1591322: (#1 of 1): Resource leak (RESOURCE_LEAK) > > 10. leaked_storage: Variable dbname going out of scope leaks the st

Re: Small memory fixes for pg_createsubcriber

2025-02-12 Thread Ranier Vilela
patch attached. Another *dat->amcheck_schema* is it not worth the effort, since the memory is not released at any point? Trivial patch attached. best regards, Ranier Vilela fix-api-misuse-pg_amcheck.patch Description: Binary data

Re: Small memory fixes for pg_createsubcriber

2025-02-12 Thread Ranier Vilela
lled once per database in > setup_subscriber(), and we are not going to have millions of them in > this list. We don't usually care for such short-lived things, but as > the original commit did the effort in d44032d01463, I don't see why we > cannot do it here, either. > Thanks Michael. best regards, Ranier Vilela

Fix possible resource leak (src/bin/pg_basebackup/pg_receivewal.c)

2025-02-11 Thread Ranier Vilela
Hi. Per Coverity. CID 1591288: (#1 of 1): Resource leak (RESOURCE_LEAK) 10. leaked_storage: Variable sysidentifier going out of scope leaks the storage it points to. Trivial patch attached. best regards, Ranier Vilela fix-resource-leak-pg_receivewal.patch Description: Binary data

Small memory fixes for pg_createsubcriber

2025-02-10 Thread Ranier Vilela
Postgres API. According to the documentation: libpq-exec <https://www.postgresql.org/docs/current/libpq-exec.html> The correct function to free memory when using PQescapeLiteral and PQescapeIdentifier would be PQfreemem. Trivial fixes attached. best regards, Ranier Vilela fix-resourc

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-06 Thread Ranier Vilela
Em qua., 5 de fev. de 2025 às 15:56, Tom Lane escreveu: > So I don't > find it to be an improvement. > Ok, I'm withdrawing this patch. Thanks to everyone who contributed to the thread. best regards, Ranier Vilela

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
Hi. Em qua., 5 de fev. de 2025 às 14:08, Daniel Gustafsson escreveu: > > On 5 Jan 2025, at 00:29, Ranier Vilela wrote: > > > > Hi. > > > > Per Coverity. > > > > All call sites of function *get_cheapest_path_for_pathkeys* checks > > for NULL r

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
gt; if (cheapset == NULL || bms(PATH_REQ_OUTER(cheapset), required_outer)) > return cheapest; > I think no in this case. If cheapset is NULL, the logic is to continue the find. What cannot happen is passing a null pointer to bms(PATH_REQ_OUTER. best regards, Ranier Vilela

Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

2025-02-05 Thread Ranier Vilela
Hi. Em qua., 5 de fev. de 2025 às 13:51, Ilia Evdokimov < ilya.evdoki...@tantorlabs.com> escreveu: > > On 05.01.2025 02:29, Ranier Vilela wrote: > > Hi. > > > > Per Coverity. > > > > All call sites of function *get_cheapest_path_for_pathkeys* checks >

Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)

2025-01-17 Thread Ranier Vilela
Em sex., 17 de jan. de 2025 às 05:11, Peter Eisentraut escreveu: > On 16.01.25 11:23, Ranier Vilela wrote: > > > > > > Em qui., 16 de jan. de 2025 às 05:07, Peter Eisentraut > > mailto:pe...@eisentraut.org>> escreveu: > > > > On 16.01.25 02:12,

Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)

2025-01-16 Thread Ranier Vilela
Em qui., 16 de jan. de 2025 às 05:07, Peter Eisentraut escreveu: > On 16.01.25 02:12, Ranier Vilela wrote: > > Per Coverity. > > > > CID 1590024:(CHECKED_RETURN) > > Calling "pg_b64_encode" without checking return value (as is done > > elsewhe

Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)

2025-01-15 Thread Ranier Vilela
ther calls check the return, In this case it could not be different. Fix by checking the return and reporting a message to the user, in case of failure. best regards, Ranier Vilela [0] I think the most correct would be *or* not *and* word? fix-misuse-function-pg_b64_encode.patch Description: Binary data

Re: Purpose of wal_init_zero

2025-01-15 Thread Ranier Vilela
re WALWriteLock is waited and the > holder is running WAIT_EVENT_WAL_INIT_WRITE. > Can you report the benchmark difference with false (disabled)? Maybe It's worth considering leaving false as the default. best regards, Ranier Vilela

Re: [PATCH] Hex-coding optimizations using SVE on ARM.

2025-01-15 Thread Ranier Vilela
dcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" ; +static const char hextbl[512] = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" ; best regards, Ranier Vilela

  1   2   3   4   5   6   7   8   9   10   >