Confused about extension and shared_preload_libraries

2021-06-07 Thread Japin Li
. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Confused about extension and shared_preload_libraries

2021-06-07 Thread Japin Li
tion. > Some extensions may however require this. See the description of the GUC > [1]. > > [1]: > https://www.postgresql.org/docs/13/runtime-config-client.html#GUC-SHARED-PRELOAD-LIBRARIES Sorry for my poor reading of the documentation. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 17:54, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: >> >> On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: >> > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: >> >> >> >> On Sat, 19 Jun 2021 at 1

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 19:06, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 4:09 PM Japin Li wrote: >> >> On Mon, 21 Jun 2021 at 17:54, Amit Kapila wrote: >> > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: >> >> >> >> On Mon, 21 Jun 2021 at 1

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
, because we do not use it in the later. If we do not free the memory, there might be a memory leak when relation->rd_replidindex is invalid. Am I right? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: >> >> On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: >> > On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila >> > wrote: >> >> Or we can free the mem

Re: alter subscription drop publication fixes

2021-05-13 Thread Japin Li
after validation of the options >> > specified, I think we should check if the options specified are >> > correct or not before checking the actual publications. >> >> +1. That was a miss in the original feature. > > Attached patch has the changes for the same. > Thanks for updating the patch. I have a little comments for the new patch. - ADD adds additional publications, - DROP removes publications from the list of + ADD adds additional publications from the list of I think, we should change the word 'from' to 'to'. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

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

2021-05-07 Thread Japin Li
On Thu, 06 May 2021 at 21:52, vignesh C wrote: > On Thu, May 6, 2021 at 9:08 AM Japin Li wrote: >> 3) Should we free the memory when finish the check_publications()? >> + publicationsCopy = list_copy(publications); > > I felt this list entries will be delete

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

2021-05-05 Thread Japin Li
+ publicationsCopy = list_copy(publications); 4) It is better wrap the word "streaming" with quote. Also, should we add 'no "validate_publication"' comment for validate_publication parameters? NULL, NULL, /* no "binary" */ - NULL, NULL); /* no streaming */ + NULL, NULL, /* no streaming */ + NULL, NULL); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: AlterSubscription_refresh "wrconn" wrong variable?

2021-05-06 Thread Japin Li
!wrconn) - ereport(ERROR, - (errmsg("could not connect to the publisher: %s", err))); - /* Get the table list from publisher. */ pubrel_names = fetch_table_list(wrconn, sub->publications); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: AlterSubscription_refresh "wrconn" wrong variable?

2021-05-06 Thread Japin Li
On Thu, 06 May 2021 at 17:30, Peter Smith wrote: > On Thu, May 6, 2021 at 7:18 PM Japin Li wrote: >> >> >> On Thu, 06 May 2021 at 17:08, Peter Smith wrote: >> > On Wed, May 5, 2021 at 12:35 PM Tom Lane wrote: >> >> >> >> Peter Smith

Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns

2021-05-07 Thread Japin Li
not tested > > I have also seen this error with logical replication using pglogical > extension, will this patch also address similar problem with pglogical? Does there is a test case to reproduce this problem (using pglogical)? I encountered this, however I'm not find a case to reproduce

Re: alter subscription drop publication fixes

2021-05-12 Thread Japin Li
iption must contain at least one publication"), errdetail("Dropping all the publications from a subscription is not supported"))); >> merge_publications can be called after validation of the options >> specified, I think we should check if the options specified are >> correct or not before checking the actual publications. > > +1. That was a miss in the original feature. > +1. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-07 Thread Japin Li
r early. Attached fixes it. Any thoughts? [1] https://www.postgresql.org/docs/current/sql-dropsubscription.html -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index eb88d877a5..fa07

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-07 Thread Japin Li
> "none". > Most of the time it will be "none" . > While this, reduce the overhead with strlen into > ReplicationSlotValidateName can it might be worth it. > > For convenience, I have attached a new version. > Thanks for your review! LGTM. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-08 Thread Japin Li
On Thu, 08 Jul 2021 at 17:51, Amit Kapila wrote: > On Wed, Jul 7, 2021 at 7:25 PM Japin Li wrote: >> >> Hi, hackers >> >> The documentation [1] says: >> >> When dropping a subscription that is associated with a replication slot on >> the >>

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-08 Thread Japin Li
On Thu, 08 Jul 2021 at 18:17, Amit Kapila wrote: > On Thu, Jul 8, 2021 at 3:43 PM Japin Li wrote: >> >> On Thu, 08 Jul 2021 at 17:51, Amit Kapila wrote: >> > On Wed, Jul 7, 2021 at 7:25 PM Japin Li wrote: >> >> >> >> Hi, hackers >>

