Re: Replication & recovery_min_apply_delay

2021-11-13 Thread Dilip Kumar
On Wed, Oct 27, 2021 at 1:01 AM Mahendra Singh Thalor wrote: I was going through and patch and trying to understand the idea that what we are trying to achieve here. So basically, generally we start the WAL receiver when we want to fetch the WAL, but if the user has set the parameter

Re: Inconsistent error message for varchar(n)

2021-11-13 Thread Japin Li
On Sat, 13 Nov 2021 at 23:42, Tom Lane wrote: > Japin Li writes: >> postgres=# CREATE TABLE tbl (s varchar(2147483647)); >> ERROR: length for type varchar cannot exceed 10485760 >> LINE 1: CREATE TABLE tbl (s varchar(2147483647)); >> ^ > >> postgres=# CREATE TABLE

Re: support for MERGE

2021-11-13 Thread Justin Pryzby
On Fri, Nov 12, 2021 at 02:57:57PM -0300, Alvaro Herrera wrote: > Here's a new version. Many of the old complaints have been fixed; I should've replied to this newer message. I also read through the code a bit and have some more language fixes, mostly. I ran sqlsmith for a few hours with no

Re: support for MERGE

2021-11-13 Thread Justin Pryzby
On Thu, Dec 31, 2020 at 10:47:36AM -0300, Alvaro Herrera wrote: > Here's a rebase of Simon/Pavan's MERGE patch to current sources. I > cleaned up some minor things in it, but aside from rebasing, it's pretty > much their work (even the commit message is Simon's). > > Adding to commitfest. I

Re: ALTER TABLE DETACH PARTITION violates serializability

2021-11-13 Thread Tom Lane
Alvaro Herrera writes: > On 2021-Nov-12, Tom Lane wrote: >> How about adding an option UNSAFE (orthogonal to CONCURRENTLY) that >> activates the current behavior, and without it we wait for everything? > Something like that might be the best compromise. I don't like having > to grab AEL on the

Re: support for MERGE

2021-11-13 Thread Zhihong Yu
On Sat, Nov 13, 2021 at 7:41 AM Alvaro Herrera wrote: > On 2021-Nov-12, Zhihong Yu wrote: > > > +lmerge_matched: > > ... > > + foreach(l, resultRelInfo->ri_matchedMergeAction) > > > > I suggest expanding the foreach macro into the form of for loop where the > > loop condition has extra boolean

Re: Allow users to choose what happens when recovery target is not reached

2021-11-13 Thread Euler Taveira
On Sat, Nov 13, 2021, at 10:15 AM, Bharath Rupireddy wrote: > Firstly, the proposed patch adds no new behaviour as such, it just > gives the ability that is existing today on v12 and below (prior to > commit dc78866 which went into v13 and later). It reintroduces an awkward behavior [1]. > I

Re: Inconsistent error message for varchar(n)

2021-11-13 Thread Tom Lane
Japin Li writes: > postgres=# CREATE TABLE tbl (s varchar(2147483647)); > ERROR: length for type varchar cannot exceed 10485760 > LINE 1: CREATE TABLE tbl (s varchar(2147483647)); > ^ > postgres=# CREATE TABLE tbl (s varchar(2147483648)); > ERROR: syntax error at or

Re: support for MERGE

2021-11-13 Thread Alvaro Herrera
On 2021-Nov-12, Zhihong Yu wrote: > +lmerge_matched: > ... > + foreach(l, resultRelInfo->ri_matchedMergeAction) > > I suggest expanding the foreach macro into the form of for loop where the > loop condition has extra boolean variable merge_matched. > Initial value for merge_matched can be

Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display

2021-11-13 Thread Alvaro Herrera
A bunch of these now execute snprintf()s unnecessarily. I think these should be made conditional on message_level_is_interesting(DEBUG1) to avoid that overhead. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "You're _really_ hosed if the person doing the hiring

Re: ALTER TABLE DETACH PARTITION violates serializability

2021-11-13 Thread Alvaro Herrera
On 2021-Nov-12, Tom Lane wrote: > Meh ... "wrong by default" doesn't seem like it fits the Postgres ethos. I certainly agree with this, yeah. > How about adding an option UNSAFE (orthogonal to CONCURRENTLY) that > activates the current behavior, and without it we wait for everything? Something

Re: support for MERGE

