Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Christophe Pettus
> On Apr 28, 2025, at 15:58, Christophe Pettus wrote: > It does require knowing which of the VALUES is the key value being inserted > (pseudocode syntax above) [...] The instant after I hit send, I realized that information is available to the function by lining up the $names and $values arr

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Christophe Pettus
> On Apr 28, 2025, at 15:36, Tim Starling wrote: > function upsert( $table, $names, $values, $key, $set ) { >if ( $this->type === 'mysql' ) { >$conflict = 'ON DUPLICATE KEY UPDATE'; >} else { >$conflict = "ON CONFLICT ($key) DO UPDATE SET"; >} >return $this->quer

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Tim Starling
On 28/4/25 23:30, Peter Geoghegan wrote: You can use an alias for the target table name. Is it feasible to require callers to prefix all field names with a generic table name alias? No, primarily because MySQL does not support such an alias. -- Tim Starling

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Tim Starling
On 28/4/25 23:54, Tom Lane wrote: AFAIK, "ON CONFLICT" is a Postgres-ism. Exactly which constructs in exactly which other databases are you citing as precedent? There's a list here: Since that page was written in 201

Re: Fwd: SQL transactions executing from VMSS

2025-04-28 Thread Adrian Klaver
On 4/28/25 01:25, chandan Kumar wrote: Hello Team, I did not get any answer till now.  If someone has any idea please help me is getting this resolved. The issue is - database deployment , sql query to database is slow when we run database script from vmss to postgres database in flexible serv

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread David G. Johnston
On Monday, April 28, 2025, Tom Lane wrote: > > AFAIK, "ON CONFLICT" is a Postgres-ism. Exactly which constructs > in exactly which other databases are you citing as precedent? > I confirmed the SQLite reference from the original email. “The upsert above inserts the new vocabulary word "jovial"

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Tom Lane
Tim Starling writes: > On 28/4/25 20:54, Tom Lane wrote: >> Even if I were on board with arbitrarily adopting one of the two >> possible interpretations, it's far from obvious to me that most people >> would agree that "v" should mean the value from the existing row, >> rather than the new value.

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Peter Geoghegan
On Mon, Apr 28, 2025 at 12:56 AM Tim Starling wrote: > Our application has an upsert method which takes the assignment > "v=v+1" as a string. It is feasible to split it on the equals sign > into the destination field and expression components, but it is not > feasible to parse the expression or to

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Laurenz Albe
On Mon, 2025-04-28 at 21:22 +1000, Tim Starling wrote: > On 28/4/25 20:54, Tom Lane wrote: > > Even if I were on board with arbitrarily adopting one of the two > > possible interpretations, it's far from obvious to me that most people > > would agree that "v" should mean the value from the existing

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Tim Starling
On 28/4/25 20:54, Tom Lane wrote: Even if I were on board with arbitrarily adopting one of the two possible interpretations, it's far from obvious to me that most people would agree that "v" should mean the value from the existing row, rather than the new value. Better to make them say which the

Re: Wal Files not removing automatically

2025-04-28 Thread Tom Lane
Devvrat Mittal writes: > And these parameters also set on the other sites too. Now the issue is the > wal files are removing automatically. And the restart_lsn is also not > changing automatically. But when i drop the replication slot and recreate > it. After i create the replication slot the rest

Re: shared buffers

2025-04-28 Thread Marc Millas
I didnt know this. thanks, Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Sat, Apr 26, 2025 at 12:46 AM Laurenz Albe wrote: > 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 >

Re: Fwd: SQL transactions executing from VMSS

2025-04-28 Thread Tom Lane
Laurenz Albe writes: > I think that the answer you didn't get was as helpful as your problem > description: > "I got some statement that is slow, but I will neither tell you the > statement nor >show you the execution plan. What is the cause of the slowness?" The OP did say that the exec

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread Tom Lane
Tim Starling writes: > Regarding upsert syntax. > => INSERT INTO t VALUES (1,1) ON CONFLICT (k) DO UPDATE SET v=v+1; > ERROR: column reference "v" is ambiguous > Please convince me that this is not a bug. It's not a bug. > If I understand correctly, in the expression "v+1", both EXCLUDED.v >

Re: Fwd: SQL transactions executing from VMSS

2025-04-28 Thread Laurenz Albe
On Mon, 2025-04-28 at 13:55 +0530, chandan Kumar wrote: > I did not get any answer till now.  If someone has any idea please help me is > getting this resolved. > The issue is - database deployment , sql query to database is slow when we > run database script from > vmss to postgres database in f

Fwd: SQL transactions executing from VMSS

2025-04-28 Thread chandan Kumar
Hello Team, I did not get any answer till now. If someone has any idea please help me is getting this resolved. The issue is - database deployment , sql query to database is slow when we run database script from vmss to postgres database in flexible server. both the servers are in US EAST under t

Wal Files not removing automatically

2025-04-28 Thread Devvrat Mittal
Hello, I have 3 nodes on which i have configured repmgr on 1st node primary, on 2nd standby and on 3rd witness. I have also configured pgbackrest on the primary and witness node. I'm using fivetran as a replication slot. i have also set the parameters which are: wal_level = 'logical' synchronous_c