Re: A qsort template

2022-04-21 Thread Thomas Munro
On Fri, Apr 22, 2022 at 4:37 PM John Naylor wrote: > On Fri, Apr 22, 2022 at 11:13 AM David Rowley wrote: > > On Thu, 21 Apr 2022 at 19:09, John Naylor > > wrote: > > > I intend to commit David's v2 fix next week, unless there are > > > objections, or unless he beats me to it. > > > > I wasn't

Allow specifying column list for foreign key ON DELETE SET src_test_regress_sql_foreign_key.sql don't understand the comment.

2022-04-21 Thread alias
git.postgresql.org Git - postgresql.git/commit git.postgresql.org Git - postgresql.git/blob - src/test/regress/expected/foreign_key.out

Re: A qsort template

2022-04-21 Thread John Naylor
On Fri, Apr 22, 2022 at 11:13 AM David Rowley wrote: > > On Thu, 21 Apr 2022 at 19:09, John Naylor > wrote: > > I intend to commit David's v2 fix next week, unless there are > > objections, or unless he beats me to it. > > I wasn't sure if you wanted to handle it or not, but I don't mind >

Re: A qsort template

2022-04-21 Thread David Rowley
On Thu, 21 Apr 2022 at 19:09, John Naylor wrote: > I intend to commit David's v2 fix next week, unless there are > objections, or unless he beats me to it. I wasn't sure if you wanted to handle it or not, but I don't mind doing it, so I just pushed it after a small adjustment to a comment.

Re: Perform streaming logical transactions by background workers and parallel apply

2022-04-21 Thread Peter Smith
Hello Hou-san. Here are my review comments for v4-0001. Sorry, there are so many of them (it is a big patch); some are trivial, and others you might easily dismiss due to my misunderstanding of the code. But hopefully, there are at least some comments that can be helpful in improving the patch

Re: fix cost subqueryscan wrong parallel cost

2022-04-21 Thread bucoo
> > > Suppose parallelism is not in use and that param_info is NULL. Then, > > > is path->subpath->rows guaranteed to be equal to baserel->rows? If > > > yes, then we don't need to a three-part if statement as you propose > > > here and can just change the "else" clause to say path->path.rows = >

Re: Replace open mode with PG_BINARY_R/W/A macros

2022-04-21 Thread Tom Lane
Japin Li writes: > I think we should also consider the popen() (see: OpenPipeStream() function), > on the Windows, it can use "b", however, for linux, it might be not right. Oh, ugh ... POSIX says for popen(): The behavior of popen() is specified for values of mode of r and w. Other

Re: Replace open mode with PG_BINARY_R/W/A macros

2022-04-21 Thread Japin Li
On Fri, 22 Apr 2022 at 04:38, Tom Lane wrote: > Peter Eisentraut writes: >> On 20.04.22 22:29, Tom Lane wrote: >>> PG_BINARY is useful for open(). It's the PG_BINARY_R/W/A macros for >>> fopen() that are redundant per POSIX. Possibly someone generalized >>> inappropriately; or maybe long ago

Re: More problems with VacuumPageHit style global variables

2022-04-21 Thread Peter Geoghegan
On Thu, Apr 21, 2022 at 4:28 PM Peter Geoghegan wrote: > I don't think that there is any risk of one user of either variable > "clobbering" some other user -- the current values of the variables > are not actually meaningful at all. They're only useful as a way that > an arbitrary piece of code

Re: More problems with VacuumPageHit style global variables

2022-04-21 Thread Peter Geoghegan
On Wed, Apr 20, 2022 at 8:00 PM Peter Geoghegan wrote: > I knew about pgBufferUsage, and I knew about > VacuumPage{Hit,Miss,Dirty} for a long time. But somehow I didn't make > the very obvious connection between the two until today. I am probably > not the only one. What about

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
В Чт, 21/04/2022 в 16:24 -0400, Robert Haas пишет: > On Thu, Apr 21, 2022 at 5:04 AM Yura Sokolov wrote: > > $ pid=`ps x | awk '/checkpointer/ && !/awk/ { print $1 }'` > > $ gdb -p $pid -batch -ex 'p SharedBufHash->hctl->allocated.value' > > > > $1 = 16512 > > > > $ install/bin/pgbench

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Tom Lane
Tomas Vondra writes: > On 4/21/22 21:03, Tom Lane wrote: >> I think we should just drop this cross-check altogether; it is not nearly >> useful enough to justify the work that'd be involved in maintaining >> cterefcount accurately for all such transformations. All it's really >> there for is to

