Re: How to properly fix memory leak

2025-04-25 Thread David G. Johnston
On Friday, April 25, 2025, Igor Korot wrote: > > for( int i = 0; i < PQntuples( res ); i++ ) > { > auto temp1 = m_pimpl->m_myconv.from_bytes( PQgetvalue( > res, i, 1 ) ); > m_tablespaces.push_back( temp1 ); > } // this line gives a leak according to

How to properly fix memory leak

2025-04-25 Thread David G. Johnston
On Friday, April 25, 2025, Igor Korot wrote: > > And the error case was handled correctly, right? > Seems like answering that requires knowing what the query is or can be. I also have no idea what idiomatic code looks like. Though, I’d probably use PQresultErrorMessage and check affirmatively

Re: How to properly fix memory leak

2025-04-25 Thread Igor Korot
Hi, David, On Fri, Apr 25, 2025 at 10:48 PM David G. Johnston wrote: > > On Friday, April 25, 2025, Igor Korot wrote: >> >> >> for( int i = 0; i < PQntuples( res ); i++ ) >> { >> auto temp1 = m_pimpl->m_myconv.from_bytes( PQgetvalue( >> res, i, 1 ) ); >> m

Re: How to properly fix memory leak

2025-04-25 Thread Igor Korot
Hi, David, On Fri, Apr 25, 2025 at 11:55 PM David G. Johnston wrote: > > On Friday, April 25, 2025, Igor Korot wrote: >> >> >> And the error case was handled correctly, right? > > > Seems like answering that requires knowing what the query is or can be. I > also have no idea what idiomatic cod

How to properly fix memory leak

2025-04-25 Thread Igor Korot
Hi, ALL, [code] auto res = PQexec( m_db, m_pimpl->m_myconv.to_bytes( query.c_str() ).c_str() ); /* ask for binary results */ if( PQresultStatus( res ) != PGRES_TUPLES_OK ) { auto err = m_pimpl->m_myconv.from_bytes( PQerrorMessage( m_db ) ); errorMsg.push_back( L"Up

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:01 PM Vydehi Ganti wrote: > Then it should build up the lPredicate with the filter condition and append > to the query user runs on the Activity table. You're not reading us, and asking us to do the work for you... RLS Predicates don't return strings in PostgreSQL, but

Re: Clarification on RLS policy

2025-04-25 Thread Vydehi Ganti
So I don't have a possibility to append where clause dynamically and can only check the boolean? On Fri, 25 Apr, 2025, 18:48 Dominique Devienne, wrote: > On Fri, Apr 25, 2025 at 3:01 PM Vydehi Ganti wrote: > > Then it should build up the lPredicate with the filter condition and > append to the

shared buffers

2025-04-25 Thread Marc Millas
hello, got something strange to me: Same db ie. same data, around 1.2TB,one on pg13, one on pg16 same 16 GB of shared_buffers, I am the single user. both have track_io_timing on on pg13, if I run a big request with explain (analyze,buffers), I see around 6 GB read if I do rerun the very same requ

Re: Clarification on RLS policy

2025-04-25 Thread Adrian Klaver
On 4/25/25 06:01, Vydehi Ganti wrote: This is my Scenario: *Can you please guide how to achieve this?* CREATE OR REPLACE FUNCTION one.get_country( powner name, ptable_name name)     RETURNS character varying LANGUAGE 'plpgsql' For the below policy statement it created the policy but i c

Re: Clarification on RLS policy

2025-04-25 Thread Laurenz Albe
On Fri, 2025-04-25 at 12:38 +0530, Vydehi Ganti wrote: > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, > compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > I have a scenario where > 1.I need to enforce RLS policy on a table for Select by calling a Functi

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 2:43 PM Laurenz Albe wrote: > On Fri, 2025-04-25 at 12:38 +0530, Vydehi Ganti wrote: > > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, > > compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > > 2.The function would return a charact

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:21 PM Vydehi Ganti wrote: > So I don't have a possibility to append where clause dynamically and can only > check the boolean? Indeed. But given that you can run arbitrary SQL inside the function, even dynamic SQL, that ends up pretty much the same. And you have access

Re: Clarification on RLS policy

2025-04-25 Thread Vydehi Ganti
Can i know if there is any scenario or ref document for the design you suggested above? On Fri, 25 Apr, 2025, 18:56 Dominique Devienne, wrote: > On Fri, Apr 25, 2025 at 3:21 PM Vydehi Ganti wrote: > > So I don't have a possibility to append where clause dynamically and can > only check the bool

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:29 PM Vydehi Ganti wrote: > Can i know if there is any scenario or ref document for the design you > suggested above? Some docs: https://www.postgresql.org/docs/current/ddl-rowsecurity.html https://satoricyber.com/postgres-security/postgres-row-level-security/ Your Ora

replication

2025-04-25 Thread Marc Millas
Hello, One of my customers tells me he did a replication with the master on a debian 10 and the slave on a debian 12, both with a pg13.20, one on a pgdg110+1, the other a pgdg120.1 is this a good idea ??? (I don't think so...) thanks, Marc MILLAS Senior Architect +33607850334

Re: Clarification on RLS policy

2025-04-25 Thread Achilleas Mantzios - cloud
On 4/25/25 14:01, Vydehi Ganti wrote: This is my Scenario: CREATE OR REPLACE FUNCTION one.get_country( powner name, ptable_name name)     RETURNS character varying LANGUAGE 'plpgsql'     COST 100     STABLE PARALLEL UNSAFE AS $BODY$ DECLARE     lOSUser         varchar(4000) := UPPER(SUBSTR

Re: replication

2025-04-25 Thread Achilleas Mantzios - cloud
On 4/25/25 14:50, Marc Millas wrote: Hello, One of my customers tells me he did a replication with the master on a debian 10 and the slave on a debian 12, both with a pg13.20, one on a pgdg110+1, the other a pgdg120.1 is this a good idea ??? (I don't think so...) Sorry I dont quite get t

Re: Clarification on RLS policy

2025-04-25 Thread Achilleas Mantzios - cloud
On 4/25/25 08:08, Vydehi Ganti wrote: Hi Team, We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit I have a scenario where 1.I need to enforce RLS policy on a table for Select by calling a Function 2.The f

Clarification on RLS policy

2025-04-25 Thread Vydehi Ganti
Hi Team, We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit I have a scenario where 1.I need to enforce RLS policy on a table for Select by calling a Function 2.The function would return a character varying str

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 9:09 AM Vydehi Ganti wrote: > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, > compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > I have a scenario where > 1.I need to enforce RLS policy on a table for Select by calling a Function

Re: shared buffers

2025-04-25 Thread Marc Millas
Sorry, 'someone' launches some kind of batches without telling. Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Fri, Apr 25, 2025 at 3:42 PM Marc Millas wrote: > hello, > > got something strange to me: > Same db ie. same data, around 1.2TB,one on pg13, one on pg16 > same 16 GB of

Re: Clarification on RLS policy

2025-04-25 Thread Vydehi Ganti
This is my Scenario: I would need a policy on table Activity which has a column country_code . In the policy i would need to call a function get_country as below which queries the users table based on current user and checks which country code that user has access to. Then it should build up the l

Re: shared buffers

2025-04-25 Thread Laurenz Albe
On Fri, 2025-04-25 at 15:42 +0200, Marc Millas wrote: > got something strange to me: > Same db ie. same data, around 1.2TB,one on pg13, one on pg16 > same 16 GB of shared_buffers, > I am the single user. > both have track_io_timing on > > on pg13, if I run a big request with explain (analyze,buffe