Re: RFC: Logging plan of the running query

2023-09-14 Thread Lepikhov Andrei
On Thu, Sep 7, 2023, at 1:09 PM, torikoshia wrote: > On 2023-09-06 11:17, James Coleman wrote: > It seems that we can know what queries were running from the stack > traces you shared. > As described above, I suspect a lock which was acquired prior to > ProcessLogQueryPlanInterrupt() caused the i

Re: Bug fix for psql's meta-command \ev

2023-09-14 Thread Kyotaro Horiguchi
At Fri, 15 Sep 2023 11:37:46 +0900, Ryoga Yoshida wrote in > I think this is a bug in psql's \ev meta-command. Even when \ev fails, > it should not leave the garbage string in psql's query buffer and the > following query should be completed successfully. Good catch! I agree to this. > This pr

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-14 Thread Amit Kapila
On Fri, Sep 15, 2023 at 8:43 AM Hayato Kuroda (Fujitsu) wrote: > Few comments: 1. Why is the FPI record (XLOG_FPI_FOR_HINT) not considered a record to be ignored? This can be generated during reading system tables. 2. +binary_upgrade_validate_wal_record_types_after_lsn(PG_FUNCTION_ARGS) { ... +

Re: CHECK Constraint Deferrable

2023-09-14 Thread vignesh C
On Thu, 14 Sept 2023 at 15:33, Himanshu Upadhyaya wrote: > > > > On Thu, Sep 14, 2023 at 9:57 AM vignesh C wrote: >> >> 3) Insert check is not deferred to commit: >> This insert check here is deferred to commit: >> postgres=# CREATE TABLE tbl (i int ) partition by range (i); >> CREATE TABLE tbl_1

Re: Bug fix for psql's meta-command \ev

2023-09-14 Thread Michael Paquier
On Fri, Sep 15, 2023 at 11:37:46AM +0900, Ryoga Yoshida wrote: > I think this is a bug in psql's \ev meta-command. Even when \ev fails, it > should not leave the garbage string in psql's query buffer and the following > query should be completed successfully. Right. Good catch. Will look at that

Re: Have better wording for snapshot file reading failure