Re: [RFC] building postgres with meson -v8

2022-04-21 Thread Tom Lane
Andres Freund writes: > On 2022-04-21 22:36:01 +0200, Peter Eisentraut wrote: >> Why is Python 3.5 relevant? > It's the latest available on some older platforms. It's pretty easy to install > a new meson, a heck of a lot more work to install a new python. IIRC solaris, > AIX and some of Tom's

Re: error handling in pqRowProcessor broken

2022-04-21 Thread Tom Lane
Peter Eisentraut writes: > On 19.04.22 21:16, Tom Lane wrote: >> Ah, I see the problem: a few places in fe-protocol3 didn't get the memo >> that conn->error_result represents a "pending" PGresult that hasn't >> been constructed yet. The attached fixes it for me --- can you try it >> on whatever

Re: [RFC] building postgres with meson -v8

2022-04-21 Thread Andres Freund
Hi, On 2022-04-21 22:36:01 +0200, Peter Eisentraut wrote: > On 20.04.22 23:04, Andres Freund wrote: > > > 0003-Fix-warnings-about-deprecated-features.patch > > > > > > This fixes some deprecation warnings and raises the requirement to 0.56. > > > > I don't see any deprecation warnings - I see

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Tomas Vondra
On 4/21/22 21:03, Tom Lane wrote: > Tomas Vondra writes: >> On 4/21/22 10:29, Richard Guo wrote: >>> Further debugging shows that in this repro the reference to the CTE is >>> removed when generating paths for the subquery 'sub', where we would try >>> to remove subquery targetlist items that are

Re: Replace open mode with PG_BINARY_R/W/A macros

2022-04-21 Thread Tom Lane
Peter Eisentraut writes: > On 20.04.22 22:29, Tom Lane wrote: >> PG_BINARY is useful for open(). It's the PG_BINARY_R/W/A macros for >> fopen() that are redundant per POSIX. Possibly someone generalized >> inappropriately; or maybe long ago we supported some platform that >> rejected the "b"

Re: [RFC] building postgres with meson -v8

2022-04-21 Thread Peter Eisentraut
On 20.04.22 23:04, Andres Freund wrote: 0003-Fix-warnings-about-deprecated-features.patch This fixes some deprecation warnings and raises the requirement to 0.56. I don't see any deprecation warnings - I see some notices about *future* deprecated features being used: NOTICE:

Re: Replace open mode with PG_BINARY_R/W/A macros

2022-04-21 Thread Peter Eisentraut
On 20.04.22 22:29, Tom Lane wrote: PG_BINARY is useful for open(). It's the PG_BINARY_R/W/A macros for fopen() that are redundant per POSIX. Possibly someone generalized inappropriately; or maybe long ago we supported some platform that rejected the "b" option? I think the latter was the

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Robert Haas
On Thu, Apr 21, 2022 at 5:04 AM Yura Sokolov wrote: > $ pid=`ps x | awk '/checkpointer/ && !/awk/ { print $1 }'` > $ gdb -p $pid -batch -ex 'p SharedBufHash->hctl->allocated.value' > > $1 = 16512 > > $ install/bin/pgbench -c 600 -j 800 -T 10 -P 1 -S -M prepared postgres > ... > $ gdb

Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)

2022-04-21 Thread Tom Lane
Robert Haas writes: > On Thu, Apr 21, 2022 at 1:53 PM Tom Lane wrote: >> 0001 attached is a revised patch that does it that way. This seems >> like a clearly better answer. >> 0002 contains the perhaps-slightly-more-controversial changes of >> changing the macro names and explicitly pinning no

Re: Add --{no-,}bypassrls flags to createuser

