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: [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

Re: Size functions inconsistent results

2022-02-25 Thread Japin Li
'init') + pg_relation_size(relid, 'fsm') + pg_relation_size(relid, 'vm') AS heap_bytes, 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.

CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
_database WHERE 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 0

Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
On Mon, 28 Feb 2022 at 01:53, Tom Lane wrote: > Japin Li writes: >> Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL? > > FWIW, I'm generally hostile to CREATE IF NOT EXISTS semantics across > the board, because of its exceedingly squishy sem

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

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

2022-03-02 Thread Japin Li
of the 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 min

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 replication b

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

Re: support for MERGE

2022-03-14 Thread Japin Li
estore; Should we add "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,

Re: Support logical replication of DDLs

2022-03-16 Thread Japin Li
t the 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
not think it is a good way. 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 logical replication of DDLs

2022-03-17 Thread Japin Li
s, test returned 29 (wstat 7424, 0x1d00) No subtests run 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 regression testa failed, since the regression test will try to drop the table on subscriber.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
* If publish option was 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-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
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
bin' make: *** [GNUmakefile:71: check-world-src/bin-recurse] Error 2 And, when I try to use git am to apply the patch, it complains: $ git am ~/0001-syntax-pg_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.

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: Support logical replication of DDLs

2022-03-18 Thread Japin Li
Review binary_upgrade results in >> /home/px/Codes/postgresql/Debug/src/bin/pg_dump/tmp_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

Re: [PATCH] Remove workarounds to format [u]int64's

2022-03-21 Thread Japin Li
); snprintf(current_size_str, sizeof(current_size_str), INT64_FORMAT, current_size / (1024 * 1024)); fprintf(stderr, _("%*s/%s MB (%d%%) computed"), (int) strlen(current_size_str), current_size_str, total_size_str, percent); -- Regrads, Japin L

Re: [PATCH] Add reloption for views to enable RLS

2022-03-21 Thread Japin Li
On Mon, 21 Mar 2022 at 20:40, Laurenz Albe wrote: > On Mon, 2022-03-21 at 18:09 +0800, Japin Li wrote: >> After apply the patch, I found pg_checksums.c also has the similar code. >> >> In progress_report(), I'm not sure we can do this replace for this code. >>

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

2022-03-22 Thread Japin Li
(unsigned long long) xid, tuple->t_infomask))); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

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: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

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

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

2021-03-06 Thread Japin Li
the system 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-cata

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: 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: 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: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-03-07 Thread Japin Li
ub->publications. Do you see any problems 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 Info

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

Re: Autovacuum and idle_session_timeout

2021-12-30 Thread Japin Li
atch this week to fix this. > 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: 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 fi

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

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

2022-01-05 Thread Japin Li
oblems. For the following 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 w

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

2022-01-06 Thread Japin Li
On Thu, 06 Jan 2022 at 00:34, Tom Lane wrote: > Japin Li writes: >> Here is a patch for POC testing. > > This is certainly not right. You've made gbt_bpchar_consistent > work identically to gbt_text_consistent, but it needs to implement > a test equivalent to bp

Re: Support tab completion for upper character inputs in psql

2022-01-06 Thread Japin Li
to lower case if the string is not quoted + * and only contains ASCII characters. + * For German/Turkish etc text, no change will be made. + * + * The returned value has to be freed. + */ +static char * +pg_string_tolower_if_ascii(const char *text) +{ s/pg_string_tolower/pg_string_tolower_if_ascii/ for comments. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

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

2022-01-06 Thread Japin Li
t all with an index created by the > old code. 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: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-17 Thread Japin Li
> to keep our options open 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: 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 rev

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 comments

Re: Truncate in synchronous logical replication failed

2021-04-08 Thread Japin Li
ed * objects; we MUST reset these to null before considering the * lock to be acquired via fast-path. */ locallock->lock = NULL; locallock->proclock = NULL; GrantLockLocal(locallock, owner); return LOCKACQUIRE_

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: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber

2021-10-16 Thread Japin Li
lem to me, I think for fixing this, on logical > 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. ChengD

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", wh

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

2021-10-17 Thread Japin Li
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
er? Since 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-17 Thread Japin Li
ver's datestyle. > > 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 pat

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
ntervalstyle to 'postgres'; select * from test; > i > --- > -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: 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)

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: 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.

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 Interva

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 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 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&

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 wal2js

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: >> >> >> >> How i

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). &g

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=1

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? > >>

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.

