Re: postgres_fdw: batch inserts vs. before row triggers

2022-04-20 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 triggers

Re: Re: fix cost subqueryscan wrong parallel cost

2022-04-20 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 bad

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

2022-04-20 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, Rela

Re: Logical replication timeout problem

2022-04-20 Thread Masahiko Sawada
On Thu, Apr 21, 2022 at 11:19 AM Amit Kapila wrote: > > On Wed, Apr 20, 2022 at 6:22 PM Masahiko Sawada wrote: > > > > On Wed, Apr 20, 2022 at 7:12 PM Amit Kapila wrote: > > > > > > > > I think it would > > > be then better to have it in the same place in HEAD as well? > > > > As far as I can se

How to debug JIT-ed code in PostgreSQL using GDB

2022-04-20 Thread Japin Li
Hi, hackers I try to use gdb to debug the jit-ed code, however, there isn't much useful information. I tried the way from [1], however, it doesn't work for me (llvm-10 in my environment). How can I do this debugging? Any suggestions? Thanks in advance! [1] https://releases.llvm.org/8.0.1/d

Re: typos

2022-04-20 Thread Michael Paquier
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 > > - Required for supportin

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

2022-04-20 Thread Michael Paquier
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 adding -m for the reason of being hard to >> name it.. > > Hmm, yeah, I

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Richard Guo
On Thu, Apr 21, 2022 at 12:02 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 18.04.22 09:35, Richard Guo wrote: > > The array sortgrouprefs[] inside PathTarget might be NULL if we have not > > identified sort/group columns in this tlist. In that case we would have > > a NULL

Re: Postgres perl module namespace

2022-04-20 Thread Michael Paquier
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 a function they can backport it if > necessary. Agree

Re: [PATCH] Add native windows on arm64 support

2022-04-20 Thread Michael Paquier
On Wed, Apr 20, 2022 at 10:43:06AM +0100, Niyas Sait wrote: >> This issue is still lying around, and you may have been lucky. Would >> there be any issues to remove this change to get a basic support in? >> As mentioned upthread, there is a long history of Postgres with ASLR. > > MSVC linker does

Re: Skipping schema changes in publication

2022-04-20 Thread vignesh C
On Mon, Apr 18, 2022 at 12:32 PM Amit Kapila wrote: > > On Fri, Apr 15, 2022 at 1:26 AM Euler Taveira wrote: > > > > On Thu, Apr 14, 2022, at 10:47 AM, Peter Eisentraut wrote: > > > > On 12.04.22 08:23, vignesh C wrote: > > > I have also included the implementation for skipping a few tables from

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

2022-04-20 Thread Tom Lane
Tyler Brock writes: > I think this makes sense but I wanted to get confirmation: > I created a table with a column having the type int4 (integer). When I > insert a row with a number into that column and get it back out I've > observed a discrepancy: > The DataRow message has the field encoded as

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

2022-04-20 Thread wangw.f...@fujitsu.com
On Tue, Apr 19, 2022 4:53 PM Shi, Yu/侍 雨 wrote: > On Tue, Apr 19, 2022 3:05 PM houzj.f...@fujitsu.com > wrote: > > > > > -Original Message- > > > From: Wang, Wei/王 威 > > On Thursday, April 7, 2022 11:08 AM > > > > > > On Thur, Mar 10, 2021 at 10:08 AM houzj.f...@fujitsu.com wrote: > > >

Re: More problems with VacuumPageHit style global variables

2022-04-20 Thread Peter Geoghegan
On Wed, Apr 20, 2022 at 7:50 PM Thomas Munro wrote: > As for your general question, I think you must be right. From a quick > rummage around in the commit log, it does appear that commit cddca5ec > (2009), which introduced pgBufferUsage, always bumped the counters > unconditionally. It predated

Re: More problems with VacuumPageHit style global variables

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 10:03 AM Peter Geoghegan wrote: > I just realized that there is one remaining problem: parallel VACUUM > doesn't care about these global variables, so there will still be > discrepancies there. I can't really blame that on parallel VACUUM, > though, because vacuumparallel.c

Re: typos

2022-04-20 Thread Amit Kapila
On Wed, Apr 20, 2022 at 5:31 PM Alvaro Herrera wrote: > > On 2022-Apr-20, Amit Kapila wrote: > > > Your proposed changes look good to me but I think all these places > > need to mention 'column list' as well because the behavior is the same > > for it. > > Hmm, you're right. Added that, and chang