Re: Why is XLOG_FPI_FOR_HINT always need backups?

2021-07-06 Thread Japin Li
og_hints enabled, we always write the entire content of each disk page to WAL? If I'm right, should we mention this in wal_log_hints? [1] https://www.postgresql.org/docs/current/runtime-config-wal.html -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Truncate in synchronous logical replication failed

2021-04-26 Thread Japin Li
re we get that information without > locking the target index. > > We are planning not to backpatch this as there doesn't seem to be any > field complaint about this issue since it was introduced in commit > 5dfd1e5a in v11. +1 for apply only on HEAD. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [PATCH] Re: pg_identify_object_as_address() doesn't support pg_event_trigger oids

2021-04-26 Thread Japin Li
rigger'::regclass,oid,0), + pg_identify_object_as_address('pg_event_trigger'::regclass,oid,0) +FROM pg_event_trigger +WHERE evtname IN ('start_rls_command','end_rls_command','sql_drop_command') +ORDER BY evtname; -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Forget close an open relation in ReorderBufferProcessTXN()

2021-04-24 Thread Japin Li
On Fri, 23 Apr 2021 at 22:33, osumi.takami...@fujitsu.com wrote: > On Saturday, April 17, 2021 4:13 PM Amit Kapila > wrote: >> On Sat, Apr 17, 2021 at 12:05 PM Japin Li wrote: >> > >> > On Sat, 17 Apr 2021 at 14:09, Amit Kapila >> wrote: >> >

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-03-23 Thread Japin Li
On Mon, 22 Mar 2021 at 11:14, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 7:21 PM Japin Li wrote: >> Thank you point out this. Fixed it in v7 patch set. >> >> Please consider the v7 patch for futher review. > > Thanks for the patches. I just found the followi

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-04-05 Thread Japin Li
de a final >> version in good time. > > I took the liberty to address all the review comments and provide a v9 > patch on top of Japin's v8 patch-set. > >> (Also, please combine your patches into a single patch.) > > Done. > > Attaching v9 patch, please review i

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-04-06 Thread Japin Li
On Tue, 06 Apr 2021 at 17:56, Peter Eisentraut wrote: > On 06.04.21 07:24, Japin Li wrote: >>>> I think this patch is about ready to commit, but please provide a final >>>> version in good time. >>> I took the liberty to address all the review commen

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-12 Thread Japin Li
to put the 'if (explainInfo)' as the first check. That >> way, the check for skipData can be simplified. > > Changed. > > Thanks for review comments. Attaching v7 patch set with changes only > in 0002 patch. Please have a look. > The v7 patch looks good to me, and there is n

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-17 Thread Japin Li
about how REFRESH might be implemented >> in future. > > That makes sense to me. Thanks for the comments. I'm fine to withdraw the > patch. > > I would like to see if the 0001 patch(attaching here) will be useful > at all. It just splits up the existing ExecRefreshMatView into a few > functions to make the code readable. +1. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-04 Thread Japin Li
oncurrent in get_new_heap_oid(). The others looks good to me. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy >> wrote: >> > Attaching v5 patch set for further review. >> > >> >> The v5 pat

Re: Inquiries about PostgreSQL's system catalog development——from a student developer of Nanjing University

