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 > \"

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/

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

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

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

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

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

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

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

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

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

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

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 -

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

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

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: 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: Make COPY format extendable: Extract COPY TO format implementations

2025-04-06 Thread jian he
On Thu, Mar 27, 2025 at 11:29 AM Sutou Kouhei wrote: > We can merge 0001 quickly, right? I did a brief review of v39-0001 and v39-0002. text: COPY_FILE COPY_FRONTEND still appear on comments in copyfrom_internal.h and copyto.c, Should it be removed? +#include "commands/copyto_internal.h" #incl

Re: support virtual generated column not null constraint

2025-04-05 Thread jian he
hi. rebase, and some minor code comments change. From 0af096b3959cc6f146bbe8a54a018c0e69beff2e Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 24 Mar 2025 11:22:54 +0800 Subject: [PATCH v6 1/1] not null for virtual generated column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8

two occurrences of assign print_notnull within pg_dump.c

2025-04-05 Thread jian he
hi. in src/bin/pg_dump/pg_dump.c within function dumpTableSchema: there are two occurrences of: print_notnull = (tbinfo->notnull_constrs[j] != NULL && (tbinfo->notnull_islocal[j] || dopt->binary_upgrade

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

2025-04-05 Thread jian he
tables and populated materialized views. For example, COPY table TO copies the same rows as SELECT * FROM ONLY table. However it doesn't directly support other relation types, such as partitioned tables, inheritance child tables, or views. > The tests seem to

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

2025-04-05 Thread jian he
On Sat, Apr 5, 2025 at 5:33 AM Masahiko Sawada wrote: > > On Fri, Apr 4, 2025 at 4:55 AM jian he wrote: > > > > On Tue, Mar 25, 2025 at 2:31 PM vignesh C wrote: > > > > > > 2) Here in error we say column c1 violates not-null constraint and in > > &

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

2025-04-05 Thread jian he
CREATE TABLE LIKE. CREATE TABLE LIKE will copy the invalid not-null constraint and will become valid, i think this is what we want. The added regress test is a little bit verbose, trying to make it less verbose. polish comments here and there. From 8583163960b136a52aea7ab02b5cd8b5a81deeca Mon Sep 17

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

Re: speedup COPY TO for partitioned table.

2025-04-03 Thread jian he
On Tue, Apr 1, 2025 at 1:38 PM vignesh C wrote: > > On Tue, 1 Apr 2025 at 06:31, jian he wrote: > > > > On Mon, Mar 31, 2025 at 4:05 PM Kirill Reshke > > wrote: > > > > Thanks for doing the benchmark. > > Few comments to improve the comments, error

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-02 Thread jian he
c8hqnbjdhaixncs2vr3j_1...@mail.gmail.com From 5d6da8791aa46d63e872c5a9f463b05bb2d0f9e8 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 2 Apr 2025 21:47:22 +0800 Subject: [PATCH v6 1/1] ensure pg_dump table constraint info remain the same resolve case where parent constraint convalidated is false

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: 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: 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: 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: 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-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 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: 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: support ALTER TABLE DROP EXPRESSION for virtual generated column

2025-03-29 Thread jian he
On Thu, Mar 27, 2025 at 11:44 AM David G. Johnston wrote: > > On Wednesday, March 26, 2025, Tom Lane wrote: >> >> jian he writes: >> > the attached patch is to implement $subject. >> >> Why would this be a good idea? I don't see any principled fallb

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

2025-03-28 Thread jian he
On Thu, Mar 27, 2025 at 3:04 AM Kirill Reshke wrote: > > > > hi. > > patch attached. > > also cc to Tom, > > since at that time, you are against the idea of ``COPY matview TO``. > > Hi! With this patch it is possible to COPY matview TO, but not regular > view, which is surprising. Let's fix that?

Re: speedup COPY TO for partitioned table.

2025-03-28 Thread jian he
On Fri, Mar 28, 2025 at 9:03 PM vignesh C wrote: > > On Fri, 28 Mar 2025 at 08:39, jian he wrote: > > > > hi. > > > > I made a mistake. > > The regress test sql file should have a new line at the end of the file. > > Couple of suggestions: > 1) Can

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

2025-03-28 Thread jian he
On Fri, Mar 28, 2025 at 3:25 AM Alvaro Herrera wrote: > > On 2025-Mar-24, jian he wrote: > > > hi. > > you may like the attached. it's based on your idea: attnotnullvalid. > > This is quite close to what I was thinking, yeah. I noticed a couple of > bugs ho

duplicated comments on get_relation_constraints