Re: Logical replication timeout problem

2022-04-20 Thread Amit Kapila
On Wed, Apr 20, 2022 at 6:22 PM Masahiko Sawada wrote: > > On Wed, Apr 20, 2022 at 7:12 PM Amit Kapila wrote: > > > > > I think it would > > be then better to have it in the same place in HEAD as well? > > As far as I can see in the v17 patch, which is for HEAD, we don't add > a variable to Logic

RE: Logical replication timeout problem

2022-04-20 Thread wangw.f...@fujitsu.com
On Wed, Apr 20, 2022 at 6:13 PM Amit Kapila wrote: > On Wed, Apr 20, 2022 at 2:38 PM Amit Kapila wrote: > > > > On Wed, Apr 20, 2022 at 12:51 PM Masahiko Sawada > wrote: > > > > > > On Wed, Apr 20, 2022 at 11:46 AM wangw.f...@fujitsu.com > > > wrote: > > > > ``` > > > > > > I'm concerned that t

Re: CLUSTER sort on abbreviated expressions is broken

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 12:18 PM Peter Geoghegan wrote: > On Tue, Apr 12, 2022 at 11:01 AM Peter Geoghegan wrote: > > Attached patch fixes the issue, and includes the test case that you posted. > > Pushed a similar patch just now. Backpatched to all supported branches. Thanks.

Assorted small doc patches

2022-04-20 Thread David G. Johnston
Hackers, I posted all of these elsewhere (docs, bugs) but am consolidating them here going forward. v0001-database-default-name (-bugs, with a related cleanup suggestion as well) https://www.postgresql.org/message-id/flat/CAKFQuwZvHH1HVSOu7EYjvshynk4pnDwC5RwkF%3DVfZJvmUskwrQ%40mail.gmail.com#0e6

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

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 5:21 PM Tyler Brock wrote: > I’m not sure what top-posting is? > It's when you place your replies before what you are replying to. https://en.wikipedia.org/wiki/Posting_style Unlike mine, which is inline-posting, where the reply is after the thing being replied to, trimm

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

2022-04-20 Thread Tyler Brock
I’m not sure what top-posting is? I’m talking about responding to psql the command line program. -Tyler On Apr 20, 2022 at 8:16:28 PM, David G. Johnston wrote: > On Wed, Apr 20, 2022 at 5:11 PM Tyler Brock wrote: > >> For sure, I’m thinking of it that way. Thanks for confirming. >> >> What

Re: CLUSTER sort on abbreviated expressions is broken

2022-04-20 Thread Peter Geoghegan
On Tue, Apr 12, 2022 at 11:01 AM Peter Geoghegan wrote: > Attached patch fixes the issue, and includes the test case that you posted. Pushed a similar patch just now. Backpatched to all supported branches. -- Peter Geoghegan

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

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 5:11 PM Tyler Brock wrote: > For sure, I’m thinking of it that way. Thanks for confirming. > > 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)

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

2022-04-20 Thread Tyler Brock
For sure, I’m thinking of it that way. Thanks for confirming. 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. -Tyler On Ap

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

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 4:39 PM Tyler Brock wrote: > I think this makes sense but I wanted to get confirmation: > > I created a table with a column having the type int4 (integer). When I > insert a row with a number into that column and get it back out I've > observed a discrepancy: > > The DataR

doc: New cumulative stats subsystem obsoletes comment in maintenance.sgml

2022-04-20 Thread David G. Johnston
Hackers, The new cumulative stats subsystem no longer has a "lost under heavy load" problem so that parenthetical should go (or at least be modified). These stats can be reset so some discussion about how the system uses them given that possibility seems like it would be good to add here. I'm no

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

2022-04-20 Thread Tyler Brock
I think this makes sense but I wanted to get confirmation: I created a table with a column having the type int4 (integer). When I insert a row with a number into that column and get it back out I've observed a discrepancy: The DataRow message has the field encoded as an ASCII ‘7’ with a column le

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

2022-04-20 Thread Robert Haas
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 about like this in pg_databa

More problems with VacuumPageHit style global variables

2022-04-20 Thread Peter Geoghegan
My recent bugfix commit d3609dd2 addressed an issue with VACUUM VERBOSE. It would aggregate buffers hit/missed/dirtied counts incorrectly (by double counting), though only when there are multiple heap rels processed by the same VACUUM command. It failed to account for the fact that the VacuumPageHi

Re: typos

2022-04-20 Thread Justin Pryzby
On Wed, Apr 20, 2022 at 11:32:08PM +0200, Alvaro Herrera wrote: > On 2022-Apr-19, Alvaro Herrera wrote: > > > I propose we standardize on Zstd everywhere. > > Users can look it up if they're really interested. > > So the attached. > > There are other uses of zstd, but those are referring to > t

Assert failure in CTE inlining with view and correlated subquery

2022-04-20 Thread Tomas Vondra
Hi, it seems there's something wrong with CTE inlining when there's a view containing a correlated subquery referencing the CTE. Consider a simple example like this: create table results ( id serial primary key, run text, tps float4 ); creat

Re: typos

2022-04-20 Thread Alvaro Herrera
On 2022-Apr-19, Alvaro Herrera wrote: > I propose we standardize on Zstd everywhere. > Users can look it up if they're really interested. So the attached. There are other uses of zstd, but those are referring to the executable program. -- Álvaro Herrera PostgreSQL Developer — https:/

Re: Add version and data directory to initdb output

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 2:04 PM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 19.04.22 15:55, David G. Johnston wrote: > > The motivating situation had me placing it as close to the last line as > > possible so my 8 line or so tmux panel would show it to me without > > scrollin

Re: renumber_oids.pl needs some updates

2022-04-20 Thread Tom Lane
Peter Eisentraut writes: > On 20.04.22 22:45, Tom Lane wrote: >> The attached proposed patch invents a variant macro >> DECLARE_TOAST_WITH_MACRO for the relatively small number of cases >> where we need such OID macros. > This makes sense. > A more elaborate (future) project would be to have gen

Re: Add version and data directory to initdb output

2022-04-20 Thread Peter Eisentraut
On 19.04.22 15:55, David G. Johnston wrote: The motivating situation had me placing it as close to the last line as possible so my 8 line or so tmux panel would show it to me without scrolling.  The version is all I cared about, but when writing the patch the path seemed to be at least worth co

Re: [RFC] building postgres with meson -v8

2022-04-20 Thread Andres Freund
Hi, On 2022-04-13 12:26:05 +0200, Peter Eisentraut wrote: > Some feedback and patches for your branch at > 3274198960c139328fef3c725cee1468bbfff469: Thanks! I just rebased the branch, will merge your changes once the fallout from that is fixed... > 0001-Install-a-few-more-files.patch > > These

Re: renumber_oids.pl needs some updates

2022-04-20 Thread Peter Eisentraut
On 20.04.22 22:45, Tom Lane wrote: I think the right way to fix #2 is to put the responsibility for generating the #define's into genbki.pl, instead of this mistake-prone approach of duplicating the OID constants in the source code. The attached proposed patch invents a variant macro DECLARE_TOA

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

2022-04-20 Thread Tom Lane
Robert Haas writes: > On Wed, Apr 20, 2022 at 2:34 PM Tom Lane wrote: >> The attached draft patch attempts to improve this situation. >> It reserves these OIDs, and creates the associated macros, through >> the normal BKI infrastructure by adding entries in pg_database.dat. >> We have to delete t

Re: pg14 psql broke \d datname.nspname.relname

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 8:38 AM Thomas Munro wrote: > On Thu, Apr 21, 2022 at 7:35 AM Robert Haas wrote: > > On Wed, Apr 20, 2022 at 3:08 PM Thomas Munro wrote: > > > Looks like this somehow broke on a Windows box: > > > > > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=202

Re: Dump/Restore of non-default PKs

2022-04-20 Thread Peter Eisentraut
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 more custom options into SQL-standard constraint clauses, and we'll never fa

renumber_oids.pl needs some updates

2022-04-20 Thread Tom Lane
I did a test run of renumber_oids.pl to see if there would be any problems when the time comes (pretty soon!) to run it for v15. Depressingly enough, I found two problems: 1. When commit dfb75e478 invented DECLARE_UNIQUE_INDEX_PKEY, it neglected to teach renumber_oids.pl about it. I'm surprised w

Re: pg14 psql broke \d datname.nspname.relname

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 7:35 AM Robert Haas wrote: > On Wed, Apr 20, 2022 at 3:08 PM Thomas Munro wrote: > > Looks like this somehow broke on a Windows box: > > > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=2022-04-20%2016%3A34%3A19 > > So the issue here is that we are run

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

2022-04-20 Thread Tom Lane
Peter Eisentraut writes: > On 19.04.22 16:21, Tom Lane wrote: >> * In the other direction, decide that the PG_BINARY_X macros are >> offering no benefit at all and just rip 'em out, writing "rb" and >> so on in their place. POSIX specifies that the character "b" has >> no effect on Unix-oid syste

when should we set DB_IN_PRODUCTION?

2022-04-20 Thread Robert Haas
The following code doesn't make a lot of sense to me: /* * All done with end-of-recovery actions. * * Now allow backends to write WAL and update the control file status in * consequence. SharedRecoveryState, that controls if backends can write * WAL, is updated while

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

2022-04-20 Thread Peter Eisentraut
On 19.04.22 16:21, Tom Lane wrote: * In the other direction, decide that the PG_BINARY_X macros are offering no benefit at all and just rip 'em out, writing "rb" and so on in their place. POSIX specifies that the character "b" has no effect on Unix-oid systems, and it has said that for thirty

Re: Postgres perl module namespace

2022-04-20 Thread Andrew Dunstan
On 2022-04-19 Tu 20:30, Michael Paquier wrote: > On Tue, Apr 19, 2022 at 07:24:58PM -0400, Andrew Dunstan wrote: >> On 2022-04-19 Tu 18:39, Michael Paquier wrote: >>> +*generate_ascii_string = *TestLib::generate_ascii_string; >>> +*slurp_dir = *TestLib::slurp_dir; >>> +*slurp_file = *TestLib::slu

Re: pg14 psql broke \d datname.nspname.relname

2022-04-20 Thread Robert Haas
On Wed, Apr 20, 2022 at 3:08 PM Thomas Munro wrote: > Looks like this somehow broke on a Windows box: > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=2022-04-20%2016%3A34%3A19 So the issue here is that we are running this command: pg_dumpall --exclude-database .* And on th

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

2022-04-20 Thread Robert Haas
On Wed, Apr 20, 2022 at 2:34 PM Tom Lane wrote: > The attached draft patch attempts to improve this situation. > It reserves these OIDs, and creates the associated macros, through > the normal BKI infrastructure by adding entries in pg_database.dat. > We have to delete those rows again during init

Re: pg14 psql broke \d datname.nspname.relname

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 3:55 AM Robert Haas wrote: > On Tue, Apr 19, 2022 at 10:20 PM Mark Dilger > wrote: > > Looks like most people voted for (B). In support of that option, here are > > patches for master and REL_14_STABLE. Note that I extended the tests > > compared to v9, which found a p

Re: Bad estimate with partial index

2022-04-20 Thread Tom Lane
Tomas Vondra writes: > But dependencies.c might need a fix too, although the issue is somewhat > inverse to this one, because it looks like this: > if (IsA(clause, RestrictInfo)) > { > ... do some checks ... > } > so if there's no RestrictInfo on top, we just accept the claus

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

2022-04-20 Thread Tom Lane
Robert Haas writes: > On Sat, Jan 22, 2022 at 2:20 AM Shruthi Gowda wrote: >> Agree. In the latest patch, the template0 and postgres OIDs are fixed >> to unused manually assigned OIDs 4 and 5 respectively. These OIDs are >> no more listed as unused OIDs. > Thanks. Committed with a few more cosme

Re: Bad estimate with partial index

2022-04-20 Thread Tomas Vondra
On 4/20/22 16:15, Tom Lane wrote: > Tomas Vondra writes: >> The whole idea is that instead of bailing out for non-RestrictInfo case, >> it calculates the necessary information for the clause from scratch. >> This means relids and pseudoconstant flag, which are checked to decide >> if the clause

Re: effective_io_concurrency and NVMe devices

2022-04-20 Thread Nathan Bossart
On Tue, Apr 19, 2022 at 10:56:05PM -0400, Bruce Momjian wrote: > NVMe devices have a maximum queue length of 64k: > > https://blog.westerndigital.com/nvme-queues-explained/ > > but our effective_io_concurrency maximum is 1,000: > > test=> set effective_io_concurrency = 1001; >

Re: [Proposal] vacuumdb --schema only

2022-04-20 Thread Nathan Bossart
On Wed, Apr 20, 2022 at 12:40:52PM -0500, Justin Pryzby wrote: > On Wed, Apr 20, 2022 at 10:38:46AM -0700, Nathan Bossart wrote: >> Furthermore, do you think it'd be possible to dynamically generate the >> message? > > Not in the obvious way, because that breaks translatability. Ah, right. -- N

Re: [Proposal] vacuumdb --schema only

2022-04-20 Thread Justin Pryzby
On Wed, Apr 20, 2022 at 10:38:46AM -0700, Nathan Bossart wrote: > > +void > > +check_objfilter(VacObjectFilter curr_objfilter, VacObjectFilter > > curr_option) > > +{ > > + switch (curr_option) > > + { > > + case OBJFILTER_NONE: > > + break; > > + case OBJ

Re: [Proposal] vacuumdb --schema only

2022-04-20 Thread Nathan Bossart
Thanks for the new patch! I think this is on the right track. On Wed, Apr 20, 2022 at 05:15:02PM +0200, Gilles Darold wrote: > Le 18/04/2022 à 23:56, Nathan Bossart a écrit : >> > - if (!tables_listed) >> > + if (!objects_listed || objfilter == OBJFILTER_SCHEMA) >> Do we need to check for objec

Re: Postgres restart in the middle of exclusive backup and the presence of backup_label file

2022-04-20 Thread Stephen Frost
Greetings, * Martín Marqués (martin.marq...@gmail.com) wrote: > The typo is in `exist in in a running cluster`. There's two `in` in a row. Oops, thanks for catching (and thanks to Michael for committing the fix!). > P.D.: I was looking at this just because I was looking at an issue > where someo

Re: using an end-of-recovery record in all cases

2022-04-20 Thread Thomas Munro
On Thu, Apr 21, 2022 at 5:02 AM Nathan Bossart wrote: > I do see the problem if we drop an existing relation, crash, reuse the > filenode, and then crash again (all within the same checkpoint cycle). The > first recovery would remove the tombstone file, and the second recovery > would wipe out th

Re: using an end-of-recovery record in all cases

2022-04-20 Thread Nathan Bossart
On Wed, Apr 20, 2022 at 09:26:07AM -0400, Robert Haas wrote: > I was talking with Thomas Munro yesterday and he thinks there is a > problem with relfilenode reuse here. In normal running, when a > relation is dropped, we leave behind a 0-length file until the next > checkpoint; this keeps that relf

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Tom Lane
Peter Eisentraut writes: > On 18.04.22 20:53, Tom Lane wrote: >> A semantics-preserving conversion would have looked something like >> if (node->sortgrouprefs) >> WRITE_INDEX_ARRAY(sortgrouprefs, list_length(node->exprs)); > I think we could put the if (node->fldname) inside the

Re: generalized conveyor belt storage

2022-04-20 Thread Alvaro Herrera
On 2022-Apr-20, Robert Haas wrote: > I'll clean that up if I get back around to working on this. Right now > it's not clear to me how to get this integrated with vacuum in a > useful way, so finishing this part of it isn't that exciting, at least > not unless somebody else comes up with a cool use

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Peter Eisentraut
On 18.04.22 20:53, Tom Lane wrote: A semantics-preserving conversion would have looked something like if (node->sortgrouprefs) WRITE_INDEX_ARRAY(sortgrouprefs, list_length(node->exprs)); I suppose that Peter was trying to remove special cases from the outfuncs.c code, but do we wa

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Peter Eisentraut
On 18.04.22 09:35, Richard Guo wrote: The array sortgrouprefs[] inside PathTarget might be NULL if we have not identified sort/group columns in this tlist. In that case we would have a NULL pointer reference in _outPathTarget() when trying to print sortgrouprefs[] with WRITE_INDEX_ARRAY as we are

Re: pg14 psql broke \d datname.nspname.relname

2022-04-20 Thread Robert Haas
On Tue, Apr 19, 2022 at 10:20 PM Mark Dilger wrote: > Looks like most people voted for (B). In support of that option, here are > patches for master and REL_14_STABLE. Note that I extended the tests > compared to v9, which found a problem that is fixed for v10: OK, I committed these. I am not

Re: Are OIDs for pg_types constant?

2022-04-20 Thread Tyler Brock
Thank you Tom, this is exactly what I was looking for. -Tyler On Apr 20, 2022 at 11:23:59 AM, Tom Lane wrote: > Tyler Brock writes: > > I am writing a program that behaves like a Postgres backend and can see > > that if I select oid from pg_type that the type old’s could be returned in > > t

Re: Are OIDs for pg_types constant?

2022-04-20 Thread Tom Lane
Tyler Brock writes: > I am writing a program that behaves like a Postgres backend and can see > that if I select oid from pg_type that the type old’s could be returned in > the Row Description message for the field’s data type and that seems to > work. > However, I didn’t read anywhere that these

Are OIDs for pg_types constant?

2022-04-20 Thread Tyler Brock
Hi everyone, I am writing a program that behaves like a Postgres backend and can see that if I select oid from pg_type that the type old’s could be returned in the Row Description message for the field’s data type and that seems to work. However, I didn’t read anywhere that these are guaranteed t

Re: [Proposal] vacuumdb --schema only

2022-04-20 Thread Gilles Darold
Le 18/04/2022 à 23:56, Nathan Bossart a écrit : On Thu, Apr 14, 2022 at 10:27:46PM +0200, Gilles Darold wrote: Attached v8 of the patch that tries to address the remarks above, fixes patch apply failure to master and replace calls to pg_log_error+exit with pg_fatal. Thanks for the new patch.

Re: Temporary file access API

2022-04-20 Thread Antonin Houska
Robert Haas wrote: > On Tue, Apr 12, 2022 at 5:30 AM Antonin Houska wrote: > > Robert Haas wrote: > > > On Mon, Apr 11, 2022 at 4:05 AM Antonin Houska wrote: > > > > There are't really that many kinds of files to encrypt: > > > > > > > > https://wiki.postgresql.org/wiki/Transparent_Data_Encryp

RE: Bad estimate with partial index

2022-04-20 Thread André Hänsel
Tomas Vondra wrote: > Andre, are you in position to test this fix with your application? Which > Postgres version are you using, actually? There's a test case in my original email, which obviously was synthetic, but I could also test this with my original application data if I can get a Postgres

Re: Bad estimate with partial index

2022-04-20 Thread Tom Lane
Tomas Vondra writes: > The whole idea is that instead of bailing out for non-RestrictInfo case, > it calculates the necessary information for the clause from scratch. > This means relids and pseudoconstant flag, which are checked to decide > if the clause is compatible with extended stats. Right.

Re: Re: fix cost subqueryscan wrong parallel cost

2022-04-20 Thread Robert Haas
On Wed, Apr 20, 2022 at 10:01 AM bu...@sohu.com wrote: > 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 S

Re: generalized conveyor belt storage

2022-04-20 Thread Robert Haas
On Wed, Apr 20, 2022 at 8:32 AM Thom Brown wrote: > On Wed, 20 Apr 2022 at 13:02, Alvaro Herrera wrote: > > What's with the free text in cbstorage.h? I would guess that this > > wouldn't even compile, and nobody has noticed because the file is not > > included by anything yet ... > > I'm not abl

Re: generalized conveyor belt storage

2022-04-20 Thread Robert Haas
On Wed, Apr 20, 2022 at 8:02 AM Alvaro Herrera wrote: > What's with the free text in cbstorage.h? I would guess that this > wouldn't even compile, and nobody has noticed because the file is not > included by anything yet ... I think I was using that file for random notes with the idea of removin

Re: Re: fix cost subqueryscan wrong parallel cost

2022-04-20 Thread bu...@sohu.com
> Sure, but that doesn't make the patch correct. The patch proposes > that, when parallelism in use, a subquery scan will produce fewer rows > than when parallelism is not in use, and that's 100% false. Compare > this with the case of a parallel sequential scan. If a table contains > 1000 rows, and

Re: Odd off-by-one dirty buffers and checkpoint buffers written

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 1:03 AM Kyotaro Horiguchi wrote: > > The reason for the 2 hits of Xact SLRU is that once for visibility > (MVCC) check and another for commit. > > Makes sense. Thanks. Now, is the lack of such a detail when looking at pg_stat_slru (for this and the other 6 named caches)

Re: Bad estimate with partial index

2022-04-20 Thread Tomas Vondra
On 4/20/22 09:58, Tomas Vondra wrote: > On 4/19/22 23:08, Tom Lane wrote: >> I wrote: >>> it looks like the problem is that the extended stats haven't been used >>> while forming the estimate of the number of index entries retrieved, so >>> we overestimate the cost of using this index. >>> That s

Re: using an end-of-recovery record in all cases

2022-04-20 Thread Robert Haas
On Tue, Apr 19, 2022 at 4:38 PM Nathan Bossart wrote: > Shouldn't latestCompletedXid be set to MaxTransactionId in this case? Or > is this related to the logic in FullTransactionIdRetreat() that avoids > skipping over the "actual" special transaction IDs? The problem here is this code: /* a

Re: [RFC] building postgres with meson -v8

2022-04-20 Thread Peter Eisentraut
On 13.04.22 12:26, Peter Eisentraut wrote: Some feedback and patches for your branch at 3274198960c139328fef3c725cee1468bbfff469: Here is another patch. It adds support for building ecpg.From 35a23442727cdf82558c7e5eab85bc29df86b5d5 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 2

Re: Logical replication timeout problem

2022-04-20 Thread Masahiko Sawada
On Wed, Apr 20, 2022 at 7:12 PM Amit Kapila wrote: > > On Wed, Apr 20, 2022 at 2:38 PM Amit Kapila wrote: > > > > On Wed, Apr 20, 2022 at 12:51 PM Masahiko Sawada > > wrote: > > > > > > On Wed, Apr 20, 2022 at 11:46 AM wangw.f...@fujitsu.com > > > wrote: > > > > ``` > > > > > > I'm concerned t