2021-11-13 Thread Alvaro Herrera
On 2021-Nov-12, Zhihong Yu wrote: > This is continuation of review. > > + elog(WARNING, "hoping nothing needed here"); > > the above warning can be dropped. Hmm, yeah, the fact that this doesn't show up in the logs anywhere suggests that there is a gap in testing. -- Álvaro

Re: support for MERGE

2021-11-13 Thread Álvaro Herrera
On 2021-Nov-13, Daniel Westermann wrote: > /usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 > -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -flto=thin > -emit-llvm -c -o execMerge.bc execMerge.c > execMerge.c:552:32: warning: if statement has empty body

Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation

2021-11-13 Thread Bharath Rupireddy
On Sat, Nov 13, 2021 at 7:16 PM Euler Taveira wrote: > Thanks. It is a good idea to use errdetail_relkind_not_supported. I > slightly modified the API to "int errdetail_relkind_not_supported(Oid > relid, Form_pg_class rd_rel);" to simplify things and increase the > usability of the function

Re: Invalid Unicode escape value at or near "\u0000"

2021-11-13 Thread Japin Li
On Sat, 13 Nov 2021 at 21:52, Andrew Dunstan wrote: > On 11/13/21 00:40, Thomas Munro wrote: >> On Sat, Nov 13, 2021 at 4:32 PM Japin Li wrote: >>> When I try to insert an Unicode "\u", there is an error $subject. >>> >>> postgres=# CREATE TABLE tbl (s varchar(10)); >>> CREATE TABLE >>>

Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display

2021-11-13 Thread Bharath Rupireddy
On Thu, Nov 11, 2021 at 8:41 PM Bossart, Nathan wrote: > > I'm not sure whether it is okay to do the following, for every of the > > activitymsg, before the command execution, we have an elog(DEBUG1 > > message and after the command execution another elog(DEBUG1 message. > > The general idea

Re: Invalid Unicode escape value at or near "\u0000"

2021-11-13 Thread Andrew Dunstan
On 11/13/21 00:40, Thomas Munro wrote: > On Sat, Nov 13, 2021 at 4:32 PM Japin Li wrote: >> When I try to insert an Unicode "\u", there is an error $subject. >> >> postgres=# CREATE TABLE tbl (s varchar(10)); >> CREATE TABLE >> postgres=# INSERT INTO tbl VALUES (E'\u'); >> ERROR:

Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation

2021-11-13 Thread Euler Taveira
On Sat, Nov 13, 2021, at 12:00 AM, Bharath Rupireddy wrote: > On Sat, Nov 13, 2021 at 12:06 AM Euler Taveira wrote: > > > Here's a rebased v8 patch. Please review it. > > > > This improves the user experience by increasing the granularity of error > > reporting, and maps well with the precedent

Re: RFC: Logging plan of the running query

2021-11-13 Thread Bharath Rupireddy
On Wed, Oct 13, 2021 at 7:58 PM Ekaterina Sokolova wrote: > Thank you for working on this issue. I would be glad to continue to > follow the development of this issue. Thanks for the patch. I'm not sure if v11 is the latest patch, if yes, I have the following comments: 1) Firstly, v11 patch

Re: Allow users to choose what happens when recovery target is not reached

2021-11-13 Thread Bharath Rupireddy
On Sat, Nov 13, 2021 at 9:45 AM Julien Rouhaud wrote: > > On Sat, Nov 13, 2021 at 11:00 AM Bharath Rupireddy > wrote: > > > > Users will always be optimistic and set a recovery target and try to > > reach it, but somehow the few of the WAL files haven't arrived (for > > whatever the reasons) the

Re: Identify missing publications from publisher while create/alter subscription.

2021-11-13 Thread Bharath Rupireddy
On Sat, Nov 13, 2021 at 12:50 PM vignesh C wrote: > > Thanks for the comments, the attached v13 patch has the fixes for the same. Thanks for the updated v13 patch. I have no further comments, it looks good to me. Regards, Bharath Rupireddy.

Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY

2021-11-13 Thread Amit Kapila
On Sat, Nov 13, 2021 at 12:47 AM Euler Taveira wrote: > > On Fri, Nov 12, 2021, at 3:10 AM, houzj.f...@fujitsu.com wrote: > > On Fri, Nov 12, 2021 1:33 PM Amit Kapila wrote: > > On Fri, Nov 12, 2021 at 10:50 AM Amit Kapila > > wrote: > > > But won't that generate invalidation for the rel twice