Re: Quesion about querying distributed databases

2025-03-04 Thread Laurenz Albe
On Wed, 2025-03-05 at 10:12 +0330, me nefcanto wrote: > Adrian Klaver, thank you for the link. I asked the AI to create a query for > me using FDW. > > The problem here is that it collects all of the product_id values from the > ItemCategories table [...] > > That's not scalable. Is there a wor

Re: Quesion about querying distributed databases

2025-03-04 Thread me nefcanto
Adrian Klaver, thank you for the link. I asked the AI to create a query for me using FDW. This is the sample query: with filtered_products as ( select p.product_id from products.product p where p.title ilike '%search_term%' ), category_filtered as ( select ic.product_id from t

Re: Quesion about querying distributed databases

2025-03-04 Thread Adrian Klaver
On 3/4/25 20:40, me nefcanto wrote: Hello Consider this scenario: * 3 servers, 3 databases, each on a separate server: o *Products database*: Contains the *Products* table (with over 100,000 records). o *Taxonomy database*: Contains the *Categories* and *ItemCatego

Quesion about querying distributed databases

2025-03-04 Thread me nefcanto
Hello Consider this scenario: - 3 servers, 3 databases, each on a separate server: - *Products database*: Contains the *Products* table (with over 100,000 records). - *Taxonomy database*: Contains the *Categories* and *ItemCategories (EAV)* tables. - *Attributes d

Re: Error on query execution

2025-03-04 Thread Tom Lane
Igor Korot writes: > binaryIntVal = htonl( (uint32_t) type ); > paramValues[0] = (char *) &binaryIntVal; > paramLengths[0] = sizeof( binaryIntVal ); > paramFormats[0] = 1; You're apparently trying to pass this parameter as an int4 ... > res = PQexecParams( m_db, "SELECT * FRO

Error on query execution

2025-03-04 Thread Igor Korot
Hi, ALL, [code] type = 80; uint32_t binaryIntVal; const char *paramValues[1]; int paramLengths[1]; int paramFormats[1]; binaryIntVal = htonl( (uint32_t) type ); paramValues[0] = (char *) &binaryIntVal; paramLengths[0] = sizeof( binaryIntVal ); paramFormats[0] = 1

Re: Messages o Terminal

2025-03-04 Thread Igor Korot
Please ignore my previous message Works like a charm. Thank you. On Tue, Mar 4, 2025 at 7:13 PM Adrian Klaver wrote: > > On 3/4/25 22:28, Igor Korot wrote: > > Hi, ALL, > > I'm trying to execute: > > > > [code] > > queries.push_back( L"CREATE TABLE IF NOT EXISTS .. > > [/code] > >

Re: Messages o Terminal

2025-03-04 Thread Igor Korot
Adran, On Tue, Mar 4, 2025 at 7:13 PM Adrian Klaver wrote: > > On 3/4/25 22:28, Igor Korot wrote: > > Hi, ALL, > > I'm trying to execute: > > > > [code] > > queries.push_back( L"CREATE TABLE IF NOT EXISTS .. > > [/code] > > > > However, when I run my profeam second tme I see n the Termin

Re: Messages o Terminal

2025-03-04 Thread Adrian Klaver
On 3/4/25 22:28, Igor Korot wrote: Hi, ALL, I'm trying to execute: [code] queries.push_back( L"CREATE TABLE IF NOT EXISTS .. [/code] However, when I run my profeam second tme I see n the Terminal: [quote] NOTICE: relation "abcatcol" already exists, skipping [/quote] Is there any way

Re: Messages o Terminal

2025-03-04 Thread David G. Johnston
On Tue, Mar 4, 2025 at 6:07 PM Igor Korot wrote: > [quote] > NOTICE: relation "abcatcol" already exists, skipping > [/quote] > > Is there any way to suppress this NOTICE message? > > Specifically, no. Any notice message, yes. https://www.postgresql.org/docs/current/runtime-config-client.html#RU

Re: [EXT] Re: Get CTID from within an OUTPUT/SEND function

2025-03-04 Thread Garfield Lewis
Garfield Lewis writes: > > I would like to know if it is possible to get the CTID from within > > the OUTPUT and SEND functions of a CREATE TYPE? > > No. A datatype output function has no reason to expect that the value > it's handed has ever been in a table at all. > > regar

Messages o Terminal

2025-03-04 Thread Igor Korot
Hi, ALL, I'm trying to execute: [code] queries.push_back( L"CREATE TABLE IF NOT EXISTS .. [/code] However, when I run my profeam second tme I see n the Terminal: [quote] NOTICE: relation "abcatcol" already exists, skipping [/quote] Is there any way to suppress this NOTICE message? Tha

Re: Get CTID from within an OUTPUT/SEND function

2025-03-04 Thread Tom Lane
Garfield Lewis writes: > I would like to know if it is possible to get the CTID from within > the OUTPUT and SEND functions of a CREATE TYPE? No. A datatype output function has no reason to expect that the value it's handed has ever been in a table at all. regards, tom l

Get CTID from within an OUTPUT/SEND function

2025-03-04 Thread Garfield Lewis
I would like to know if it is possible to get the CTID from within the OUTPUT and SEND functions of a CREATE TYPE? I’ve found a function called currtid_byrelname and the comment in the function prolog says it is to get a CTID but I cannot find any example usage of it. Regards, Garfield

Re: Version compatibility

2025-03-04 Thread Adrian Klaver
On 3/4/25 13:05, Igor Korot wrote: Hi, Adrian, tells you what the problem is, the software is too old. Which one? The driver or DM? I don't know enough about Gentoo to say. If it where me I would upgrade both unixODBC and the Postgres driver to the latest that is supported for the di

Re: Version compatibility

2025-03-04 Thread Igor Korot
Hi, Adrian, On Tue, Mar 4, 2025, 3:00 PM Adrian Klaver wrote: > > > On 3/4/25 3:00 PM, Igor Korot wrote: > > Hi, Adrian, > > > > On Sat, Mar 1, 2025 at 7:06 PM Adrian Klaver > wrote: > >> > >> On 3/ > >> > >> Did the connection work after making the change? > > > > Sorry somehow missed that rep

Re: Version compatibility

2025-03-04 Thread Adrian Klaver
On 3/4/25 3:00 PM, Igor Korot wrote: Hi, Adrian, On Sat, Mar 1, 2025 at 7:06 PM Adrian Klaver wrote: On 3/ Did the connection work after making the change? Sorry somehow missed that reply, No still getting the same error... This thread: https://forums.gentoo.org/viewtopic-p-8856135.

Re: Version compatibility

2025-03-04 Thread Igor Korot
Hi, Adrian, On Sat, Mar 1, 2025 at 7:06 PM Adrian Klaver wrote: > > On 3/1/25 21:17, Igor Korot wrote: > > >> > >> Do you have a $HOME/.odbc.ini? > >> > >> Also in odbc.ini, per man odbc.ini, I believe you have to have something > >> like: > >> > >> [ODBC Data Sources] > >> Postgresql = This is m

Re: Error on the query

2025-03-04 Thread Igor Korot
Hi, Pavel, On Tue, Mar 4, 2025 at 11:36 AM Pavel Stehule wrote: > > Hi > > út 4. 3. 2025 v 18:30 odesílatel Igor Korot napsal: >> >> Hi, ALL, >> Trying to execute following query: >> >> [code] >> queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM >> pg_class c, pg_namespace n

Re: Error on the query

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, Igor Korot wrote: > > [code] > queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM > pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname > = \'abcatc_x\' AND n.nspname = \'public\' ) THEN CREATE UNIQUE INDEX > \"abcatc_x\" ON \"abcatco

Re: Error on the query

2025-03-04 Thread Pavel Stehule
Hi út 4. 3. 2025 v 18:30 odesílatel Igor Korot napsal: > Hi, ALL, > Trying to execute following query: > > [code] > queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM > pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname > = \'abcatc_x\' AND n.nspname = \'pub

Error on the query

2025-03-04 Thread Igor Korot
Hi, ALL, Trying to execute following query: [code] queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname = \'abcatc_x\' AND n.nspname = \'public\' ) THEN CREATE UNIQUE INDEX \"abcatc_x\" ON \"abcatcol\"(\"abc_tna

Re: Review my steps for rollback to restore point

2025-03-04 Thread chandan Kumar
Hi David, You catched my word "revert". Thats so encouraging to see how this community helps. Your answer has cleared my 99% doubt. Thanks again. I wish I also contribute one day . Have a good time! On Tue, Mar 4, 2025 at 9:08 PM David G. Johnston wrote: > On Tuesday, March 4, 2025, chandan Kum

Re: Review my steps for rollback to restore point

2025-03-04 Thread chandan Kumar
Thank you ! On Tue, Mar 4, 2025 at 9:08 PM Ron Johnson wrote: > Chandran, > > >1. For PITR, you should use a tool like PgBackRest. It handles all >$PGDATA and WAL archiving. It's multithreaded, too, >2. pg_restore is just for logical backups. >3. Streaming Replication is for *h

Re: Review my steps for rollback to restore point

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, chandan Kumar wrote: > Thank you for your time and clarification. > Does PITR recreate database internally ? can i say it is not the same as > pg_restore or it is same as pg_restore plus applying WAL on top of it. I > am asking because can we revern DDL operations wi

Re: Review my steps for rollback to restore point

2025-03-04 Thread Ron Johnson
Chandran, 1. For PITR, you should use a tool like PgBackRest. It handles all $PGDATA and WAL archiving. It's multithreaded, too, 2. pg_restore is just for logical backups. 3. Streaming Replication is for *hot standby*, not backups. On Tue, Mar 4, 2025 at 10:00 AM chandan Kumar wr

Re: Review my steps for rollback to restore point

2025-03-04 Thread chandan Kumar
Thank you for your time and clarification. Does PITR recreate database internally ? can i say it is not the same as pg_restore or it is same as pg_restore plus applying WAL on top of it. I am asking because can we revern DDL operations without PITR in streaming replication On Tue, Mar 4, 2025 a

Re: Review my steps for rollback to restore point

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, chandan Kumar wrote: > Thank you for your answer. I want to clarify one more doubt. Can PITR be > achieved without applying Base Backup > The point-in-time you choose must be in the future relative to whatever data files you are applying WAL on top of. That is only

Re: Review my steps for rollback to restore point

2025-03-04 Thread chandan Kumar
Thank you for your answer. I want to clarify one more doubt. Can PITR be achieved without applying Base Backup On Tue, Mar 4, 2025 at 3:12 PM Laurenz Albe wrote: > On Tue, 2025-03-04 at 14:26 +0530, chandan Kumar wrote: > > Hello, > > I hope you are doing fine. I need your expertise on below

Re: Review my steps for rollback to restore point

2025-03-04 Thread Laurenz Albe
On Tue, 2025-03-04 at 14:26 +0530, chandan Kumar wrote: > Hello, >  I hope you are doing fine. I need your expertise on below case study. > My current production environment is 2 node streaming replication hosted on > Ubuntu VM 's on Azure. I have performed below steps on primary database. > 1- Tak

Review my steps for rollback to restore point

2025-03-04 Thread chandan Kumar
Hello, I hope you are doing fine. I need your expertise on below case study. My current production environment is 2 node streaming replication hosted on Ubuntu VM 's on Azure. I have performed below steps on primary database. 1- Take Base backup 2- Create a restore point using pg_create_restore_p