2023-09-14 Thread Michael Paquier
On Thu, Sep 14, 2023 at 05:33:35PM -0700, Andres Freund wrote: > I'd probably just go for something like "snapshot \"%s\" does not exist", > similar to what we report for unknown tables etc. Arguably changing the > errcode to ERRCODE_UNDEFINED_OBJECT would make this more precise? Good points. Upd

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-14 Thread Hayato Kuroda (Fujitsu)
Dear Peter, Thank you for reviewing! New patch is available in [1]. > 1. > Configure the servers for log shipping. (You do not need to run > pg_backup_start() and > pg_backup_stop() > or take a file system backup as the standbys are still synchronized > - with the p

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-14 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Again, thank you for reviewing! New patch is available in [1]. > 2. > + /* > + * Store the names of output plugins as well. There is a possibility > + * that duplicated plugins are set, but the consumer function > + * check_loadable_libraries() will avoid checking the same library, so

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-14 Thread Hayato Kuroda (Fujitsu)
Dear hackers, > > So basically, while scanning from confirmed_flush we must ensure that > > we find a first record as SHUTDOWN CHECKPOINT record at the same LSN, > > and after that, we should not get any other WAL other than like you > > said shutdown checkpoint, running_xacts. That way we will e

RE: logical decoding and replication of sequences, take 2

2023-09-14 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 16, 2023 10:27 PM Tomas Vondra wrote: Hi, > > > I guess we could update the origin, per attached 0004. We don't have > timestamp to set replorigin_session_origin_timestamp, but it seems we don't > need that. > > The attached patch merges the earlier improvements, except

Re: bug fix and documentation improvement about vacuumdb

2023-09-14 Thread Kyotaro Horiguchi
At Thu, 14 Sep 2023 07:57:57 -0700, Nathan Bossart wrote in > On Thu, Sep 14, 2023 at 02:06:51PM +0200, Daniel Gustafsson wrote: > > I can reproduce that, a single -N works but adding multiple -N's makes none > > of > > them excluded. The current coding does this: > > > > if (objfilter & O

Bug fix for psql's meta-command \ev

2023-09-14 Thread Ryoga Yoshida
Hi, When a table name is specified as the first argument of \ev meta-command, it reports the error message, the prompt string becomes "-#" and then the following valid query fails because the psql's query buffer contains the garbage string generated by failure of \ev. Please see the following

Re: Extract numeric filed in JSONB more effectively

2023-09-14 Thread Andy Fan
> Is there a reason not to transform the _tz flavors of >> jsonb_path_query and jsonb_path-query_first? >> > > I misunderstood the _tz flavors return timestamp, after some deep > reading of these functions, they just work at the comparisons part. > so I will add them in the following version. > _

Re: Is it possible to change wal_level online

2023-09-14 Thread Andres Freund
Hi, On September 14, 2023 6:21:59 AM PDT, Euler Taveira wrote: >On Thu, Sep 14, 2023, at 7:05 AM, Andy Fan wrote: >> Currently it is complained that wal_level changes require an instance >> restart, I'm not familiar with this stuff so far and I didn't get any good >> information from searching

Re: Fixup the variable name to indicate the WAL record reservation status.

2023-09-14 Thread Kyotaro Horiguchi
At Wed, 13 Sep 2023 23:48:30 -0700, Krishnakumar R wrote in > Please find a small patch to improve code readability by fixing up the > variable name to indicate the WAL record reservation status. The > insertion is done later in the code based on the reservation status. IMHO... Although "reserv

Re: Have better wording for snapshot file reading failure

2023-09-14 Thread Andres Freund
Hi, On 2023-09-14 16:29:22 +0900, Michael Paquier wrote: > On Thu, Sep 14, 2023 at 01:33:39PM +0900, Michael Paquier wrote: > > Ahem. This seems to be the only code path that tracks a failure on > > AllocateFile() where we don't show %m at all, while the error is > > misleading in basically all t

Re: Support prepared statement invalidation when result types change

2023-09-14 Thread Andy Fan
Hi, > > This requirement was not documented anywhere and it > can thus be a surprising error to hit. But it's actually not needed for > this to be an error, as long as we send the correct RowDescription there > does not have to be a problem for clients when the result types or > column counts cha

Re: Is it possible to change wal_level online

2023-09-14 Thread Andy Fan
On Thu, Sep 14, 2023 at 9:22 PM Euler Taveira wrote: > On Thu, Sep 14, 2023, at 7:05 AM, Andy Fan wrote: > > Currently it is complained that wal_level changes require an instance > restart, I'm not familiar with this stuff so far and I didn't get any good > information from searching the email a

Re: [PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-14 Thread Michael Paquier
On Thu, Sep 14, 2023 at 01:33:04PM +0200, Jim Jones wrote: > Just to make sure I got what you have in mind: you suggest to read the > pg_hba.conf a second time via a new (generic) function like pg_read_file() > that returns line numbers and their contents (+comments), and the results of > this new

Re: Buffer ReadMe Confuse

2023-09-14 Thread Andy Fan
On Fri, Sep 15, 2023 at 4:08 AM jacktby jacktby wrote: > In buffer README, I see “Pins may not be held across transaction > boundaries, however.” I think for different transactions, they can pin the > same buffer page, why not? For concurrent read transactions, they could > read the one and the s

Re: Cygwin cleanup

2023-09-14 Thread Thomas Munro
On Wed, Feb 8, 2023 at 8:06 PM Thomas Munro wrote: > On Fri, Jan 13, 2023 at 5:17 PM Justin Pryzby wrote: > > My patch used fsync_fname_ext() which would cause an ERROR rather than a > > PANIC when failing to fsync the logical decoding pathname. > > FTR While analysing a lot of CI logs trying to

Re: subscription TAP test has unused $result

2023-09-14 Thread Peter Smith
On Thu, Sep 14, 2023 at 7:10 PM Amit Kapila wrote: > > > Though it is harmless I think we can clean it up. Your patch looks good to > > me. > > > > Pushed. > Thanks! -- Kind Regards, Peter Smith. Fujitsu Australia

Re: Add 'worker_type' to pg_stat_subscription

2023-09-14 Thread Nathan Bossart
On Wed, Sep 13, 2023 at 09:59:04AM -0700, Nathan Bossart wrote: > On Wed, Sep 13, 2023 at 05:06:28PM +0300, Maxim Orlov wrote: >> So, should we mark this thread as RfC? > > I've done so. Barring additional feedback, I intend to commit this in the > next few days. I did some staging work for the

Re: [PATCH] Add CANONICAL option to xmlserialize

2023-09-14 Thread Thomas Munro
On Thu, Sep 14, 2023 at 11:54 PM Jim Jones wrote: > The cfbot started complaining about this patch on "macOS - Ventura - Meson" > > 'Persistent worker failed to start the task: tart isolation failed: failed to > create VM cloned from "ghcr.io/cirruslabs/macos-ventura-base:latest": tart > command

Re: psql: Add command to use extended query protocol

2023-09-14 Thread Tobias Bussmann
In one of my environments, this feature didn't work as expected. Digging into it, I found that it is incompatible with FETCH_COUNT being set. Sorry for not recognising this during the betas. Attached a simple patch with tests running the cursor declaration through PQexecParams instead of PGexec

Re: Detoasting optionally to make Explain-Analyze less misleading

2023-09-14 Thread stepan rutz
Hi Tom, Hi Matthias, you are right of course. I have looked at the code from printtup.c and made a new version of the patch. Thanks for the MemoryContextReset hint too (@Matthias) This time is called  EXPLAIN(ANALYZE,SERIALIZE) (hey, it also sounds nicer phonetically) If the option SERIALIZE i

Re: SQL:2011 application time

2023-09-14 Thread Paul Jungwirth
On 9/7/23 18:24, jian he wrote: for a range primary key, is it fine to expect it to be unique, not null and also not overlap? (i am not sure how hard to implement it). - quote from 7IWD2-02-Foundation-2011-12.pdf. 4.18.3.2 Unique co

Buffer ReadMe Confuse

2023-09-14 Thread jacktby jacktby
In buffer README, I see “Pins may not be held across transaction boundaries, however.” I think for different transactions, they can pin the same buffer page, why not? For concurrent read transactions, they could read the one and the same buffer page.

Re: bug fix and documentation improvement about vacuumdb

2023-09-14 Thread Nathan Bossart
On Thu, Sep 14, 2023 at 02:06:51PM +0200, Daniel Gustafsson wrote: >> On 14 Sep 2023, at 13:21, Kuwamura Masaki >> wrote: > >> PATTERN should be changed to SCHEMA because -n and -N options don't support >> pattern matching for schema names. The attached patch 0001 fixes this. > > True, there i

Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression

2023-09-14 Thread Ashutosh Bapat
Hi Amul, I share others opinion that this feature is useful. >> On Fri, 25 Aug 2023 at 03:06, Vik Fearing wrote: >>> >>> >>> I don't like this part of the patch at all. Not only is the >>> documentation only half baked, but the entire concept of the two >>> commands is different. Especially sin

Re: Is it possible to change wal_level online

2023-09-14 Thread Euler Taveira
On Thu, Sep 14, 2023, at 7:05 AM, Andy Fan wrote: > Currently it is complained that wal_level changes require an instance > restart, I'm not familiar with this stuff so far and I didn't get any good > information from searching the email archive. So I want to gather > some feedbacks from experts

Re: What's the eviction algorithm of newest pg version?

2023-09-14 Thread David Rowley
On Fri, 15 Sept 2023 at 00:53, jacktby jacktby wrote: > A normal LRU cache or implement it reference to a research paper? src/backend/storage/buffer/README David

Re: bug fix and documentation improvement about vacuumdb

2023-09-14 Thread Daniel Gustafsson
> On 14 Sep 2023, at 13:21, Kuwamura Masaki > wrote: > PATTERN should be changed to SCHEMA because -n and -N options don't support > pattern matching for schema names. The attached patch 0001 fixes this. True, there is no pattern matching performed. I wonder if it's worth lifting the pattern

Re: [PATCH] Add CANONICAL option to xmlserialize

2023-09-14 Thread Jim Jones
The cfbot started complaining about this patch on "macOS - Ventura - Meson" 'Persistent worker failed to start the task: tart isolation failed: failed to create VM cloned from "ghcr.io/cirruslabs/macos-ventura-base:latest": tart command returned non-zero exit code: ""' Is this a problem in m

What's the eviction algorithm of newest pg version?

2023-09-14 Thread jacktby jacktby
A normal LRU cache or implement it reference to a research paper?

Re: [PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-14 Thread Jim Jones
Hi On 11.09.23 00:33, Michael Paquier wrote: Well, it looks like what I wrote a couple of days ago was perhaps confusing: https://www.postgresql.org/message-id/ZPHAiNp%2ByKMsa/vc%40paquier.xyz https://www.postgresql.org/message-id/zpe8a7enuh+ax...@paquier.xyz This patch touches hbafuncs.c and t

bug fix and documentation improvement about vacuumdb

2023-09-14 Thread Kuwamura Masaki
Hi there, I have 1 trivial fix, 1 bug fix, and 1 suggestion about vacuumdb. First, I noticed that the help message of `vacuumdb` is a bit incorrect. `vacuumdb -?` displays the following message ``` ... -n, --schema=PATTERNvacuum tables in the specified schema(s) only -N, --exclud

Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning

2023-09-14 Thread Ashutosh Bapat
Hi All, On Fri, Aug 11, 2023 at 6:24 PM Ashutosh Bapat wrote: > > Obtaining child clauses from parent clauses by translation and > tracking the translations is less complex and may be more efficient > too. I will post a patch on those lines soon. > PFA patch set to add infrastructure to track Re

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-14 Thread Ranier Vilela
Em qua., 13 de set. de 2023 às 22:32, Michael Paquier escreveu: > On Wed, Sep 13, 2023 at 08:14:11AM -0700, Jeff Davis wrote: > > Looks good to me, thank you. > > Applied, then. Thanks. > Thank you Michael, for the commit. best regards, Ranier Vilela

Re: Index range search optimization

2023-09-14 Thread Alexander Korotkov
Hi! On Fri, Jun 23, 2023 at 10:36 AM Konstantin Knizhnik wrote: > _bt_readpage performs key check for each item on the page trying to locate > upper boundary. > While comparison of simple integer keys are very fast, comparison of long > strings can be quite expensive. > We can first make check f

Is it possible to change wal_level online

2023-09-14 Thread Andy Fan
Hi, Currently it is complained that wal_level changes require an instance restart, I'm not familiar with this stuff so far and I didn't get any good information from searching the email archive. So I want to gather some feedbacks from experts to see if it is possible and if not, why it would be

Re: CHECK Constraint Deferrable

2023-09-14 Thread Himanshu Upadhyaya
On Thu, Sep 14, 2023 at 9:57 AM vignesh C wrote: > 3) Insert check is not deferred to commit: > This insert check here is deferred to commit: > postgres=# CREATE TABLE tbl (i int ) partition by range (i); > CREATE TABLE tbl_1 PARTITION OF tbl FOR VALUES FROM (0) TO (10); > CREATE TABLE tbl_2 PART

Re: [PATCH] Add native windows on arm64 support

2023-09-14 Thread Daniel Gustafsson
> On 13 Sep 2023, at 21:12, Peter Eisentraut wrote: > > On 31.08.23 06:44, Tom Lane wrote: >> I agree. I'm really uncomfortable with claiming support for >> Windows-on-ARM if we don't have a buildfarm member testing it. >> For other platforms that have a track record of multiple >> hardware supp

Re: Small patch modifying variable name to reflect the logic involved

2023-09-14 Thread Daniel Gustafsson
> On 14 Sep 2023, at 08:28, Krishnakumar R wrote: > Please find a small patch to improve code readability by modifying > variable name to reflect the logic involved - finding diff between end > and start time of WAL sync. - INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_sync_time, duration, sta

Re: Quoting filename in using facing log messages

2023-09-14 Thread Daniel Gustafsson
> On 14 Sep 2023, at 09:56, Michael Paquier wrote: > (I'm OK with your patch as well, FWIW.) Thanks for looking, pushed. -- Daniel Gustafsson

Re: persist logical slots to disk during shutdown checkpoint

2023-09-14 Thread Amit Kapila
On Thu, Sep 14, 2023 at 7:20 AM Michael Paquier wrote: > > On Wed, Sep 13, 2023 at 04:20:37PM +0530, Amit Kapila wrote: > > The patch is updated as per recent discussion. > > WFM. Thanks for the updated version. > Pushed. -- With Regards, Amit Kapila.

Re: subscription TAP test has unused $result

2023-09-14 Thread Amit Kapila
On Wed, Sep 13, 2023 at 10:14 AM Amit Kapila wrote: > > On Wed, Sep 13, 2023 at 8:43 AM Peter Smith wrote: > > > > Yesterday noticed a TAP test assignment to an unused $result. > > > > PSA patch to remove that. > > > > Though it is harmless I think we can clean it up. Your patch looks good to me.

Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression

2023-09-14 Thread Amul Sul
On Wed, Sep 13, 2023 at 2:28 PM Maxim Orlov wrote: > Hi! > > I'm pretty much like the idea of the patch. Looks like an overlook in SQL > standard for me. > Anyway, patch apply with no conflicts and implements described > functionality. > > Thank you for looking at this. > On Fri, 25 Aug 2023 at

Re: Reducing connection overhead in pg_upgrade compat check phase

2023-09-14 Thread Daniel Gustafsson
> On 13 Sep 2023, at 16:12, Peter Eisentraut wrote: > The alignment of this output looks a bit funny: > > ... > Checking for prepared transactionsok > Checking for contrib/isn with bigint-passing mismatch ok > Checking for data type usage

Re: Redundant Unique plan node for table with a unique index

2023-09-14 Thread Damir Belyalov
Thank you for feedback and thread [1]. Regards, Damir Belyalov Postgres Professional

Re: [dynahash] do not refill the hashkey after hash_search

2023-09-14 Thread Junwang Zhao
On Wed, Sep 13, 2023 at 5:28 PM John Naylor wrote: > > > On Wed, Sep 13, 2023 at 3:46 PM Junwang Zhao wrote: > > > > On Wed, Sep 13, 2023 at 4:22 PM John Naylor > > wrote: > > > > - memset(part_entry, 0, sizeof(LogicalRepPartMapEntry)); > > > - part_entry->partoid = partOid; > > > + Assert(part_

Re: information_schema and not-null constraints

2023-09-14 Thread Peter Eisentraut
On 06.09.23 19:52, Alvaro Herrera wrote: +SELECT current_database()::information_schema.sql_identifier AS constraint_catalog, + rs.nspname::information_schema.sql_identifier AS constraint_schema, + con.conname::information_schema.sql_identifier AS constraint_name, +

Re: Cleaning up array_in()

2023-09-14 Thread jian he
On Thu, Sep 14, 2023 at 2:00 PM Alexander Lakhin wrote: > > > I didn't mean to remove the prefix "array_in-", but in fact I was confused > by the "{function_name}-" syntax, and now when I've looked at it closely, I > see that that syntax was quite popular ("date_in- ", "single_decode- ", ...) > ba

Re: Quoting filename in using facing log messages

2023-09-14 Thread Michael Paquier
On Wed, Sep 13, 2023 at 02:02:47PM +0200, Daniel Gustafsson wrote: > It might be worth concatenating the errmsg() while there since we typically > don't linebreak errmsg strings anymore for greppability: > > - errmsg("could not write to log file %s " > - "at offset %u, length %zu:

Re: Have better wording for snapshot file reading failure

2023-09-14 Thread Michael Paquier
On Thu, Sep 14, 2023 at 01:33:39PM +0900, Michael Paquier wrote: > Ahem. This seems to be the only code path that tracks a failure on > AllocateFile() where we don't show %m at all, while the error is > misleading in basically all the cases as errno holds the extra > information telling somebody t

Re: Document that PG_TRY block cannot have a return statement

2023-09-14 Thread Serpent
Hi, What about this wording: The code that might throw ereport(ERROR) cannot contain any non local control flow other than ereport(ERROR) e.g.: return, goto, break, continue. In other words once PG_TRY() is executed, either PG_CATCH() or PG_FINALLY() must be executed as well. I used 'code that m