2022-04-21 Thread David G. Johnston
On Thu, Apr 21, 2022 at 12:51 PM Robert Haas wrote: > On Thu, Apr 21, 2022 at 12:30 AM Michael Paquier > wrote: > > On Tue, Apr 19, 2022 at 12:13:51PM -0400, Robert Haas wrote: > > > On Mon, Apr 18, 2022 at 9:50 PM Kyotaro Horiguchi > > > wrote: > > >> Hmm.. So, "-r/--role" and

Re: error handling in pqRowProcessor broken

2022-04-21 Thread Peter Eisentraut
On 19.04.22 21:16, Tom Lane wrote: Peter Eisentraut writes: I find that this doesn't work anymore. If you set *errmsgp = "some message" and return 0, then psql will just print a result set with zero rows. Ah, I see the problem: a few places in fe-protocol3 didn't get the memo that

Re: Add --{no-,}bypassrls flags to createuser

2022-04-21 Thread Robert Haas
On Thu, Apr 21, 2022 at 12:30 AM Michael Paquier wrote: > On Tue, Apr 19, 2022 at 12:13:51PM -0400, Robert Haas wrote: > > On Mon, Apr 18, 2022 at 9:50 PM Kyotaro Horiguchi > > wrote: > >> Hmm.. So, "-r/--role" and "-m/--member(ship)" is the (least worse) way > >> to go? Or we can give up

Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)

2022-04-21 Thread Robert Haas
On Thu, Apr 21, 2022 at 1:53 PM Tom Lane wrote: > Robert Haas writes: > > On Wed, Apr 20, 2022 at 4:56 PM Tom Lane wrote: > >> Having just had to bury my nose in renumber_oids.pl, I thought of a > >> different approach we could take to expose these OIDs to Catalog.pm. > >> That's to invent a

Re: Assorted small doc patches

2022-04-21 Thread David G. Johnston
On Thu, Apr 21, 2022 at 10:46 AM Alvaro Herrera wrote: > On 2022-Apr-20, David G. Johnston wrote: > > > v0001-doc-savepoint-name-reuse (-docs, reply to user request for > > improvement) > > >

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Tom Lane
Tomas Vondra writes: > On 4/21/22 10:29, Richard Guo wrote: >> Further debugging shows that in this repro the reference to the CTE is >> removed when generating paths for the subquery 'sub', where we would try >> to remove subquery targetlist items that are not needed. So for the >> items we are

Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)

2022-04-21 Thread Tom Lane
Robert Haas writes: > On Wed, Apr 20, 2022 at 4:56 PM Tom Lane wrote: >> Having just had to bury my nose in renumber_oids.pl, I thought of a >> different approach we could take to expose these OIDs to Catalog.pm. >> That's to invent a new macro that Catalog.pm recognizes, and write >> something

Re: Assorted small doc patches

2022-04-21 Thread Alvaro Herrera
On 2022-Apr-20, David G. Johnston wrote: > v0001-doc-savepoint-name-reuse (-docs, reply to user request for > improvement) > https://www.postgresql.org/message-id/CAKFQuwYzSb9OW5qTFgc0v9RWMN8bX83wpe8okQ7x6vtcmfA2KQ%40mail.gmail.com This one is incorrect; rolling back to a savepoint does not

Re: typos