2025-03-27 Thread jian he
hi. in plancat.c, function: get_relation_constraints ``` for (i = 0; i < num_check; i++) { Node *cexpr; /* * If this constraint hasn't been fully validated yet, we must * ignore it here. Also ignore if NO INHERIT and we weren't told * that that's safe. */

Re: speedup COPY TO for partitioned table.

2025-03-27 Thread jian he
hi. I made a mistake. The regress test sql file should have a new line at the end of the file. From a4c643ac3a9f40bbdf07dcacc38527ef6e86f1bc Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 28 Mar 2025 11:05:53 +0800 Subject: [PATCH v5 1/1] support COPY partitioned_table TO CREATE TABLE pp (id

Re: speedup COPY TO for partitioned table.

2025-03-27 Thread jian he
es. so: copy t1 to stdout(header); ERROR: cannot copy from foreign table "t1" DETAIL: partition "t1" is a foreign table HINT: Try the COPY (SELECT ...) TO variant. From a2db87abfe0e1a4dda0ace47c65a9778f29fe5f2 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 28 Mar 2025 1

support ALTER TABLE DROP EXPRESSION for virtual generated column

2025-03-26 Thread jian he
ssion. From b3b23e5d7fee6143521560790bf4ad14e21e8a49 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 27 Mar 2025 09:49:29 +0800 Subject: [PATCH v1 1/1] support ALTER TABLE DROP EXPRESSION for virtual generated column It seems fairly straightforward: drop the generation expressi

support create index on virtual generated column.

2025-03-26 Thread jian he
eeds to be rebuilt. * ALTER COLUMN SET DATA TYPE will also cause table rewrite, so we really need to track the virtual generated column attribute number that index was built on. From 8a60de43a7d1abf765a16890d6da7dc7e7f8a06d Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 26 Mar 2025 15:01:28 +08

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

2025-03-25 Thread jian he
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 to another collation. In ATExecAlterColumnType, we also need to set the generation exp

Re: support fast default for domain with constraints

2025-03-24 Thread jian he
with empty rows aligned with master behavior. also will do table rewrite if the new column is domain with volatile check constraints, so less surprising behavior. From 09547bbc65f20846ac28efce035c016b21a75825 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 24 Mar 2025 16:07:46 +0800 Subject

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

2025-03-24 Thread jian he
l); ^ will become COPY x from stdin (format null); ERROR: COPY format "null" not recognized LINE 1: COPY x from stdin (format null); ^ it will cause NULL_P from reserved word to non-reserved word in the COPY related comma

Re: Doc: fix the rewrite condition when executing ALTER TABLE ADD COLUMN

2025-03-23 Thread jian he
hi. https://git.postgresql.org/cgit/postgresql.git/commit/?id=11bd8318602fc2282a6201f714c15461dc2009c6 + Adding a column with a volatile DEFAULT + (e.g., clock_timestamp()), a generated column + (e.g., GENERATED BY DEFAULT AS IDENTITY), a domain + data type with constraints will require the entir

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

2025-03-23 Thread jian he
traint name properly, but that's fine for not-null constraint, i think. * regular table invalid not null constraint pg_dump also works fine. From fc4bf954772d25dfbf60774429d875f78e4fd69e Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 24 Mar 2025 09:21:10 +0800 Subject: [PATCH v5 1/1] NOT NULL NOT

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

2025-03-20 Thread jian he
-null constraint to check if this column exists NULL values or not. * partitioned table can not have NOT NULL NOT VALID. From 0106f2ded55a699324369412de859ab93f374960 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 20 Mar 2025 22:43:08 +0800 Subject: [PATCH v3 1/1] NOT NULL NOT VALID MIME-Vers

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

2025-03-20 Thread jian he
On Thu, Mar 20, 2025 at 5:54 PM Rushabh Lathia wrote: > hi. looking at the regress tests. +-- verify NOT NULL VALID/NOT VALID +CREATE TABLE notnull_tbl1 (a INTEGER, b INTEGER); +INSERT INTO notnull_tbl1 VALUES (NULL, 1); +INSERT INTO notnull_tbl1 VALUES (NULL, 2); +INSERT INTO notnull_tbl1 VALUES

Re: support virtual generated column not null constraint

2025-03-19 Thread jian he
think you mean this thread: https://postgr.es/m/173591158454.714.7664064332419606...@wrigleys.postgresql.org should i put a test into generated_virtual.sql? + * We implement this by consing up a NullTest node for each virtual trivial question. I googled, and still found any explanation of th

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
From 835dc9364f9f986445b77af8fa761e7577cbbdff Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 19 Mar 2025 11:58:55 +0800 Subject: [PATCH v3 1/1] add argument name to function substring and substr also add substr and substring (no keywords) functions entry to doc. Table 9.9 is about keywords substring entry, now Table 9.10

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
On Wed, Mar 19, 2025 at 8:19 AM David G. Johnston wrote: > > The vast majority of examples throughout the manual use traditional function > call syntax func_name(arg1, arg2, etc.); I'd rather keep with convention > than start to scatter about alternative syntax choices just to give the > rand

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
7.3. also add an example about using named natation call substring: substring(string=>'foobar', pattern=> 'o.b') the patch is small, I just put the \df substring \df substr (before and after patch) output into the commit message. From f0b49ccd27d41ff1bd1619284656efcb1d3c

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

2025-03-17 Thread jian he
TM: "invalid values in %llu rows were replaced with null" > changed based on this. also minor documentation tweaks. From 3553eee56c8dd0c3ce334d1f37b511acbbc640af Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 18 Mar 2025 11:51:48 +0800 Subject: [PATCH v13 1/1] COPY (on_error set_to_null) Extent "on

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

2025-03-17 Thread jian he
null constraints: "nc1" NOT NULL "a" Access method: heap --- some regress tests added. need more polishing, but overall it works as the above described. not sure if this idea is crazy or not, what do you think? From 5a66a8da2a8c5fef88

Re: general purpose array_sort

2025-03-16 Thread jian he
best to include such a test case, so I've attached a patch. [0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=4618045bee4a6d3efcb489c319649d8dd9aaa738 From 9ab98e6470dd5f16ef6024c291e5aa99ebfbecde Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 16 Mar 2025 21:31:55 +0800 Sub

Re: how to see the generated nodetags.h

2025-03-14 Thread jian he
On Sat, Mar 15, 2025 at 2:26 AM Hao Zhang wrote: > > Hello Hackers > > It seems nodetags.h is generated by gen_node_support.pl. Where and how can I > see this generated header to get a full list of all possible node tags? Thx > > > typedef enum NodeTag > { > T_Invalid = 0, > > #include "nodes

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

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

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

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

  1   2   3   4   5   6   7   8   9   10   >