2021-03-06 Thread Japin Li
ystem backend, how > can I reach it? Is there any code or interface demonstration to show me? > I am looking forward to your prompt reply. Heartfelt thanks. Here is a document on how to create a new system catalog for PostgreSQL 11. https://blog.japinli.top/2019/08/postgresql-new-catalog

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy wrote: > Attaching v5 patch set for further review. > The v5 patch looks good to me, if there is no objection, I'll change the cf status to "Ready for Committer" in few days. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-03-07 Thread Japin Li
lems in doing so? If done > that, we can discard the 0001 patch and comments (1) and (3) becomes > irrelevant. Thank you point out this. Fixed it in v7 patch set. Please consider the v7 patch for futher review. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From a6

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Japin Li
On Sun, 07 Mar 2021 at 17:33, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 12:13 PM Japin Li wrote: >> >> On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy >> wrote: >> > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> >> &g

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-03 Thread Japin Li
On Wed, 03 Mar 2021 at 20:56, David Steele wrote: > Do you know if you will have time to review this patch during the > current commitfest? > Sorry for the late reply! I think I have time to review this patch and I will do it later. -- Regrads, Japin Li. ChengDu WenWu Information T

Re: Truncate in synchronous logical replication failed

2021-04-15 Thread Japin Li
tionGetIndexList > and then build the idattr list for relation->rd_replidindex. Sorry, I don't know how can we build the idattr without open the index. If we should open the index, then we should use NoLock, since the TRUNCATE side hold AccessExclusiveLock. As Osumi points out in [1], The NoLock mode assumes that the appropriate lock on the index is already taken. Please let me know if I have misunderstood. [1] https://www.postgresql.org/message-id/OSBPR01MB488834BDBD67BFF2FB048B3DED4E9%40OSBPR01MB4888.jpnprd01.prod.outlook.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Forget close an open relation in ReorderBufferProcessTXN()

2021-04-15 Thread Japin Li
The RelationIdGetRelation() comment says: > Caller should eventually decrement count. (Usually, > that happens by calling RelationClose().) However, it doesn't do it in ReorderBufferProcessTXN(). I think we should close it, here is a patch that fixes it. Thoughts? -- Regrads, Ja

Re: Truncate in synchronous logical replication failed

2021-04-15 Thread Japin Li
On Thu, 15 Apr 2021 at 19:25, Amit Kapila wrote: > On Thu, Apr 15, 2021 at 4:30 PM Japin Li wrote: >> >> >> On Thu, 15 Apr 2021 at 18:22, Amit Kapila wrote: >> > On Wed, Apr 14, 2021 at 3:31 PM Amit Kapila >> > wrote: >> >> >> >

Re: Truncate in synchronous logical replication failed

2021-04-13 Thread Japin Li
ther several callers so is not as good as the > first direction above, I think. > > If someone has any better idea, please let me know. > I think the first idea is better than the second. OTOH, can we release the locks before SyncRepWaitForLSN(), since it already flush to local WAL files. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Truncate in synchronous logical replication failed

2021-04-10 Thread Japin Li
On Thu, 08 Apr 2021 at 19:20, Japin Li wrote: > On Wed, 07 Apr 2021 at 16:34, tanghy.f...@fujitsu.com > wrote: >> On Wednesday, April 7, 2021 5:28 PM Amit Kapila >> wrote >> >>>Can you please check if the behavior is the same for PG-13? This is >>>

Re: Truncate in synchronous logical replication failed

2021-04-16 Thread Japin Li
On Fri, 16 Apr 2021 at 16:52, Amit Kapila wrote: > On Fri, Apr 16, 2021 at 12:55 PM Japin Li wrote: >> >> On Thu, 15 Apr 2021 at 19:25, Amit Kapila wrote: >> > On Thu, Apr 15, 2021 at 4:30 PM Japin Li wrote: >> >> >> >> >> >> On T

Re: Truncate in synchronous logical replication failed

2021-04-16 Thread Japin Li
> Ok. No need to traverse all the indexes. Will fix this part. > >> 2. >> It is better to name the function as RelationGet... > You are right. I'll modify this in my next version. > I took the liberty to address review comments and provide a v2 patch on top of your's v1 patch, also

Re: Truncate in synchronous logical replication failed

2021-04-08 Thread Japin Li
et these to null before considering the * lock to be acquired via fast-path. */ locallock->lock = NULL; locallock->proclock = NULL; GrantLockLocal(locallock, owner); return LOCKACQUIRE_OK; } } -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Forget close an open relation in ReorderBufferProcessTXN()