Invalid Unicode escape value at or near "\u0000"

2021-11-12 Thread Japin Li
SERT INTO tbl VALUES (E'\u'); ^ "\u" is valid unicode [1], why not we cannot insert it? [1] https://www.unicode.org/charts/PDF/U.pdf -- 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
sing 'v' in the third parameter. while ((c = getopt_long(argc, argv, "D:v", long_options, NULL)) != -1) -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Add test module for Table Access Method

2024-01-15 Thread Japin Li
On Tue, 16 Jan 2024 at 13:15, Bharath Rupireddy wrote: > On Tue, Jan 16, 2024 at 10:28 AM Michael Paquier wrote: >> >> Hmm. I'd rather have it do something useful in terms of test coverage >> rather than being just an empty skull. >> >> How about adding the same kind of coverage as dummy_inde

Introduce a new API for TableAmRoutine

2024-01-15 Thread Japin Li
Hi, hackers Recently, I'm trying to implement a new TAM for PostgreSQL, I find there is no API for handling table's option. For example: CREATE TABLE t (...) USING new_am WITH (...); Is it possible add a new API to handle table's option in TableAmRoutine? -- Regrads, Japin Li.

Unnecessary smgropen in {heapam_relation,index}_copy_data?

2024-01-22 Thread Japin Li
Hi, hackers I find heapam_relation_copy_data() and index_copy_data() have the following code: dstrel = smgropen(*newrlocator, rel->rd_backend); ... RelationCreateStorage(*newrlocator, rel->rd_rel->relpersistence, true); The smgropen() is also called by RelationCreateS

Re: Unnecessary smgropen in {heapam_relation,index}_copy_data?

2024-01-25 Thread Japin Li
On Thu, 25 Jan 2024 at 21:43, Aleksander Alekseev wrote: > Hi, > >> I find heapam_relation_copy_data() and index_copy_data() have the following >> code: >> >> dstrel = smgropen(*newrlocator, rel->rd_backend); >> >> ... >> >> RelationCreateStorage(*newrlocator, rel->rd_r

Re: Transaction timeout

2024-01-26 Thread Japin Li
t; Japin, Junwang, what do you think? However, checking the reason on the timeout session may cause regression test failed (as you point in 1), I don't strongly insist on it. -- Best regards, Japin Li.

Re: Transaction timeout

2024-01-31 Thread Japin Li
On Tue, 30 Jan 2024 at 14:22, Andrey M. Borodin wrote: >> On 26 Jan 2024, at 19:58, Japin Li wrote: >> >> Thanks for updating the patch. Here are some comments for v24. >> >> + >> +Terminate any session that spans longer than the spe

Inaccurate comment for pg_get_partkeydef

2023-03-05 Thread Japin Li
PSA patch to fix a comment inaccurate. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 6dc117dea8..bcb493b56c 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt

Re: Table AM Interface Enhancements

2024-03-19 Thread Japin Li
On Tue, 19 Mar 2024 at 21:05, Alexander Korotkov wrote: > Hi, Pavel! > > On Tue, Mar 19, 2024 at 11:34 AM Pavel Borisov wrote: >> On Tue, 19 Mar 2024 at 03:34, Alexander Korotkov >> wrote: >>> >>> On Sun, Mar 3, 2024 at 1:50 PM Alexander Korotkov >>> wrote: >>> > On Mon, Nov 27, 2023 at 10:

Cannot find a working 64-bit integer type on Illumos

2024-03-22 Thread Japin Li
Hi, hackers, When I try to configure PostgreSQL 16.2 on Illumos using the following command, it complains $subject. ./configure --enable-cassert --enable-debug --enable-nls --with-perl \ --with-python --without-tcl --without-gssapi --with-openssl \ --with-ldap --with-libxml --wi

Re: Cannot find a working 64-bit integer type on Illumos

2024-03-22 Thread Japin Li
On Sat, 23 Mar 2024 at 01:04, Tom Lane wrote: > Japin Li writes: >> When I try to configure PostgreSQL 16.2 on Illumos using the following >> command, >> it complains $subject. > >> ./configure --enable-cassert --enable-debug --enable-nls --with-perl \ >&g

Re: Cannot find a working 64-bit integer type on Illumos

2024-03-24 Thread Japin Li
On Sat, 23 Mar 2024 at 01:22, Japin Li wrote: > On Sat, 23 Mar 2024 at 01:04, Tom Lane wrote: >> Japin Li writes: >>> When I try to configure PostgreSQL 16.2 on Illumos using the following >>> command, >>> it complains $subject. >> >>> .

Re: Cannot find a working 64-bit integer type on Illumos

2024-03-24 Thread Japin Li
On Mon, 25 Mar 2024 at 09:32, Tom Lane wrote: > Japin Li writes: >> /home/japin/postgres/debug/../src/bin/pg_dump/pg_dump_sort.c: In function >> 'repairDependencyLoop': >> /home/japin/postgres/debug/../src/bin/pg_dump/pg_dump_sort.c:1276:3: error: >> form

Re: Table AM Interface Enhancements

2024-03-28 Thread Japin Li
bleam = GetHeapamTableAmRoutine(); + } + amoptsfn = relation->rd_indam->amoptions; + } - We can reduce the indentation by moving the classFrom and classTup into the if branch. - Perhaps we could remove the brace of else branch to maintain consistency in the code style. -- Regards, Japin Li