RE: Documentation issue with pg_stat_recovery_prefetch

2022-04-20 Thread Shinoda, Noriyoshi (PN Japan FSIP)
Hi, Thank you for developing the new feature. The pg_stat_recovery_prefetch view documentation doesn't seem to have a description of the stats_reset column. The attached small patch adds a description of the stats_reset column. Regards, Noriyoshi Shinoda -Original Message- From: Thoma

Re: generalized conveyor belt storage

2022-04-20 Thread Thom Brown
On Wed, 20 Apr 2022 at 13:02, Alvaro Herrera wrote: > > What's with the free text in cbstorage.h? I would guess that this > wouldn't even compile, and nobody has noticed because the file is not > included by anything yet ... I'm not able to compile: cbfsmpage.c: In function ‘cb_fsmpage_initiali

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

2022-04-20 Thread houzj.f...@fujitsu.com
On Wednesday, April 20, 2022 4:57 PM houzj.f...@fujitsu.com wrote: > > On Tuesday, April 19, 2022 2:58 PM Amit Kapila > wrote: > > > > On Thu, Apr 14, 2022 at 9:12 AM houzj.f...@fujitsu.com > > wrote: > > > > > > On Friday, April 8, 2022 5:14 PM houzj.f...@fujitsu.com > > wrote: > > > > > > Att