2021-04-17 Thread Japin Li
On Sat, 17 Apr 2021 at 14:09, Amit Kapila wrote: > On Thu, Apr 15, 2021 at 4:53 PM Amit Kapila wrote: >> >> On Thu, Apr 15, 2021 at 4:00 PM Japin Li wrote: >> > >> > The RelationIdGetRelation() comment says: >> > >> > > Caller should eve

Re: Truncate in synchronous logical replication failed

2021-04-17 Thread Japin Li
On Sat, 17 Apr 2021 at 12:03, osumi.takami...@fujitsu.com wrote: > On Saturday, April 17, 2021 12:53 AM Japin Li >> On Fri, 16 Apr 2021 at 17:19, osumi.takami...@fujitsu.com >> wrote: >> > On Friday, April 16, 2021 5:50 PM Amit Kapila >> wrote: >>

Re: Truncate in synchronous logical replication failed

2021-04-16 Thread Japin Li
On Thu, 15 Apr 2021 at 19:25, Amit Kapila wrote: > On Thu, Apr 15, 2021 at 4:30 PM Japin Li wrote: >> >> >> On Thu, 15 Apr 2021 at 18:22, Amit Kapila wrote: >> > On Wed, Apr 14, 2021 at 3:31 PM Amit Kapila >> > wrote: >> >> >> >

Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION

2021-08-06 Thread Japin Li
es out of date once the publication > is updated), I think it's impossible to achieve that DROP PUBLICATION > drops relations that are associated with only the publication being > dropped. > >> Do we have better ideas to fix or shall we just >> say that we will refresh based on

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-21 Thread Japin Li
On Thu, 21 Oct 2021 at 19:54, Masahiko Sawada wrote: > On Thu, Oct 21, 2021 at 3:04 PM Dilip Kumar wrote: >> >> On Thu, Oct 21, 2021 at 11:16 AM Masahiko Sawada >> wrote: >> > >> > On Wed, Oct 20, 2021 at 8:12 PM Japin Li wrote: >> > > >

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-21 Thread Japin Li
On Thu, 21 Oct 2021 at 14:04, Dilip Kumar wrote: > On Thu, Oct 21, 2021 at 11:16 AM Masahiko Sawada > wrote: >> >> On Wed, Oct 20, 2021 at 8:12 PM Japin Li wrote: >> > >> > >> > On Mon, 18 Oct 2021 at 17:27, Dilip Kumar wrote: >>

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-21 Thread Japin Li
On Thu, 21 Oct 2021 at 22:46, Tom Lane wrote: > Japin Li writes: >> On Thu, 21 Oct 2021 at 19:54, Masahiko Sawada wrote: >>> BTW I think we can set the parameters from the subscriber side without >>> additional network round trips by specifying the "options&

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-21 Thread Japin Li
On Thu, 21 Oct 2021 at 23:10, Tom Lane wrote: > Japin Li writes: >> On Thu, 21 Oct 2021 at 22:46, Tom Lane wrote: >>> There's another issue here: the subscriber can run user-defined code >>> (in triggers), while AFAIK the sender cannot. > >> Sorry, I'm not

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-16 Thread Japin Li
On Sat, 16 Oct 2021 at 22:42, Japin Li wrote: > On Thu, 14 Oct 2021 at 19:49, Dilip Kumar wrote: >> On Thu, Oct 14, 2021 at 3:48 PM Sadhuprasad Patro wrote: >>> >>> Hi All, >>> >>> Publisher 'DateStyle' is set as "SQL, MDY", whereas i

Re: UPDATE on Domain Array that is based on a composite key crashes