2022-04-21 Thread Alvaro Herrera
On 2022-Apr-21, Peter Eisentraut wrote: > It is referred to as "Zstandard" at both of those places. Maybe we should > use that. That is also easier to pronounce. Yeah, I looked at other places (such as Yann Collet's blog) and I agree that Zstandard seems to be the accepted spelling of the

COPY TO STDOUT Apache Arrow support

2022-04-21 Thread Adam Lippai
Hi, would it be possible to add Apache Arrow streaming format to the copy backend + frontend? The use case is fetching (or storing) tens or hundreds of millions of rows for client side data science purposes (Pandas, Apache Arrow compute kernels, Parquet conversion etc). It looks like the

Re: Add version and data directory to initdb output

2022-04-21 Thread David G. Johnston
On Thu, Apr 21, 2022 at 7:18 AM Tom Lane wrote: > Peter Eisentraut writes: > > I'm not a particular fan of the current initdb output and it could use a > > general revision IMO. If you want to look into that, please do. But > > for your particular proposed addition, let's put it somewhere it

Re: Add version and data directory to initdb output

2022-04-21 Thread Michael Banck
Hi, On Thu, Apr 21, 2022 at 10:18:56AM -0400, Tom Lane wrote: > And as for the version, if you want that you can get it from "initdb > --version". I assumed the point in stamping the version in the output was that people might want to pipe it to some logfile and then later on, when they found

Re: Add version and data directory to initdb output

2022-04-21 Thread Tom Lane
Peter Eisentraut writes: > I'm not a particular fan of the current initdb output and it could use a > general revision IMO. If you want to look into that, please do. But > for your particular proposed addition, let's put it somewhere it makes > sense either in the current scheme or a future

Re: typos

2022-04-21 Thread Peter Eisentraut
On 21.04.22 06:36, Michael Paquier wrote: On Wed, Apr 20, 2022 at 11:32:08PM +0200, Alvaro Herrera wrote: So the attached. --- a/doc/src/sgml/install-windows.sgml +++ b/doc/src/sgml/install-windows.sgml @@ -307,9 +307,9 @@ $ENV{MSBFLAGS}="/m"; - ZSTD + Zstd -

Re: DataRow message for Integer(int4) returns result as text?

2022-04-21 Thread Peter Eisentraut
On 21.04.22 02:11, Tyler Brock wrote: What I don’t understand is that if I respond to psql with the RowDescription indicating the format code is 1 for binary (and encode it that way, with 4 bytes, in the DataRow) it doesn’t render the number in the results. psql only handles results in text

Re: effective_io_concurrency and NVMe devices

2022-04-21 Thread Tomas Vondra
On 4/21/22 10:14, David Rowley wrote: > On Wed, 20 Apr 2022 at 14:56, Bruce Momjian wrote: >> NVMe devices have a maximum queue length of 64k: > >> Should we increase its maximum to 64k? Backpatched? (SATA has a >> maximum queue length of 256.) > > I have a machine here with 1 x PCIe 3.0 NVMe

Re: Postgres perl module namespace

2022-04-21 Thread Andrew Dunstan
On 2022-04-21 Th 00:11, Michael Paquier wrote: > On Wed, Apr 20, 2022 at 03:56:17PM -0400, Andrew Dunstan wrote: >> Basically I propose just to remove any mention of the Testlib items and >> get_free_port from the export and alias lists for versions where they >> are absent. If backpatchers need

Re: Add version and data directory to initdb output

2022-04-21 Thread Peter Eisentraut
On 20.04.22 23:21, David G. Johnston wrote: I agree with the observation but it initdb is fast enough and non-interactive and so that order isn't particularly appealing. I'm not a particular fan of the current initdb output and it could use a general revision IMO. If you want to look into

Re: Re: fix cost subqueryscan wrong parallel cost

2022-04-21 Thread Robert Haas
On Thu, Apr 21, 2022 at 2:38 AM bu...@sohu.com wrote: > > Suppose parallelism is not in use and that param_info is NULL. Then, > > is path->subpath->rows guaranteed to be equal to baserel->rows? If > > yes, then we don't need to a three-part if statement as you propose > > here and can just

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Tomas Vondra
On 4/21/22 10:29, Richard Guo wrote: > > On Thu, Apr 21, 2022 at 3:51 PM Richard Guo > wrote: > > > On Thu, Apr 21, 2022 at 5:33 AM Tomas Vondra > > wrote: > > > it seems there's something wrong with

Re: Dump/Restore of non-default PKs

2022-04-21 Thread Simon Riggs
On Wed, 20 Apr 2022 at 21:46, Peter Eisentraut wrote: > > On 18.04.22 22:48, Tom Lane wrote: > >> Why not just get rid of the limitation that constraint definitions don't > >> support non-default methods? > > That approach would be doubling down on the assumption that we can always > > shoehorn

RE: Logical replication timeout problem

2022-04-21 Thread wangw.f...@fujitsu.com
On Wed, Apr 21, 2022 at 10:15 AM I wrote: > The comments by Sawada-San sound reasonable to me. > After doing check, I found that padding in HEAD is the same as in REL14. > So I change the approach of patch for HEAD just like the patch for REL14. Also attach the back-branch patches for

Re: Data is copied twice when specifying both child and parent table in publication

2022-04-21 Thread Amit Kapila
On Tue, Apr 19, 2022 at 2:23 PM shiy.f...@fujitsu.com wrote: > > On Tue, Apr 19, 2022 3:05 PM houzj.f...@fujitsu.com > wrote: > > > > One suggestion is that can we simplify the code by moving the logic of > > checking > > the ancestor into the SQL ?. For example, we could filter the outpout of

Re: [PATCH] Add native windows on arm64 support

2022-04-21 Thread Niyas Sait
> Why does it not allow that? Is that just a limitation of the > compiler? If yes, what is the error happening? This question is not > exactly answered yet as of this thread. I may be missing a reference > about that in the upstream docs, but I see nowhere an explanation > about the reason and

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
Good day, hackers. There are some sentences. Sentence one > With the existing system, there is a hard cap on the number of hash > table entries that we can ever need: one per buffer, plus one per > partition to cover the "extra" entries that are needed while changing > buffer tags.

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Richard Guo
On Thu, Apr 21, 2022 at 3:51 PM Richard Guo wrote: > > On Thu, Apr 21, 2022 at 5:33 AM Tomas Vondra < > tomas.von...@enterprisedb.com> wrote: > >> >> it seems there's something wrong with CTE inlining when there's a view >> containing a correlated subquery referencing the CTE. >> > > BTW, seems

Re: effective_io_concurrency and NVMe devices

2022-04-21 Thread David Rowley
On Wed, 20 Apr 2022 at 14:56, Bruce Momjian wrote: > NVMe devices have a maximum queue length of 64k: > Should we increase its maximum to 64k? Backpatched? (SATA has a > maximum queue length of 256.) I have a machine here with 1 x PCIe 3.0 NVMe SSD and also 1 x PCIe 4.0 NVMe SSD. I ran a few

Re: Checking pgwin32_is_junction() errors

2022-04-21 Thread Michael Paquier
On Thu, Mar 24, 2022 at 04:30:26PM +1300, Thomas Munro wrote: > I think it'd be better to add missing_ok and elevel parameters, > following existing patterns. Unfortunately, it can't use the generic > frontend logging to implement elevel in frontend code from its current > location, because

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Richard Guo
On Thu, Apr 21, 2022 at 5:33 AM Tomas Vondra wrote: > > it seems there's something wrong with CTE inlining when there's a view > containing a correlated subquery referencing the CTE. > BTW, seems view is not a necessary condition to reproduce this issue. For instance: create table t (a int, b

Re: Assert failure in CTE inlining with view and correlated subquery

2022-04-21 Thread Richard Guo
On Thu, Apr 21, 2022 at 5:33 AM Tomas Vondra wrote: > > The difference between plans in (2) and (3) is interesting, because it > seems the CTE got inlined, so why was the refcount not decremented? > The query is not actually referencing the cte. So the cte range table entry would not appear

Re: A qsort template

2022-04-21 Thread John Naylor
I intend to commit David's v2 fix next week, unless there are objections, or unless he beats me to it. -- John Naylor EDB: http://www.enterprisedb.com

Re: postgres_fdw: batch inserts vs. before row triggers

2022-04-21 Thread Etsuro Fujita
Hi, On Tue, Apr 19, 2022 at 9:00 PM Tomas Vondra wrote: > On 4/19/22 11:16, Etsuro Fujita wrote: > > On Sun, Apr 17, 2022 at 6:20 PM Etsuro Fujita > > wrote: > >> So I think we should disable batch insert in such cases, just as we > >> disable multi insert when there are any before row

Re: Re: fix cost subqueryscan wrong parallel cost

2022-04-21 Thread bu...@sohu.com
> > for now fuction cost_subqueryscan always using *total* rows even parallel > > path. like this: > > > > Gather (rows=3) > > Workers Planned: 2 > > -> Subquery Scan (rows=3) -- *total* rows, should be equal subpath > > -> Parallel Seq Scan (rows=1) > > OK, that's

Two small issues related to table_relation_copy_for_cluster() and CTAS with no data.

2022-04-21 Thread Paul Guo
Hello hackers, While reading the latest master branch code, I found something that we may be able to improve. 1. The am table_relation_copy_for_cluster() interface. static inline void table_relation_copy_for_cluster(Relation OldTable, Relation NewTable,