Re: Upgrading to v12

2022-11-28 Thread Adrian Klaver
On 11/28/22 17:02, Tom Lane wrote: Brad White writes: I tried to run initdb after re-installing pg 12 using postgresql-12.10-2-windows-x64.exe. But the runas I'm using to execute it as pguser seems to be swallowing all the output, so I can't see any errors. I was able to run pg_checksums and

Re: Upgrading to v12

2022-11-28 Thread Tom Lane
Brad White writes: > I tried to run initdb after re-installing pg 12 > using postgresql-12.10-2-windows-x64.exe. > But the runas I'm using to execute it as pguser seems to be swallowing all > the output, so I can't see any errors. > I was able to run pg_checksums and get those enabled. > Is there

Re: Upgrading to v12

2022-11-28 Thread Brad White
Tom, I tried to run initdb after re-installing pg 12 using postgresql-12.10-2-windows-x64.exe. But the runas I'm using to execute it as pguser seems to be swallowing all the output, so I can't see any errors. I was able to run pg_checksums and get those enabled. Is there anything else I want from

Re: delete statement returning too many results

2022-11-28 Thread Tom Lane
"David G. Johnston" writes: > There is a nice big caution regarding the default read committed isolation > mode, order by, and for update, in the documentation, but I cannot work out > exactly why this example seems to be triggering it. The is talking about a rather different scenario. I

Re: delete statement returning too many results

2022-11-28 Thread David G. Johnston
On Mon, Nov 28, 2022 at 7:18 AM Ron wrote: > On 11/28/22 07:29, Arlo Louis O'Keeffe wrote: > > Hello everyone, > > > > I am seeing weird behaviour of a delete statement that is returning more > results than I am expecting. > > > > This is the query: > > > > DELETE FROM queue > > WHERE > >

Re: Re: how to implement add using upsert and trigger?

2022-11-28 Thread yin....@163.com
Thank you, this result is what I want yin@163.com From: Pavel Luzanov Date: 2022-11-28 21:26 To: yin@163.com; pgsql-general Subject: Re: how to implement add using upsert and trigger? Hi, I think you need: insert into stat_result(itemid,value,cnt) values(new.itemid, new.value, 1)

Re: delete statement returning too many results

2022-11-28 Thread Ron
On 11/28/22 07:29, Arlo Louis O'Keeffe wrote: Hello everyone, I am seeing weird behaviour of a delete statement that is returning more results than I am expecting. This is the query: DELETE FROM queue WHERE id IN ( SELECT id FROM queue

Re: Get table catalog from pg_indexes

2022-11-28 Thread Ron
On 11/28/22 00:04, Thomas Kellerer wrote: Igor Korot schrieb am 27.11.2022 um 23:13: I've never heard of a database referred to as a catalog. (That's always been where a database's metadata -- i.e. the pg_catalog schema -- is stored.) In the ODBC terminology the DB is usually referenced as

Standby restore_command

2022-11-28 Thread j.emerlik
Hi, I have configured standby using restore_command to restore WAL files. I can check in postgresql log files which WAL file was restored. Is possible to check which last WAL files was restored using SQL Query ? Best regards Jack

Re[2]: Index-only scan not working when IN clause has 2 or more values

2022-11-28 Thread Anna B .
Hi Tom and community,   Thank you very much!  After digging how Postgres planner uses statistics, I have increased table statistics from 100 to 1000. It was enough for planner to use multiple scans of the index and then sort! (Also I have added dependency extended stats on the three columns as

delete statement returning too many results

2022-11-28 Thread Arlo Louis O'Keeffe
Hello everyone, I am seeing weird behaviour of a delete statement that is returning more results than I am expecting. This is the query: DELETE FROM queue WHERE id IN ( SELECT id FROM queue ORDER BY id LIMIT 1

Re: how to implement add using upsert and trigger?

2022-11-28 Thread Pavel Luzanov
Hi, I think you need:     insert into stat_result(itemid,value,cnt) values(new.itemid, new.value, 1)     on conflict(itemid) do update     set value = stat_result.value + new.value, cnt = stat_result.cnt +1; excluded.value and new.value is the same value from inserted record, but your need a

Re: Re: how to implement add using upsert and trigger?

2022-11-28 Thread yin....@163.com
em, which is does not matter yin@163.com From: Dominique Devienne Date: 2022-11-28 20:47 To: yin@163.com CC: pgsql-general Subject: Re: how to implement add using upsert and trigger? On Mon, Nov 28, 2022 at 1:37 PM yin@163.com wrote: > on conflict(itemid) do update > set

Re: how to implement add using upsert and trigger?

2022-11-28 Thread Dominique Devienne
On Mon, Nov 28, 2022 at 1:37 PM yin@163.com wrote: > on conflict(itemid) do update > set value = excluded.value + new.value, cnt = excluded.cnt +1 where > excluded.itemid = new.itemid; OT, but isn't `where excluded.itemid = new.itemid` redundant, given `on conflict(itemid)`? I'm

how to implement add using upsert and trigger?

2022-11-28 Thread yin....@163.com
Hi, all: when I using upsert and trigger to update other table automatically: create table stat_detail(itemid bigint not null, value bigint, captime bigint); create table stat_result(itemid bigint primary key, value bigint, cnt bigint); create or replace function inertfunc() returns trigger as

Re: Replicating an existing (huge) database

2022-11-28 Thread Torsten Förtsch
You can set up wal archiving and set restore_command before you start the replica. Then you can use pg_basebackup with `-Xnone --no-slot`. Alternatively or in combination, use a quicker backup as Laurenz explained. On Mon, Nov 28, 2022 at 11:17 AM Srinivasa T N wrote: > Hi All, >I am using

Re: Replicating an existing (huge) database

2022-11-28 Thread Laurenz Albe
On Mon, 2022-11-28 at 15:47 +0530, Srinivasa T N wrote: > I am using postgresql 12.  As part of streaming replication setup, I run > pg_basebackup > on the slave which copies the database from master to slave.  But the > database is huge > and it takes around 2 to 3 days for the pg_basebackup to

Replicating an existing (huge) database

2022-11-28 Thread Srinivasa T N
Hi All, I am using postgresql 12. As part of streaming replication setup, I run pg_basebackup on the slave which copies the database from master to slave. But the database is huge and it takes around 2 to 3 days for the pg_basebackup to finish. When pg_basebackup is running, a huge number of