Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2025-04-08 Thread jian he
oparams[m])); else ereport(ERROR, errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input value for domain %s: \"%s\"", format_type_be(

Re: speedup COPY TO for partitioned table.

2025-04-09 Thread jian he
hi. rebase and simplify regress tests. From f56c94ccb018928e41cc35e162174831cb016c1d Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 10 Apr 2025 10:41:40 +0800 Subject: [PATCH v10 1/1] support COPY partitioned_table TO CREATE TABLE pp (id int, val int ) PARTITION BY RANGE (id); CREATE TABLE

Re: bug in stored generated column over domain with constraints.

2025-04-10 Thread jian he
712c54dcdb1a Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 10 Apr 2025 16:47:37 +0800 Subject: [PATCH v3 1/1] fix INSERT generated column over domain with constraints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit create domain d3 as int check (

Re: speedup COPY TO for partitioned table.

2025-04-10 Thread jian he
On Thu, Apr 10, 2025 at 4:25 PM Kirill Reshke wrote: > > On Thu, 10 Apr 2025 at 07:45, jian he wrote: > > > > hi. > > > > rebase and simplify regress tests. > > HI! > You used CREATE TABLE PARTITION OF syntax for the second level of > partitioning sch

Re: speedup COPY TO for partitioned table.

2025-03-30 Thread jian he
On Sun, Mar 30, 2025 at 9:14 AM vignesh C wrote: > > On Sat, 29 Mar 2025 at 12:08, jian he wrote: > > > > > > I consolidated it into a new function: CopyThisRelTo. > > Few comments: > 1) Here the error message is not correct, we are printing the original > tab

Re: add function argument name to substring and substr

2025-03-31 Thread jian he
On Tue, Apr 1, 2025 at 6:22 AM David G. Johnston wrote: > > On Tue, Mar 18, 2025 at 9:04 PM jian he wrote: >> >> >> new patch attached. >> > > I've done v4 with a delta patch. > > Decided to standardize on calling the SQL Similar To regular expre

Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

2025-03-31 Thread jian he
used with plain tables and materialized views, not regular views. It also does not copy rows from child tables or child partitions." > > Wouldn't it be beneficial to add a regression test to check > whether COPY matview TO works as expected? sure. From 3e404817827a58721cf89660804

Re: speedup COPY TO for partitioned table.

2025-03-31 Thread jian he
ms (patches) vs > 4358.489ms (unpatched) > > So, this patch indeed speeds up some cases, but with larger tables > speedup becomes negligible. > Thanks for doing the benchmark. From b27371ca4ff132e7d2803406f9e3f371c51c96df Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 1 Apr

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-01 Thread jian he
hi. the following are reviews of changes in pg_dump on v6-0001-NOT-NULL-NOT-VALID.patch minor style tweak: + "CASE WHEN NOT co.convalidated THEN co.oid" + " ELSE NULL END AS notnull_invalidoid,\n" align with surrounding code convention: leave white space at the end, not beginning. maybe we can +

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-08 Thread jian he
l constraint convalidated as false. From 9505f36287403aa8efd7642dddf71b77996796dd Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 9 Apr 2025 13:07:58 +0800 Subject: [PATCH v1 1/1] pg_dump not null not valid make sure pg_dump have the same pg_constraint meta before and after pg_dump. if the parent not-null con

disallow ALTER VIEW SET DEFAULT when the corresponding base relation column is a generated column

2025-04-11 Thread jian he
teable view ``. what do you think? From 8e973bcd093ce25a5728f10aa9e73eb838406758 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 11 Apr 2025 15:41:10 +0800 Subject: [PATCH v1 1/1] disallow set default when baserel column is generated disallow change updatable view column default expression wh

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-07 Thread jian he
hi. CREATE TABLE t (a int, b int); INSERT INTO t VALUES (NULL, 1), (300, 3); ALTER TABLE t ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok ALTER TABLE t add column c float8 default random(); the last query should not fail. if we want more places use CompactAttribute->attnullability set_attnotnull

Re: using index to speedup add not null constraints to a table

2025-04-18 Thread jian he
On Wed, Feb 5, 2025 at 4:24 PM jian he wrote: > > rebased new patch attached. > I also did some cosmetic changes. comments refined. > make sure using index_scan mechanism to fast check column not-null can > only be used via btree index. > isolation tests are simplified.

bug: virtual generated column can be partition key

2025-04-20 Thread jian he
EATE TABLE gtest_part_key ( f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) VIRTUAL) PARTITION BY RANGE ((f3)); From 10f8c6a1c59a31c2ba6d77d69fdc740e094d9cd3 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 21 Apr 2025 10:28:26 +0800 Subject: [PATCH v1 1/1] virtual generated

disallow alter individual column if partition key contains wholerow reference

2025-04-22 Thread jian he
ion keys have column references, then has_partition_attrs should return true. [1]: https://postgr.es/m/CACJufxF=wdgthxsaqr9thyusfx_1_t9e6n8te3b8eqxcvov...@mail.gmail.com From 7a4c9bc1cb65c3aedc92a4bf31352ba19f1135b9 Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 22 Apr 2025 19:37:24 +0800 Su

Re: bug: virtual generated column can be partition key

2025-04-22 Thread jian he
On Tue, Apr 22, 2025 at 3:02 PM jian he wrote: > Other than that, it looks good to me for fixing this bug. The error message seems not that intuitive. +CREATE TABLE gtest_part_key (f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) VIRTUAL) PARTITION BY RANGE ((gtest_part_

Re: bug: virtual generated column can be partition key

2025-04-22 Thread jian he
On Tue, Apr 22, 2025 at 11:45 AM Ashutosh Bapat wrote: > > I have included your original tests, but ended up rewriting code. Please let > me know what do you think. > + if (attno < 0) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("partition key expressions cannot conta

Re: bug: virtual generated column can be partition key

2025-04-21 Thread jian he
On Tue, Apr 22, 2025 at 11:45 AM Ashutosh Bapat wrote: > > > While looking at this I realised that a generated column may end up being > part of the partition key if the partition key expression contains a whole > row reference. Attached patch also has a fix and a testcase for the same. > PARTI

Re: ALTER COLUMN SET DATA TYPE does not change the generation expression's collation

2025-04-18 Thread jian he
On Wed, Mar 26, 2025 at 1:01 PM jian he wrote: > > hi. > > ATPrepAlterColumnType forbids us to ALTER COLUMN SET DATA TYPE USING (expr) > for generated columns. > however we can still change the generated column type from non-text to text > or text type from one collation

Re: using index to speedup add not null constraints to a table

2025-04-27 Thread jian he
On Fri, Apr 18, 2025 at 4:07 PM jian he wrote: > > I don't have any good ideas to do the regress tests. > I use > ereport(NOTICE, > errmsg("all not-null constraints on relation > \"

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-25 Thread jian he
On Fri, Apr 25, 2025 at 3:36 AM Alvaro Herrera wrote: > > On 2025-Apr-09, jian he wrote: > > > hi. > > > > attached patch is for address pg_dump inconsistency > > when parent is "not null not valid" while child is "not null". > &

virtual generated column as partition key

2025-04-23 Thread jian he
:00:00 2001 From: jian he Date: Wed, 23 Apr 2025 19:54:03 +0800 Subject: [PATCH v1 1/1] virtual generated column as partition key demo: CREATE TABLE t(f1 bigint, f2 bigint GENERATED ALWAYS AS (f1 * 2) VIRTUAL) PARTITION BY RANGE (f2); but partition key can not be expression on top of virtual

Re: bug: virtual generated column can be partition key

2025-04-23 Thread jian he
On Tue, Apr 22, 2025 at 4:55 PM Ashutosh Bapat wrote: > > Sorry I missed this email while sending the patches - our emails crossed in > the air. > > On Tue, Apr 22, 2025 at 2:15 PM jian he wrote: >> >> On Tue, Apr 22, 2025 at 3:02 PM jian he wrote: >> > Othe

expand on_error ignore error handling scope

2025-04-29 Thread jian he
hi. Currently, (on_error ignore) only handles data type incompatibility errors. However, we can extend its functionality to also handle errors caused by extra data (additional columns) or missing data (fewer columns), I think. on_error is only applicable to non-binary formats. In non-binary forma

pg_dump --if-exists --clean when drop index that is partition of a partitioned index

2025-04-13 Thread jian he
hi. CREATE TABLE tp(c int, a int, b int) PARTITION BY RANGE (b); CREATE TABLE tp_1(c int, a int, b int); ALTER TABLE tp ATTACH PARTITION tp_1 FOR VALUES FROM (0) TO (1); CREATE INDEX t_a_idx ON tp_1(a); CREATE INDEX tp_a_idx ON tp(a); pg_dump --schema=public --if-exists --clean --no-statistics -

Re: pg_dump --if-exists --clean when drop index that is partition of a partitioned index

2025-04-15 Thread jian he
On Wed, Apr 16, 2025 at 6:51 AM Tom Lane wrote: > > Or we could do what Jian suggested and just not emit any dropStmt > for child indexes. I continue to fear that that will have > undesirable side-effects, but I have to admit that I'm not sure > what. The fact that the backend will automatically

Re: support create index on virtual generated column.

2025-04-14 Thread jian he
pression associated attribute. new patch attached. Now, ALTER TABLE DROP COLUMN works fine. ALTER INDEX ATTACH PARTITION works fine. creating such an index on a partitioned table works just fine. for table inheritance: create index on parent table will not cascade to child table, so we don't need t

Re: 2025-05-08 release announcement draft

2025-05-06 Thread jian he
On Tue, May 6, 2025 at 11:32 AM Jonathan S. Katz wrote: > > Hi, > > Attached is the draft of the release announcement for the 2025-05-08 > release. Please review for correctness and omissions. > > Please provide feedback no later than 2025-05-08 12:00 UTC. > * Prevent failure in [`INSERT`](https:

Re: bug: virtual generated column can be partition key

2025-05-06 Thread jian he
I have added this thread and [1] into https://wiki.postgresql.org/wiki/PostgreSQL_18_Open_Items#Live_issues In case we've lost track of it. [1]: https://www.postgresql.org/message-id/CACJufxG5wLiATocRTaC%3Dz%2Bkw4mUaasC-50%2Bq9K%3DfOdAr3%3DOGRw%40mail.gmail.com

Re: doc pg_constraint.convalidated column description need update

2025-05-06 Thread jian he
On Sat, May 3, 2025 at 11:42 PM Robert Treat wrote: > As such, attached patch removes the above, and attempts some clean up > of the documentation in ALTER TABLE to better clarify the behavior > around valid/not valid, enforced/not enforced, and how it affects > different constraints, with some ad

Re: bug: virtual generated column can be partition key

2025-05-06 Thread jian he
On Tue, May 6, 2025 at 5:57 PM Yura Sokolov wrote: > > 21.04.2025 05:30, jian he пишет: > > hi. > > While trying to make the virtual generated column be part of the partition > > key, > > I found this bug. > > it also influences the stored gen

Re: PG 18 release notes draft committed

2025-05-06 Thread jian he
On Fri, May 2, 2025 at 10:44 AM Bruce Momjian wrote: > > release-16: 206 > release-17: 182 > release-18: 209 > > I will continue improving it until beta 1, and until the final release. > I will probably add markup in 1-3 weeks. Let the feedback begin. ;-) > > You ca

Re: PG 18 release notes draft committed

2025-05-06 Thread jian he
Allow partitions to be pruned more efficienty (Ashutosh Bapat, Yuya Watari, David Rowley) § § typo, "efficienty" should be "efficiently"?

Re: [PATCH] Re: Proposal to Enable/Disable Index using ALTER INDEX

2025-04-24 Thread jian he
hi, two more minor issues. src/bin/pg_dump/pg_dump.c if (fout->remoteVersion >= 18) need change to if (fout->remoteVersion >= 19) +-- Test index visibility with partitioned tables +CREATE TABLE part_tbl(id int, data text) PARTITION BY RANGE(id); +CREATE TABLE part1 PARTITION OF part_tbl

Re: on_error table, saving error info to a table

2025-04-25 Thread jian he
e should error out case like: COPY err_tbl FROM STDIN WITH (DELIMITER ',', on_error table, table err_tbl); also by changing copy_generic_opt_arg, now we can COPY err_tbl FROM STDIN WITH (DELIMITER ',', on_error table, table x); previously, we can only do COPY err_tbl FROM STDIN WITH (DELIMITER &

Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint

2025-04-23 Thread jian he
On Tue, Mar 11, 2025 at 12:17 PM jian he wrote: > hi. > in summary: ATExecSetExpression, RememberAllDependentForRebuilding > will do all the work to change the generation expression, > whether it's virtual or stored. > while working on another patch, I found out this can b

Re: [PATCH] Re: Proposal to Enable/Disable Index using ALTER INDEX

2025-04-23 Thread jian he
hi. The following is a review of version 17. ATExecSetIndexVisibility if (indexForm->indisvisible != visible) { indexForm->indisvisible = visible; CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple); CacheInvalidateRelcache(heapRel); InvokeObjectPo

Re: pg_dump --if-exists --clean when drop index that is partition of a partitioned index

2025-04-15 Thread jian he
On Tue, Apr 15, 2025 at 1:45 PM Pavel Stehule wrote: >> >> seems pretty easy to fix. >> we only need dropStmt when IndxInfo->parentidx oid is invalid. >> >> +if (!OidIsValid(indxinfo->parentidx)) >> +appendPQExpBuffer(delq, "DROP INDEX %s;\n", qqindxname); > > > I don't think i

tab complete for COPY populated materialized view TO

2025-04-10 Thread jian he
6f Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 9 Apr 2025 16:16:54 +0800 Subject: [PATCH v1 1/1] tab complete for COPY populated materialized view TO --- src/bin/psql/tab-complete.in.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/tab-compl

wrong comments in rewriteTargetListIU

2025-04-10 Thread jian he
hi. in function, rewriteTargetListIU we have: for (attrno = 1; attrno <= numattrs; attrno++) { /* * Can only insert DEFAULT into generated columns, regardless of * any OVERRIDING clauses. */ if (att_tup->attgenerated && !apply_default

Re: pg_dump --if-exists --clean when drop index that is partition of a partitioned index

2025-04-14 Thread jian he
On Mon, Apr 14, 2025 at 2:09 PM Pavel Stehule wrote: > > Hi > > po 14. 4. 2025 v 7:54 odesílatel jian he napsal: >> >> hi. >> >> CREATE TABLE tp(c int, a int, b int) PARTITION BY RANGE (b); >> CREATE TABLE tp_1(c int, a int, b int); >> ALTER TABLE

Re: support create index on virtual generated column.

2025-04-15 Thread jian he
On Mon, Apr 14, 2025 at 8:05 PM Kirill Reshke wrote: > > On Mon, 14 Apr 2025 at 16:10, jian he wrote: > > > > new patch attached. Now, > > ALTER TABLE DROP COLUMN works fine. > > ALTER INDEX ATTACH PARTITION works fine. > > creating such an index on a partit

Re: bug in stored generated column over domain with constraints.

2025-04-15 Thread jian he
On Tue, Apr 15, 2025 at 4:10 AM Tom Lane wrote: > > jian he writes: > > new patch attached. > > I looked this over. It's kind of astonishing that nobody has reported > this before, because AFAICT it's been broken since we invented > generated

minor error message enhancement in refuseDupeIndexAttach

2025-04-15 Thread jian he
easily understand which index is already attached for partition \"%s\". From 1b9f592756eab51049307862aa6f954e551743ac Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 15 Apr 2025 15:50:08 +0800 Subject: [PATCH v1 1/1] minor error message enhancement in refuseDupeIndexAttach cha

domain over virtual generated column

2025-04-27 Thread jian he
R: column "b" of table "gtest24" contains values that violate the new constraint v1-0003 virtual generation columns over domain. From 70a9fb80fb63561a66b2427bf3829e3667ce1569 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 13 Mar 2025 20:15:46 +0800 Subject: [PATCH v1 1/

add tab-complete for ALTER DOMAIN ADD...

2025-04-29 Thread jian he
hi. per https://www.postgresql.org/docs/current/sql-alterdomain.html we can add tab-complete for ALTER DOMAIN ADD variants: ALTER DOMAIN sth ADD CHECK ALTER DOMAIN sth ADD CONSTRAINT ALTER DOMAIN sth ADD NOT NULL v1-0001-add-tab-complete-for-ALTER-DOMAIN-ADD.patch Description: Binary data

Re: PG 18 release notes draft committed

2025-05-03 Thread jian he
On Fri, May 2, 2025 at 10:44 AM Bruce Momjian wrote: > > I have committd the first draft of the PG 18 release notes. The item > count looks strong: > release-17: 182 > release-18: 209 > > I will continue improving it until beta 1, and until the final release. > I will probably

doc pg_constraint.convalidated column description need update

2025-05-01 Thread jian he
hi. catalog.sgml: convalidated bool Has the constraint been validated? Currently, can be false only for foreign keys and CHECK constraints with NOT NULL NOT VALID, we need rephrase it to something like: "Currently, can be false only fo

Re: First-draft back-branch release notes are up

2025-05-03 Thread jian he
On Sat, May 3, 2025 at 12:39 AM Tom Lane wrote: > > Much less exciting than the v18 release notes, but we > still gotta do 'em. See > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=176877f461a8b55e921f597fb217f6ab89ee019f > > As usual, please send corrections by Sunday. > +

Re: bug: virtual generated column can be partition key

2025-04-21 Thread jian he
On Mon, Apr 21, 2025 at 4:02 PM Fujii Masao wrote: > > > > On 2025/04/21 11:30, jian he wrote: > > hi. > > While trying to make the virtual generated column be part of the partition > > key, > > I found this bug. > > I haven't looked at the patch

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread jian he
On Wed, May 7, 2025 at 5:25 PM Álvaro Herrera wrote: > > On 2025-May-07, jian he wrote: > > > in PG17 and master, pg_dump (--schema=test --no-owner) > > [...] > > didn't produce > > COMMENT ON CONSTRAINT nn ON DOMAIN test.d1 IS 'not null constraint on &g

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread jian he
ble? Anyway, the attachment is for PG18 only now, it will fix the domain constraint name loss and domain not-null comments loss issue together. From 2db869fc212867e74f61f4e5b2aef1fda017e9f7 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 8 May 2025 12:48:25 +0800 Subject: [PATCH v3 2/2] sa

Re: Non-text mode for pg_dumpall

2025-02-17 Thread jian he
hi. pg_restore restore a PostgreSQL database from an archive file created by pg_dump or restore multiple PostgreSQL database from an archive directory created by pg_dumpall i think it's way too verbose. we can change it to: restore PostgreSQL database from an archiv

Re: Non-text mode for pg_dumpall

2025-02-18 Thread jian he
On Tue, Feb 18, 2025 at 2:10 PM jian he wrote: > > hi. hi. more cosmetic minor issues. +static int +get_dbname_oid_list_from_mfile(const char *dumpdirpath, SimpleDatabaseOidList *dbname_oid_list) ... + /* + * XXX : before adding dbname into list, we can verify that this db + * needs to s

Re: Non-text mode for pg_dumpall

2025-02-19 Thread jian he
hi. Currently, pg_retore says --exit-on-error Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration. Do we need to apply this to restore executing global commands (create role, create ta

Re: bug when apply fast default mechanism for adding new column over domain with default value

2025-03-02 Thread jian he
On Sun, Mar 2, 2025 at 7:54 AM Tom Lane wrote: > > jian he writes: > > So I duplicated StoreAttrDefault and removed pg_attribute.atthasdef, > > pg_attrdef related code. > > and it works fine. > > I think the fundamental problem here is that StoreAttrDefault > sho

Re: bug when apply fast default mechanism for adding new column over domain with default value

2025-03-03 Thread jian he
On Mon, Mar 3, 2025 at 6:08 AM Tom Lane wrote: > > jian he writes: > > On Sun, Mar 2, 2025 at 7:54 AM Tom Lane wrote: > >> I think the fundamental problem here is that StoreAttrDefault > >> shouldn't be involved in this in the first place. > >

Re: bug when apply fast default mechanism for adding new column over domain with default value

2025-03-03 Thread jian he
On Mon, Mar 3, 2025 at 4:45 PM jian he wrote: > > looking at DefineRelation comments: > * We can set the atthasdef flags now in the tuple descriptor; this just > * saves StoreAttrDefault from having to do an immediate update of the > * pg_attribute rows. > th

Re: new commitfest transition guidance

2025-03-07 Thread jian he
hi. It seems we don't have much info about "Patch Triage" in 2025. but 2023, 2024 we do have. like: https://wiki.postgresql.org/wiki/FOSDEM/PGDay_2024_Developer_Meeting#v17_Patch_Triage and https://wiki.postgresql.org/wiki/FOSDEM/PGDay_2023_Developer_Meeting#v16_Patch_Triage

Re: speedup COPY TO for partitioned table.

2025-03-07 Thread jian he
ITION pp_2 FOR VALUES FROM (5) TO (10); insert into pp select g, 10 + g from generate_series(1,9) g; copy pp to stdout(header); From eaf3869c4fb5fdacba5efd562f73ca06a0251ac4 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 7 Mar 2025 18:39:56 +0800 Subject: [PATCH v2 1/1] support "COPY parti

Re: Add column name to error description

2025-03-07 Thread jian he
On Fri, Mar 7, 2025 at 11:05 AM Tom Lane wrote: > > Erik Wienhold writes: > > But I don't see the point in keeping variables atttypid and atttypmod > > around when those values are now available via outatt. Removing these > > two variables makes the code easier to read IMO. Done so in the > > a

Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2025-03-06 Thread jian he
hi. rebase only. From ce0ce6438094cad553e509db65b7fd27de2b9af6 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 7 Mar 2025 11:43:51 +0800 Subject: [PATCH v12 1/1] COPY (on_error set_to_null) Extent "on_error action", introduce new option: on_error set_to_null. Current grammar makes

Re: support virtual generated column not null constraint

2025-03-08 Thread jian he
From 0985d7a779287feaa1a382726e566418bc56d381 Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 8 Mar 2025 18:08:51 +0800 Subject: [PATCH v3 3/3] domain over virtual generated column. domain don't have constraints works just be fine. domain constraint check is happend within ExecComputeGenerated. we compute t

Re: general purpose array_sort

2025-03-09 Thread jian he
hi. patch rebased, also did some minor comments tweak. From c9398dfe889f23dce147db1719aa9fe4dfaa3adc Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 9 Mar 2025 20:45:20 +0800 Subject: [PATCH v16 1/2] general purpose array_sort Introduce the SQL-callable function array_sort(anyarray). The

Re: new commitfest transition guidance

2025-03-04 Thread jian he
On Tue, Feb 4, 2025 at 2:39 PM Daniel Gustafsson wrote: > > > On 4 Feb 2025, at 06:50, Tom Lane wrote: > > > > Peter Eisentraut writes: > >> During the developer meeting at FOSDEM last Thursday, > > > > BTW, are there minutes available from that meeting? In past years > > some notes have been p

Re: tests for pg_stat_progress_copy.tuples_skipped

2025-03-04 Thread jian he
On Mon, Mar 3, 2025 at 5:05 PM Fujii Masao wrote: > > Thanks for the patch! > > The patch basically looks good to me. > I’ve made some minor cosmetic adjustments — the updated patch is attached. > > Unless there are any objections, I'm thinking to commit it. > I checked it again manually. It look

Re: support virtual generated column not null constraint

2025-03-06 Thread jian he
need table rewrite in phase 3. alter table t add column c d2 generated always as (a + 12) virtual; --we can only do table scan in phase 3. From 5e1c83c18cd954abcbae4bd52ef9c77de1273f9c Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 6 Mar 2025 12:35:19 +0800 Subject: [PATCH v2 2/3] rename ExecCompu

Re: support fast default for domain with constraints

2025-03-06 Thread jian he
On Thu, Mar 6, 2025 at 11:04 AM jian he wrote: > > hi. > > rearrange the patch. > v3-0001 and v3-0002 is preparare patches. > v3-0001 add function: ExecPrepareExprSafe and ExecInitExprSafe. > v3-0002 add function: DomainHaveVolatileConstraints > i actually do need Domai

Re: support fast default for domain with constraints

2025-03-05 Thread jian he
master behavior. also no table rewrite if the domain has volatile check constraints, so less surprising behavior. From b2b42a27bcad670e3f5843b9db4ee369e3f30d9c Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 5 Mar 2025 20:37:31 +0800 Subject: [PATCH v3 1/3] soft error variant of ExecPrepareExpr

Re: bogus error message for ALTER TABLE ALTER CONSTRAINT

2025-03-11 Thread jian he
On Tue, Mar 11, 2025 at 1:58 AM Álvaro Herrera wrote: > > Hello, > > I fleshed this out more fully and I think 0001 is good enough to commit. > > I then noticed that constraints on domains are giving bogus error > messages as well, and the situation is easily improved -- see 0002. I'm > not so su

Re: Non-text mode for pg_dumpall

2025-03-10 Thread jian he
On Thu, Mar 6, 2025 at 12:49 AM Mahendra Singh Thalor wrote: > > Thanks Alvaro for feedback and review. > > On Wed, 5 Mar 2025 at 20:42, Álvaro Herrera wrote: > > > > Disclaimer: I didn't review these patches fully. > > > > On 2025-Mar-05, Mahendra Singh Thalor wrote: > > > > > On Wed, 5 Mar 2025

Re: bogus error message for ALTER TABLE ALTER CONSTRAINT

2025-03-11 Thread jian he
On Tue, Mar 11, 2025 at 6:21 PM Álvaro Herrera wrote: > > > > seems didn't cover "initially immediate" case for domain. > > for example: > > create domain d_int as int4; > > --- the following two cases should fail. > > alter domain d_int add constraint nn1 not null initially immediate; > > alter d

Re: speedup COPY TO for partitioned table.

2025-03-11 Thread jian he
On Fri, Mar 7, 2025 at 6:41 PM jian he wrote: > > hi. > > rebased and polished patch attached, test case added. hi. I realized I need to change the doc/src/sgml/ref/copy.sgml Notes section. current doc note section: COPY TO can be used only with plain tables, not views, and does n

Re: Emitting JSON to file using COPY TO

2025-03-11 Thread jian he
r comments tweaks, and commit message tweaks. another issue is this patch entry in commitfest [1] status is: Not processed, which means no cfbots CI tests, seems not great. not sure how to resolve this issue [1] https://commitfest.postgresql.org/patch/4716/ From 24e1858722dbb25c4842d0ec2dee5b1047e

support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint

2025-03-11 Thread jian he
pport index over virtual generated columns. to support change generation expressions for virtual generated columns over check constraints, the code seems not hard. From fa81ac3a82bfdb0dea52a985eb534a3866b4af7a Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 11 Mar 2025 12:17:00 +0800 Subject: [PATC

bug when apply fast default mechanism for adding new column over domain with default value

2025-02-28 Thread jian he
hi. While looking at ATExecAddColumn, I saw there are two DomainHasConstraints, which are cache unfriendly, then I think I found a bug for applying fast default over domain with default value. bug demo: create domain int_domain3 as int check(value > 1) default 11; create domain int_domain4 as in

bug: ALTER TABLE ADD VIRTUAL GENERATED COLUMN with table rewrite

2025-02-27 Thread jian he
7 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 27 Feb 2025 22:54:03 +0800 Subject: [PATCH v1 1/1] fix ALTER TABLE ADD VIRTUAL GENERATED COLUMN when table rewrite demo: CREATE TABLE gtest20a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL); ALTER TABLE gtest20a ADD COLUMN c float8 D

Re: bug when apply fast default mechanism for adding new column over domain with default value

2025-03-01 Thread jian he
code. and it works fine. From 4f87b744b19f34b02817d252cc69666e33da2e18 Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 1 Mar 2025 22:01:21 +0800 Subject: [PATCH v1 1/1] apply fast default for adding new column over domain with default value discussion: https://postgr.es/m/CACJufxHFssPvkP1we7WMhP

Re: support virtual generated column not null constraint

2025-03-13 Thread jian he
tdomain1 violates check constraint "gtestdomain1_check"`` but we want error message like: ERROR: column "b" of table "gtest24" contains values that violate the new constraint -- From 30485418e6cd2dd993094b351b6ad10b4d885da3 Mon Sep 17 00:00:00 2001 From: j

Re: Non-text mode for pg_dumpall

2025-03-12 Thread jian he
On Wed, Mar 12, 2025 at 1:06 AM Álvaro Herrera wrote: > > Hello, > > On 2025-Mar-11, Mahendra Singh Thalor wrote: > > > In map.dat file, I tried to fix this issue by adding number of characters > > in dbname but as per code comments, as of now, we are not supporting \n\r > > in dbnames so i remove

Re: support fast default for domain with constraints

2025-03-05 Thread jian he
) within DomainHaveVolatileConstraints i use contain_volatile_functions to test whether check_expr is volatile or not. contain_volatile_functions won't be expensive, i think. if true then have_volatile is set to true. if have_volatile is true then we need table rewrite. From 40364a9f3926a9ebc8

support fast default for domain with constraints

2025-03-04 Thread jian he
00:00:00 2001 From: jian he Date: Wed, 5 Mar 2025 10:33:50 +0800 Subject: [PATCH v1 2/2] support fast default for domain with constraints This is primarily done by evaluating CoerceToDomain with soft error support. If we evaulte CoerceToDomain to false, it means in ATExecAddColumn, the defval n

Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2025-03-12 Thread jian he
On Tue, Mar 11, 2025 at 6:31 PM Jim Jones wrote: > > > I revisited this patch today. It applies and builds cleanly, and it > works as expected. > > Some tests and minor comments: > hi. Jim Jones. thanks for testsing it again! > > > 1) WARNING might be a better fit than NOTICE here. > but

Re: Virtual generated columns

2025-02-16 Thread jian he
On Sat, Feb 15, 2025 at 8:37 PM Dean Rasheed wrote: > > On Fri, 14 Feb 2025 at 10:59, Peter Eisentraut wrote: > > > > On 13.02.25 14:06, jian he wrote: > > > I didn't solve the out join semantic issue. > > > i am wondering, can we do the virtual genera

Re: Virtual generated columns

2025-02-19 Thread jian he
On Wed, Feb 19, 2025 at 11:25 PM Dean Rasheed wrote: > > On Wed, 19 Feb 2025 at 01:42, Dean Rasheed wrote: > > > > One thing I don't like about this is that it's introducing more code > > duplication between pullup_replace_vars() and > > ReplaceVarsFromTargetList(). Those already had a lot of cod

Re: Non-text mode for pg_dumpall

2025-02-20 Thread jian he
hi. about 0001 /* * connectDatabase * * Make a database connection with the given parameters. An * interactive password prompt is automatically issued if required. * * If fail_on_error is false, we return NULL without printing any message * on failure, but preserve any prompted password fo

Re: Virtual generated columns

2025-02-20 Thread jian he
On Wed, Feb 19, 2025 at 11:25 PM Dean Rasheed wrote: > > One of the new regression tests fails, which actually appears to be a > pre-existing grouping sets bug, due to the fact that only non-Vars are > wrapped in PHVs. This bug can be triggered without virtual generated > columns: > > CREATE TABLE

Re: Non-text mode for pg_dumpall

2025-02-22 Thread jian he
hi. v20-0001 in src/bin/pg_dump/pg_dumpall.c, we have: static const char *connstr = ""; case 'd': connstr = pg_strdup(optarg); break; i am not sure you can declare it as "const" for connstr. since connstr value can be changed. ``#include "pg_backup.h"`

Re: Statistics Import and Export

2025-02-24 Thread jian he
On Tue, Feb 25, 2025 at 5:01 AM Jeff Davis wrote: > > On Mon, 2025-02-24 at 15:53 -0500, Andres Freund wrote: > > I don't think that's necessarily true, hot pruning might help some, > > as afaict > > the restore happens in multiple transactions. > > Yeah, I just dumped and reloaded the regression

Statistics Import and Export commit related issue.

2025-02-24 Thread jian he
obs concurrent sessions. """ we may need to change the above sentence? pg_restore restore STATISTICS DATA also doing it concurrently if --jobs is specified. From f1ce9c90493d300c0c0d1169c483a18661416c3f Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 25 Feb 2025 14:13:24 +08

Re: Virtual generated columns

2025-02-23 Thread jian he
On Sat, Feb 22, 2025 at 11:12 PM Richard Guo wrote: > > On Sat, Feb 22, 2025 at 11:55 PM Richard Guo wrote: > > Attached are the updated patches to fix all the mentioned issues. I > > plan to push them early next week after staring at the code for a bit > > longer, barring any objections. > > Si

Re: Non-text mode for pg_dumpall

2025-02-24 Thread jian he
hi. some documentation issue: doc/src/sgml/ref/pg_dumpall.sgml d directory Output a directory-format archive suitable for input into pg_restore. Under dboid subdirectory, this will create a directory with one file for ea

Re: bug in stored generated column over domain with constraints.

2025-02-25 Thread jian he
hi. comments refined and minor aesthetic adjustments made. From 22ef7ce384de3098fc19ae0bb9bc9777b269b8ec Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 26 Feb 2025 11:29:04 +0800 Subject: [PATCH v2 1/1] fix default insertion for stored generated column with domain over constraints. create

bug in stored generated column over domain with constraints.

2025-02-25 Thread jian he
9aa7667b06e16189d318f7850d559d446d52 From 1820d039b472ea71d3b80b98096a81bb5fc3857b Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 26 Feb 2025 01:05:46 +0800 Subject: [PATCH v1 1/1] fix default insertion for stored generated column with domain over constraints. create domain d3 as int check (value is not nul

Re: support virtual generated column not null constraint

2025-03-31 Thread jian he
On Fri, Mar 28, 2025 at 10:06 PM Peter Eisentraut wrote: > > On 24.03.25 04:26, jian he wrote: > > rebase, and some minor code comments change. > > I have committed this. > In an earlier thread, I also posted a patch for supporting virtual generated columns over domain type

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread jian he
On Sat, Mar 29, 2025 at 2:42 AM Alvaro Herrera wrote: > > On 2025-Mar-28, jian he wrote: > > > i think your patch messed up with pg_constraint.conislocal. > > for example: > > > > CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST >

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread jian he
hi. in notnull-notvalid.patch + if (coninfo->contype == 'c') + keyword = "CHECK CONSTRAINT"; + else + keyword = "INVALID NOT NULL CONSTRAINT"; we have a new TocEntry->desc kind. so the following related code within src/bin/pg_dump also needs change

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread jian he
On Thu, Apr 3, 2025 at 2:24 AM Alvaro Herrera wrote: > > create table singlepp (id bigint default 1) partition by list (id); > alter table singlepp add constraint dummy_constr not null id not valid; > create table singlepp_1 (id bigint default 1); > alter table singlepp_1 add constraint dummy_cons

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-04 Thread jian he
On Thu, Mar 20, 2025 at 11:53 PM Alvaro Herrera wrote: > > On 2025-Mar-20, jian he wrote: > > > > Is it expected that a child may have VALID constraint but parent has > > > not valid constraint? > > > > but the MergeConstraintsIntoExisting logic is when &

Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2025-04-04 Thread jian he
error while applying patch > Applying: COPY (on_error set_to_null) > .git/rebase-apply/patch:39: trailing whitespace. > a NOTICE message indicating the number of rows > warning: 1 line adds whitespace errors. fixed. From cfd9afbc583aac39f73f224cb70c9196398c3176 Mon Sep 17 00:00

<    5   6   7   8   9   10   11   12   13   >