Fix parameters order for relation_copy_for_cluster

2024-04-01 Thread Japin Li
cutoff, multi_cutoff, num_tuples, tups_vacuumed, tups_recently_dead); } It's a bit confusing, so attach a patch to fix this. -- Regards, Japin Li diff --git a/src/include/access/tabl

Re: Table AM Interface Enhancements

2024-04-01 Thread Japin Li
_class tuple > (see AllocateRelationDesc). RelationParseRelOptions() is going to > update relation->rd_options, and thus needs a full pg_class tuple to > fetch options out of it. However, it is really unnecessary to access > both tuples at the same time. We can use a full tuple, not > relation->rd_rel, in both cases. See the attached patch. > > -- > Regards, > Alexander Korotkov + Form_pg_class classForm = (Form_pg_class) GETSTRUCT(tuple); +; There is an additional semicolon in the code. -- Regards, Japin Li

Re: Thoughts about NUM_BUFFER_PARTITIONS

2024-02-18 Thread Japin Li
On Mon, 19 Feb 2024 at 00:56, Tomas Vondra wrote: > On 2/18/24 03:30, Li Japin wrote: >> >> I find it seems need to change MAX_SIMUL_LWLOCKS if we enlarge the >> NUM_BUFFER_PARTITIONS, >> I didn’t find any comments to describe the relation between >> MAX_SIMUL_LWLOCKS and >> NUM_BUFFER_PARTIT

Re: Transaction timeout

2024-02-19 Thread Japin Li
On Mon, 19 Feb 2024 at 17:14, Andrey M. Borodin wrote: >> On 18 Feb 2024, at 22:16, Andrey M. Borodin wrote: >> >> But it seems a little strange that session 3 did not fail at all > It was only coincidence. Any test that verifies FATALing out in 100ms can > fail, see new failure here [0]. > >

Re: Switching XLog source from archive to streaming when primary available

2024-02-19 Thread Japin Li
On Mon, 19 Feb 2024 at 18:36, Bharath Rupireddy wrote: > On Wed, Jan 31, 2024 at 6:30 PM Bharath Rupireddy > wrote: >> >> Needed a rebase due to commit 776621a (conflict in >> src/test/recovery/meson.build for new TAP test file added). Please >> find the attached v17 patch. > > Strengthened te

Re: Switching XLog source from archive to streaming when primary available

2024-02-19 Thread Japin Li
On Tue, 20 Feb 2024 at 13:40, Bharath Rupireddy wrote: > On Mon, Feb 19, 2024 at 8:25 PM Japin Li wrote: >> [2] >> +# Ensure checkpoint doesn't come in our way >> +$primary->append_conf('postgresql.conf', qq( >> +min_wal_size = 2MB >> +