Re: generalized conveyor belt storage

2022-04-20 Thread Alvaro Herrera
What's with the free text in cbstorage.h? I would guess that this wouldn't even compile, and nobody has noticed because the file is not included by anything yet ... -- Álvaro HerreraBreisgau, Deutschland — https://www.EnterpriseDB.com/ #error "Operator lives in the wrong universe" ("

Re: typos

2022-04-20 Thread Alvaro Herrera
On 2022-Apr-20, Amit Kapila wrote: > Your proposed changes look good to me but I think all these places > need to mention 'column list' as well because the behavior is the same > for it. Hmm, you're right. Added that, and changed the wording somewhat because some things read awkwardly. Here's t

Re: minor MERGE cleanups

2022-04-20 Thread Alvaro Herrera
On 2022-Apr-20, Michael Paquier wrote: > On Tue, Apr 19, 2022 at 03:45:22PM +0200, Alvaro Herrera wrote: > > I expect these fixups in new code should be uncontroversial. > > The whole set looks rather sane to me. Thank you, I have pushed them. -- Álvaro HerreraBreisgau, Deutschland —

Re: TRAP: FailedAssertion("tabstat->trans == trans", File: "pgstat_relation.c", Line: 508

2022-04-20 Thread Erik Rijkers
Op 20-04-2022 om 06:54 schreef Kyotaro Horiguchi: At Tue, 19 Apr 2022 10:55:26 -0700, Andres Freund wrote in Hi, On 2022-04-19 10:36:24 -0700, Andres Freund wrote: On 2022-04-19 13:50:25 +0200, Erik Rijkers wrote: The 12th run of statbug.sh crashed and gave a corefile. I ran through quite

Re: Logical replication timeout problem

2022-04-20 Thread Amit Kapila
On Wed, Apr 20, 2022 at 2:38 PM Amit Kapila wrote: > > On Wed, Apr 20, 2022 at 12:51 PM Masahiko Sawada > wrote: > > > > On Wed, Apr 20, 2022 at 11:46 AM wangw.f...@fujitsu.com > > wrote: > > > ``` > > > > I'm concerned that this 4-byte padding at the end of the struct could > > depend on platf

Re: Dump/Restore of non-default PKs

2022-04-20 Thread Simon Riggs
On Wed, 20 Apr 2022 at 03:05, David G. Johnston wrote: > https://www.postgresql.org/docs/current/sql-altertable.html > ADD table_constraint_using_index > ...This form is not currently supported on partitioned tables. Good to know, thanks very much for pointing it out. That needs to be fixed bef

Re: [PATCH] Add native windows on arm64 support

2022-04-20 Thread Niyas Sait
> Have you tested with the amount of coverage provided by vcregress.pl? I built and ran the relevant tests with the help of run_build.pl. I think following tests are executed - check, contribcheck, ecpgcheck, installcheck, isolationcheck, modulescheck, and upgradecheck. > Another thing I was won

Re: Logical replication timeout problem

2022-04-20 Thread Amit Kapila
On Wed, Apr 20, 2022 at 12:51 PM Masahiko Sawada wrote: > > On Wed, Apr 20, 2022 at 11:46 AM wangw.f...@fujitsu.com > wrote: > > ``` > > I'm concerned that this 4-byte padding at the end of the struct could > depend on platforms (there might be no padding in 32-bit platforms?). > Good point, but

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

2022-04-20 Thread houzj.f...@fujitsu.com
On Tuesday, April 19, 2022 2:58 PM Amit Kapila wrote: > > On Thu, Apr 14, 2022 at 9:12 AM houzj.f...@fujitsu.com > wrote: > > > > On Friday, April 8, 2022 5:14 PM houzj.f...@fujitsu.com > wrote: > > > > Attach a new version patch which improved the error handling and handled > the case > > when

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

2022-04-20 Thread Kyotaro Horiguchi
At Tue, 19 Apr 2022 12:13:51 -0400, Robert Haas wrote in > 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 adding -m for the reason of being hard to > > name it.. > > Hmm, yeah,

Re: Odd off-by-one dirty buffers and checkpoint buffers written

2022-04-20 Thread Kyotaro Horiguchi
At Tue, 19 Apr 2022 17:51:24 -0700, "David G. Johnston" wrote in > On Tue, Apr 19, 2022 at 4:36 PM Nathan Bossart > wrote: > > > On Tue, Apr 19, 2022 at 04:21:21PM -0700, David G. Johnston wrote: > > > I've done this four times in a row and while the number of dirty buffers > > > shown each ti

Re: Bad estimate with partial index

2022-04-20 Thread Tomas Vondra
On 4/19/22 23:08, Tom Lane wrote: > I wrote: >> it looks like the problem is that the extended stats haven't been used >> while forming the estimate of the number of index entries retrieved, so >> we overestimate the cost of using this index. >> That seems like a bug. Tomas? > > I dug into this e

Re: Logical replication timeout problem

2022-04-20 Thread Masahiko Sawada
On Wed, Apr 20, 2022 at 11:46 AM wangw.f...@fujitsu.com wrote: > > On Mon, Apr 18, 2022 at 00:36 PM Amit Kapila wrote: > > On Mon, Apr 18, 2022 at 9:29 AM Amit Kapila wrote: > > > > > > On Thu, Apr 14, 2022 at 5:52 PM Euler Taveira wrote: > > > > > > > > On Wed, Apr 13, 2022, at 7:45 AM, Amit K