2021-10-19 Thread Japin Li
in`, and find only the last one will be stored. postgres=# UPDATE domain_indirection_test SET domain_array[0].if1 = 10, domain_array[0].if2 = 5; UPDATE 1 postgres=# select * from domain_indirection_test ; f1 | f3 | domain_array +--+ 0 | (1,) | [0:0]={"(,5)"} (1 row)

Re: UPDATE on Domain Array that is based on a composite key crashes

2021-10-19 Thread Japin Li
t; >>> Software Engineer at Microsoft & >>> >>> Developing the Citus database extension for PostgreSQL >>> >> >> Hi, >> It seems the following change would fix the crash: >> >> diff --git a/src/postgres/src/backend/executor/execExprInterp.c >> b/src/postgres/src/backend/executor/execExprInterp.c >> index 622cab9d4..50cb4f014 100644 >> --- a/src/postgres/src/backend/executor/execExprInterp.c >> +++ b/src/postgres/src/backend/executor/execExprInterp.c >> @@ -3038,6 +3038,9 @@ ExecEvalFieldStoreDeForm(ExprState *state, >> ExprEvalStep *op, ExprContext *econte >> HeapTupleHeader tuphdr; >> HeapTupleData tmptup; >> >> +if (DatumGetPointer(tupDatum) == NULL) { >> +return; >> +} >> tuphdr = DatumGetHeapTupleHeader(tupDatum); >> tmptup.t_len = HeapTupleHeaderGetDatumLength(tuphdr); >> ItemPointerSetInvalid(&(tmptup.t_self)); >> >> Here is the result after the update statement: >> >> # UPDATE domain_indirection_test SET domain_array[0].if2 = 5; >> UPDATE 1 >> # select * from domain_indirection_test; >> f1 | f3 | domain_array >> +--+ >> 0 | (1,) | [0:0]={"(,5)"} >> (1 row) >> >> Cheers >> > Hi, > Here is the patch. Thanks for your updated the patch. A minor code style, we can remove the braces when there is only one statement, this is more consenting with the codebase. Others looks good to me. > If the new test should be placed in a different .sql file, please let me > know. > > The update issue Japin mentioned seems to be orthogonal to the crash. > I start a new thread to discuss it [1]. [1] https://www.postgresql.org/message-id/meyp282mb1669bed5cefe711e00c7421eb6...@meyp282mb1669.ausp282.prod.outlook.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Unexpected behavior of updating domain array that is based on a composite

2021-10-19 Thread Japin Li
--+-- 0 | (1,) | [0:0]={"(10,5)"} (1 row) [1] https://www.postgresql.org/message-id/PH0PR21MB132823A46AA36F0685B7A29AD8BD9%40PH0PR21MB1328.namprd21.prod.outlook.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-20 Thread Japin Li
On Mon, 18 Oct 2021 at 17:27, Dilip Kumar wrote: > On Mon, Oct 18, 2021 at 1:41 PM Japin Li wrote: > >> I attached v3 patch that set IntervalStyle to 'postgres' when the >> server backend is walsender, and this problem has gone. > >> I test that set IntervalStyle to

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-16 Thread Japin Li
; replication connection always set subscriber's DateStlyle, with that > the walsender will always send the data in the same DateStyle that > worker understands and then we are good. Right! Attached fix it. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/s

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-18 Thread Japin Li
On Mon, 18 Oct 2021 at 12:17, Tom Lane wrote: > Japin Li writes: >> On Mon, 18 Oct 2021 at 11:59, Michael Paquier wrote: >>> dblink.c has something similar as of applyRemoteGucs(), except that it >>> does not do extra_float_digits. It would be nice to avoid mor

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-18 Thread Japin Li
- > -1 days +11:22:33 > (1 row) > I attached v3 patch that set IntervalStyle to 'postgres' when the server backend is walsender, and this problem has gone. I test that set IntervalStyle to 'sql_standard' on publisher and 'iso_8601' on subscriber, it works fine. Please try v3 patch and let me know if they work as unexpected. Thanks in advance. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-17 Thread Japin Li
ded code lines, which needs to > be corrected... > Doing some further testing with different datestyles, will update further... > Thanks for your review and test! As Tom Lane said, the postgres_fdw has the similar things, I will update the patch later. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-17 Thread Japin Li
style. > > Ah ... see postgres_fdw's set_transmission_modes(). I think we want > to copy that logic not invent some other way to do it. > Thanks for your remention. As Michael Paquier side, dblink also uses the similar logical. I will read them then update the patch. -- Regrads, Ja

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-17 Thread Japin Li
it will be used in more than one places. IMO, we can implement it in core. Any thoughts? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-21 Thread Japin Li
On Fri, 22 Oct 2021 at 08:26, Masahiko Sawada wrote: > On Thu, Oct 21, 2021 at 11:18 PM Japin Li wrote: >> >> How it breaks? > > I don't know the real case but for example, if an application gets > changes via pg_recvlogical with a decoding plugin (say wal2json) f

Re: Autovacuum and idle_session_timeout

2021-12-30 Thread Japin Li
On Fri, 31 Dec 2021 at 00:24, Tom Lane wrote: > Japin Li writes: >> On Thu, 30 Dec 2021 at 18:53, Guillaume Lelarge >> wrote: >>> pg_dump works in a single transaction, so it's already dealt with >>> idle_in_transaction_timeout. Though I guess setting both

Re: Index-only scan for btree_gist turns bpchar to char

2022-01-05 Thread Japin Li
ng query: SELECT *, octet_length(a) FROM chartmp WHERE a = '31b0'; Currently, we can get a | octet_length --+-- 31b0 |4 After fixed, we cannot get any result. For the equal condition, we must put the extra spaces to make it work. Here is a patch for POC testing.

Re: Autovacuum and idle_session_timeout

2021-12-30 Thread Japin Li
On Thu, 30 Dec 2021 at 18:53, Guillaume Lelarge wrote: > Le jeu. 30 déc. 2021 à 11:44, Japin Li a écrit : > >> > pg_dump works in a single transaction, so it's already dealt with > idle_in_transaction_timeout. Though I guess setting both would work too. Attached fix thi

Re: Autovacuum and idle_session_timeout

2021-12-30 Thread Japin Li
t; Oh, it was just missed. I didn't note set autovacuum code set those settings, I think we should also set idle_session_timeout to 0. Should we also change this for pg_dump and pg_backup_archiver? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

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=# CREA

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)); >> ^ &

Minor documentation fix - missing blank space

2021-11-24 Thread Japin Li
. [1] https://www.postgresql.org/docs/14/executor.html -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: pg_replslotdata - a tool for displaying replication slot information

2021-11-24 Thread Japin Li
third parameter. while ((c = getopt_long(argc, argv, "D:v", long_options, NULL)) != -1) -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Invalid Unicode escape value at or near "\u0000"

2021-11-12 Thread Japin Li
tbl VALUES (E'\u'); ^ "\u" is valid unicode [1], why not we cannot insert it? [1] https://www.unicode.org/charts/PDF/U0000.pdf -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Inconsistent error message for varchar(n)

2021-11-12 Thread Japin Li
n't exceed 2147483647. The first error message is reported by anychar_typmodin(), and the later is reported by gram.y. IMO, the syntax error for varchar(n) is more confused. Any thoughts? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-22 Thread Japin Li
On Fri, 22 Oct 2021 at 15:00, Sadhuprasad Patro wrote: > On Fri, Oct 22, 2021 at 8:07 AM Japin Li wrote: >> >> >> On Fri, 22 Oct 2021 at 08:26, Masahiko Sawada wrote: >> > On Thu, Oct 21, 2021 at 11:18 PM Japin Li wrote: >> >> >> >&g

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-22 Thread Japin Li
On Sat, 23 Oct 2021 at 00:55, Tom Lane wrote: > Japin Li writes: >> Attach v5 patch. This patch set the datestyle, intervalstyle and >> extra_float_digits parameters when we connect to publisher, this can >> avoid the network round trips (compare with the first patch

Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-26 Thread Japin Li
On Sat, 23 Oct 2021 at 02:00, Tom Lane wrote: > Japin Li writes: >> On Sat, 23 Oct 2021 at 00:55, Tom Lane wrote: >>> What if the subscriber and publisher are of different PG versions >>> and have different ideas of the valid values of these settings? > >>

Re: [PATCH v2] src/port/snprintf.c: Optimize the common base=10 case in fmtint

2021-10-26 Thread Japin Li
do + { + convert[sizeof(convert) - (++vallen)] = cvt[uvalue % 10]; + uvalue = uvalue / 10; + } while (uvalue); + } else if (base == 16) { Why do we need likely() for base=10, ho

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-19 Thread Japin Li
On Mon, 19 Jul 2021 at 17:02, Amit Kapila wrote: > On Fri, Jul 16, 2021 at 2:12 PM Japin Li wrote: >> >> >> On Fri, 16 Jul 2021 at 14:06, Amit Kapila wrote: >> > On Fri, Jul 9, 2021 at 8:20 AM Japin Li wrote: >> >> >> >> On Thu, 08 Jul 20

Re: Remove redundant strlen call in ReplicationSlotValidateName

2021-07-16 Thread Japin Li
On Fri, 16 Jul 2021 at 16:26, Japin Li wrote: > Hi, hackers > > When I fix a bug about ALTER SUBSCRIPTION ... SET (slot_name) [1], Ranier > Vilela > finds that ReplicationSlotValidateName() has redundant strlen() call, Since > it's > not related to that problem, so

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-16 Thread Japin Li
On Fri, 16 Jul 2021 at 14:06, Amit Kapila wrote: > On Fri, Jul 9, 2021 at 8:20 AM Japin Li wrote: >> >> On Thu, 08 Jul 2021 at 18:17, Amit Kapila wrote: >> > On Thu, Jul 8, 2021 at 3:43 PM Japin Li wrote: >> >> Please consider review v3 patch.

Re: Remove redundant strlen call in ReplicationSlotValidateName

2021-07-16 Thread Japin Li
On Fri, 16 Jul 2021 at 18:05, David Rowley wrote: > On Fri, 16 Jul 2021 at 20:35, Japin Li wrote: >> > When I fix a bug about ALTER SUBSCRIPTION ... SET (slot_name) [1], Ranier >> > Vilela >> > finds that ReplicationSlotValidateName() has redundant s

Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

2021-07-16 Thread Japin Li
On Fri, 16 Jul 2021 at 14:06, Amit Kapila wrote: > On Fri, Jul 9, 2021 at 8:20 AM Japin Li wrote: >> >> On Thu, 08 Jul 2021 at 18:17, Amit Kapila wrote: >> > On Thu, Jul 8, 2021 at 3:43 PM Japin Li wrote: >> >> Please consider review v3 patch.

Re: Index-only scan for btree_gist turns bpchar to char

2022-01-06 Thread Japin Li
I don't particularly want to do that ... any volunteers? > Thanks for your patch, it looks good to me. I'm not sure how to test this. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-16 Thread Japin Li
patch into several pieces (at least implementation and test cases) for easier review. + * Simiarl to the generic logical messages, These DDL messages can be either + * transactional or non-transactional. Note by default DDLs in PostgreSQL are + * transactional. There is a typo, s/Simiarl/Similar/. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: support for MERGE

2022-03-16 Thread Japin Li
On Thu, 17 Mar 2022 at 03:18, Alvaro Herrera wrote: > v16. > On 2022-Mar-14, Japin Li wrote: > >> + ar_delete_trig_tcs = mtstate->mt_transition_capture; >> + if (mtstate->operation == CMD_UPDATE && >> mtstate->mt_tran

Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

2022-03-17 Thread Japin Li
y. snprintf(buf1, sizeof(buf1), INT64_FORMAT, (int64) len); snprintf(buf2, sizeof(buf2), INT64_FORMAT, (int64) th->fileLen); fatal("actual file length (%s) does not match expected (%s)", buf1, buf2); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: support for MERGE

2022-03-14 Thread Japin Li
uot;for" for transition INSERT comment? +MERGE is a multiple-table, multiple-action command: it specifies a target +table and a source relation, and can contain multiple WHEN MATCHED and +WHEN NOT MATCHED clauses, each of which specifies one UPDATE, INSERT, +UPDATE, or DO NOTHING actions. T

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
On Fri, 18 Mar 2022 at 08:18, Zheng Li wrote: > Hello, > > Attached please find the broken down patch set. Also fixed the failing > TAP tests Japin reported. > Thanks for updating the patchset, I will try it later. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
given only the explicitly listed actions +* should be published. +*/ + pubactions->pubddl_database = false; + pubactions->pubddl_table = false; + + *ddl_level_given = true; -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-18 Thread Japin Li
publication-pg_dump-ddl_replication.patch Patch format detection failed. [1] https://www.postgresql.org/message-id/MEYP282MB1669DDF788C623B7F8B64C2EB6139%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
On Fri, 18 Mar 2022 at 08:22, Japin Li wrote: > On Fri, 18 Mar 2022 at 00:22, Zheng Li wrote: >> Hello Japin, >>>The new patch change the behavior of publication, when we drop a table >>>on publisher, the table also be dropped on subscriber, and this made the >&g

Re: Support logical replication of DDLs

2022-03-18 Thread Japin Li
_check/tmp_test_jgRI > .. >> Failed 84/7709 subtests >> t/003_pg_dump_with_server.pl .. ok >> t/010_dump_connstr.pl . ok >> >> Test Summary Report >> --- >> t/002_pg_dump.pl(Wstat: 21504 Tests: 7709 Failed: 84) > > This is fixed in the latest version. I need to remind myself to run > make check-world in the future. > Thanks for updating the patch. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Remove INT64_FORMAT in translatable strings

2022-03-18 Thread Japin Li
On Sat, 19 Mar 2022 at 01:12, Tom Lane wrote: > Japin Li writes: >> we can rely on %lld/%llu and we decided to use them in translatable strings. > > Seems like good cleanup, so pushed. I think though that project style > is to use "long long" or "unsigned lo

Remove INT64_FORMAT in translatable strings

2022-03-18 Thread Japin Li
ons? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 29bfcdf96324433cd8f4beada7023a27fc2bf0b8 Mon Sep 17 00:00:00 2001 From: Japin Li Date: Fri, 18 Mar 2022 23:09:22 +0800 Subject: [PATCH v1] Remove use of [U]INT64_FORMAT in some translatable strings This is similar to

Re: [PATCH] add relation and block-level filtering to pg_waldump

2022-02-24 Thread Japin Li
useful. > Cool. I think we can report an error instead of reading wal files, if the tablespace, database, or relation is invalid. Does there any WAL record that has invalid tablespace, database, or relation OID? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Size functions inconsistent results

2022-02-25 Thread Japin Li
, pg_indexes_size(relid) AS index_bytes, pg_table_size(reltoastrelid) + pg_indexes_size(reltoastrelid) AS toast_bytes from relations r join pg_class on pg_class.oid = r.relid ) select total_bytes, heap_bytes, index_bytes, toast_bytes, (total_bytes = (heap_bytes+index_bytes+toast_bytes)) as "Equal?", (total_bytes - (heap_bytes+index_bytes+toast_bytes)) as "Diff" from sizes; -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li
bout wal_level [1] doesn't mentation this. How about adding a sentence to describe how to set max_wal_senders when setting wal_level to minimal? [1] https://www.postgresql.org/docs/devel/runtime-config-wal.html -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/doc/src/

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li
e default setting for > archive_mode. > Add the default value for archive_mode. > In addition, max_wal_senders could also be changed, adding a sentence like: > > "If setting max_wal_senders to 0 consider also reducing the amount of WAL > produced by changing wal_level to minimal."

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-03 Thread Japin Li
On Thu, 03 Mar 2022 at 12:10, Japin Li wrote: > On Thu, 03 Mar 2022 at 11:25, David G. Johnston > wrote: >> I would suggest a wording more like: >> >> "A precondition for using minimal WAL is to disable WAL archiving and >> streaming replicat

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-04 Thread Japin Li
On Fri, 04 Mar 2022 at 14:05, Kyotaro Horiguchi wrote: > At Fri, 04 Mar 2022 12:18:29 +0800, Japin Li wrote in >> >> On Thu, 03 Mar 2022 at 12:10, Japin Li wrote: >> >> Attach v3 patch to fix missing close varname tag. > > +A precondition for us

CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
datname = 'mydb')\gexec Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL? I create a patch for this, any suggestions? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 7971893868e6eedc7229d28442f07890f251c42b Mon Sep 17 00:00:00 2001 From: Japin Li D

Re: [PATCH] add relation and block-level filtering to pg_waldump

2022-02-25 Thread Japin Li
s, we do not need to read the WAL files, since it always invalid. > non-existence of objects is a no-go, since that depends purely on the WAL > range you are > looking at and you’d have to, you know, scan it to see if it existed before > marking as invalid. :) > Agreed. -- Regrads

  1   2   3   4   >