Re: Improve readability by using designated initializers when possible

2024-02-26 Thread Japin Li
On Mon, 26 Feb 2024 at 16:41, jian he wrote: > Hi. minor issues. > > @@ -2063,12 +2009,12 @@ find_expr_references_walker(Node *node, > CoerceViaIO *iocoerce = (CoerceViaIO *) node; > > /* since there is no exposed function, need to depend on type */ > - add_object_address(OCLASS_TYPE, iocoer

Re: Improve readability by using designated initializers when possible

2024-02-27 Thread Japin Li
On Tue, 27 Feb 2024 at 19:55, Jelte Fennema-Nio wrote: > On Tue, 27 Feb 2024 at 12:52, Jelte Fennema-Nio wrote: >> Attached is an updated patchset to also convert pg_enc2icu_tbl and >> pg_enc2gettext_tbl. I converted pg_enc2gettext_tbl in a separate >> commit, because it actually requires some

Re: Improve readability by using designated initializers when possible

2024-02-27 Thread Japin Li
On Wed, 28 Feb 2024 at 00:06, Jelte Fennema-Nio wrote: > On Tue, 27 Feb 2024 at 16:04, Japin Li wrote: >> I see the config_group_names[] needs null-terminated because of help_config, >> however, I didn't find the reference in help_config.c. Is this comment >>

Re: Improve readability by using designated initializers when possible

2024-03-05 Thread Japin Li
gt; previous versions, I think. Hi, Attach a patch to rewrite dispatch_table array using C99-designated initializer syntax. >From f398d6d310e9436c5e415baa6fd273981a9e181f Mon Sep 17 00:00:00 2001 From: Japin Li Date: Tue, 5 Mar 2024 21:32:46 +0800 Subject: [PATCH v1 1/1] Use C99-designated initi

Re: Improve readability by using designated initializers when possible

2024-03-05 Thread Japin Li
On Tue, 05 Mar 2024 at 22:03, Jelte Fennema-Nio wrote: > On Tue, 5 Mar 2024 at 14:50, Japin Li wrote: >> Attach a patch to rewrite dispatch_table array using C99-designated >> initializer syntax. > > Looks good. Two small things: Thanks for the review. &

Re: Improve readability by using designated initializers when possible

2024-03-05 Thread Japin Li
On Wed, 06 Mar 2024 at 01:53, Jelte Fennema-Nio wrote: > On Tue, 5 Mar 2024 at 15:30, Japin Li wrote: >> There is a warning if remove it, so I keep it. >> >> /home/japin/Codes/postgres/build/../src/backend/executor/execExprInterp.c:118:33: >> warning: label ‘CASE

Re: Improve readability by using designated initializers when possible

2024-03-11 Thread Japin Li
On Fri, 08 Mar 2024 at 13:21, Michael Paquier wrote: > On Wed, Mar 06, 2024 at 08:24:09AM +0800, Japin Li wrote: >> On Wed, 06 Mar 2024 at 01:53, Jelte Fennema-Nio wrote: >>> I think if you remove the EEO_CASE(EEOP_LAST) block the warning should >>> go away. That

Typo macro name on FreeBSD?

2022-12-15 Thread Japin Li
-RELEASE-p3 GENERIC amd64 root@freebsd:~ # echo | gcc10 -dM -E - | grep -i 'freebsd' #define __FreeBSD__ 13 -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Typo macro name on FreeBSD?

2022-12-15 Thread Japin Li
On Fri, 16 Dec 2022 at 12:25, Thomas Munro wrote: > On Fri, Dec 16, 2022 at 4:44 PM Japin Li wrote: >> Recently, I compile PostgreSQL on FreeBSD, I find commit a2a8acd152 >> introduecs >> __freebsd__ macro, however, I cannot find this macro on FreeBSD 13. There >&

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

2023-01-05 Thread Japin Li
GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ? - "pg_clog" : "pg_xact"); + copy_subdir_files(GetClogDirName(old_cluster), GetClogDirName(new_cluster)); prep_status("Setting oldest XID for new cluster"

  1   2   3   4   >