Re: Why cannot alter column type when a view depends on it?

2025-09-28 Thread jian he
On Sun, Sep 28, 2025 at 4:19 PM Chao Li wrote: > > ``` > evantest=# create table t (c char(20)); > CREATE TABLE > evantest=# create view v_t as select * from t; > CREATE VIEW > > evantest=# alter table t alter column c type char(25); > ERROR: cannot alter type of a column used by a view or rule >

Re: bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation

2025-09-27 Thread jian he
On Sat, Sep 27, 2025 at 5:54 PM jian he wrote: > > While at it, maybe we can also polish the comment below in ATRewriteCatalogs. > /* > * After the ALTER TYPE or SET EXPRESSION pass, do cleanup work > * (this is not done in ATExecAlterColu

bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation

2025-09-27 Thread jian he
* done only once if multiple columns of a table are altered). */ but I didn't do it... From 452f38f84fb61b08e200c7bd0d96663701df299c Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 27 Sep 2025 17:46:45 +0800 Subject: [PATCH v1 1/1] ALTER TABLE each relation call ATPostA

Re: [PATCH] GROUP BY ALL

2025-09-26 Thread jian he
On Fri, Sep 26, 2025 at 11:46 PM David Christensen wrote: > > > > > I’m interested in picking it up again but would appreciate the review. > > Here is a rebased version with a few more tests. I also changed the > main check here to using `!contain_agg_clause` instead of > `!IsA(Aggref))` directly

Re: NOT NULL NOT ENFORCED

2025-09-24 Thread jian he
On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: > > On 2025-Sep-04, jian he wrote: > > > @@ -3093,6 +3115,16 @@ AddRelationNotNullConstraints(Relation rel, List > > *constraints, > > conname = other->name; > > > &

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-09-23 Thread jian he
sJ=31x...@mail.gmail.com From 960f621ff2664b6400e9a079c182e501f004e11e Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 24 Sep 2025 11:07:40 +0800 Subject: [PATCH v4 1/1] ALTER DOMAIN ADD NOT NULL NOT VALID We already support NOT NULL NO VALID for table constraints, and the same can be extended to domains by al

Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-22 Thread jian he
On Mon, Sep 15, 2025 at 8:40 PM jian he wrote: > > Summary of attached v4: > v4-0001: Handles ALTER TABLE DROP COLUMN when whole-row Vars are > referenced in check constraints and indexes. > > v4-0002: Handles ALTER TABLE ALTER COLUMN SET DATA TYPE when whole-row > Vars ar

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-09-22 Thread jian he
On Sat, Sep 20, 2025 at 4:06 AM Dmitry Koval wrote: > > Hi, Jiah He! > > Thanks! > > >list_intersection seems not right, how can we be sure it deals with > >collation correctly? > > list_intersection function replaced by new partitions_lists_intersection > function. > hi, more about v60. + /*

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-09-19 Thread jian he
hi. about v59. check_partitions_not_overlap_list overlap = list_intersection(sps1->bound->listdatums, sps2->bound->listdatums); if (list_length(overlap) > 0) { Const *val = (Const *) lfirst(list_head(

Doc: add XML ID attributes to tags for create_foreign_table, alter_foreign_table

2025-09-18 Thread jian he
automate all , but there are so many . From a6086095e0e731a96c95598a0f632d94e4d3fcf3 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 19 Sep 2025 10:27:28 +0800 Subject: [PATCH v1 1/2] Doc: add XML ID attributes to tags for create_foreign_table.sgml --- doc/src/sgml/ref

Re: pg_restore --no-policies should not restore policies' comment

2025-09-18 Thread jian he
On Tue, Sep 9, 2025 at 12:00 PM Fujii Masao wrote: > > On Thu, Sep 4, 2025 at 6:00 PM jian he wrote: > > in _tocEntryRestorePass > > if we do > > > > if ((strcmp(te->desc, "COMMENT") == 0 || > > strcmp(te->desc, "SECURITY LAB

Re: someone else to do the list of acknowledgments

2025-09-18 Thread jian he
On Thu, Sep 18, 2025 at 1:02 PM Corey Huinker wrote: >> > > So here's the updated. > > This was done against the git log REL_17_STABLE..REL_18_STABLE, > as of 2d756ebbe857e3d395d18350bf232300ebd23981 on master and > a7024398b80a836a83c00af42c6ab7cc25c12087 on REL_18_STABLE. > hi. I double check

Re: someone else to do the list of acknowledgments

2025-09-18 Thread jian he
On Thu, Sep 18, 2025 at 1:02 PM Corey Huinker wrote: >> > So here's the updated. > > This was done against the git log REL_17_STABLE..REL_18_STABLE, > as of 2d756ebbe857e3d395d18350bf232300ebd23981 on master and > a7024398b80a836a83c00af42c6ab7cc25c12087 on REL_18_STABLE. > Hacking Discord shou

Re: someone else to do the list of acknowledgments

2025-09-17 Thread jian he
On Sun, Aug 17, 2025 at 12:40 PM Corey Huinker wrote: > > On Sat, Aug 16, 2025 at 11:58 PM jian he wrote: >> >> hi. >> maybe we should start working on this? >> >> https://www.postgresql.org/developer/roadmap >> says 18 will be released in September 20

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-09-17 Thread jian he
On Wed, Sep 17, 2025 at 3:35 PM jian he wrote: > > On Wed, Sep 17, 2025 at 6:08 AM Dmitry Koval wrote: > > > > 2. Patch v56-0001-refactor-v56-check_partitions_for_split.no-cfbot > > applied with cosmetic changes. > > In the previous thread (https://postgr.

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-09-17 Thread jian he
On Wed, Sep 17, 2025 at 6:08 AM Dmitry Koval wrote: > > 2. Patch v56-0001-refactor-v56-check_partitions_for_split.no-cfbot > applied with cosmetic changes. > hi. check_two_partitions_bounds_range ereport(ERROR, errcode(ERRCODE_INVALID_OBJECT_DEFINITION), m

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-09-16 Thread jian he
On Tue, Sep 16, 2025 at 6:11 AM Dmitry Koval wrote: > > 7) Additionally, I've made a numerous and small fixes for grammar to the > docs directly to the patchset. > v56-0002, SPLIT PARTITION check_partitions_for_split is way too overwhelming. Similar to transformPartitionCmdForMerge, we can put so

Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-15 Thread jian he
pull_varattnos is not enough to locate whole-row Var. Instead, obtain the whole-row type OID and recursively check each Var in expression node to see if its vartype matches the whole-row type OID. From 5d3ad72059977c6c3576c92e1ba25684f80b628d Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 15 S

CREATE TABLE LIKE INCLUDING POLICIES

2025-09-14 Thread jian he
olicy, add function transformPolicyStmt briefly explained in [1]. v1-0002: CREATE TABLE LIKE INCLUDING-POLICIES [1] https://postgr.es/m/CACJufxGPcBzdL9T6Qh=OFecN8zqxuU0QXfYF8F3WYV=uzwy...@mail.gmail.com From d94917c777c3fd454a438b31806e35ffe74ac5f1 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon,

Re: let ALTER COLUMN SET DATA TYPE cope with POLICY dependency

2025-09-14 Thread jian he
On Fri, Sep 12, 2025 at 4:19 PM jian he wrote: > > hi. > > in [1], > RememberAllDependentForRebuilding > /* > * A policy can depend on a column because the column is > * specified in the policy&#x

remove unnecessary include in src/backend/commands/policy.c

2025-09-13 Thread jian he
ary "include", so I removed it. we can also remove #include "access/relation.h" replace relation_open to table_open, since we already did relkind check in RangeVarCallbackForPolicy. From 5ba1586d0844ec40674338ad920b12a61dd646ed Mon Sep 17 00:00:00 2001 From: jian he Date: Sun,

Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-12 Thread jian he
USING (dlevel <= (SELECT seclv FROM uaccount WHERE pguser = current_user)); so I am still working on whole-row referenced policies interacting with ALTER TABLE SET DATA TYPE/ALTER TABLE DROP COLUMN. From 090a087da9b7fb072acd7e9683faf9ba2b5c76af Mon Sep 17 00:00:00 2001 From: jian he Date: Fri,

let ALTER COLUMN SET DATA TYPE cope with POLICY dependency

2025-09-12 Thread jian he
b SET EXPRESSION AS (-1); --OK so i guess ALTER TABLE SET DATA TYPE, table rewrite no checking policy should be fine? [1] https://git.postgresql.org/cgit/postgresql.git/commit/?id=143b39c1855f8a22f474f20354ee5ee5d2f4d266 From be887b714a3bc788b6859954fad63137d64d1f61 Mon Sep 17 00:00:00 2001 From:

Re: someone else to do the list of acknowledgments

2025-09-10 Thread jian he
hi. Kuroda Hayato Hayato Kuroda refers to the same person. Takatsuka Haruka Haruka Takatsuka refers to the same person.

Re: someone else to do the list of acknowledgments

2025-09-10 Thread jian he
hi. Nikita Nikita Kalinin Nikita Malakhov The first "Nikita" refers to the commit below 058b5152f02ef86c98a795c14dbd6a8e195f4fd1. Author: Daniel Gustafsson Date: Thu Mar 27 22:57:34 2025 +0100 Fix guc_malloc calls for consistency and OOM checks Author: Daniel Gustafsson Reported-b

Re: someone else to do the list of acknowledgments

2025-09-10 Thread jian he
On Wed, Sep 10, 2025 at 11:11 PM Corey Huinker wrote: > > 516 contributors this cycle vs 462 last cycle. > > When name accents/capitalization differed, I went with the string used in the > previous year. > > Some of the names that come from bug reports and doc fixes are just first > names, and t

Re: PostgreSQL 18 GA press release draft

2025-09-09 Thread jian he
On Wed, Sep 10, 2025 at 11:13 AM Jonathan S. Katz wrote: > > Hi, > > Please review for the press release for the following: > > * Correctness and accuracy of what's described - we want to be > technically correct, but we also need to explain why something matters > to our users. PostgreSQL 18 add

Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-09 Thread jian he
ull; CREATE POLICY p1 ON ts USING (ts >= ROW(1,1,1)); CREATE POLICY p2 ON ts USING (ts.a = 1); ALTER TABLE ts DROP COLUMN a CASCADE; will drop above all indexes, constraints and policies on the table ts. From 0bfe5dd6cc313eac75a81aaf122ef090fdd26a98 Mon Sep 17 00:00:00 2001 From: jian he Dat

Re: NOT NULL NOT ENFORCED

2025-09-08 Thread jian he
On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: > > > @@ -9937,9 +9962,9 @@ ATAddCheckNNConstraint(List **wqueue, > > AlteredTableInfo *tab, Relation rel, > >* If adding a valid not-null constraint, set the > > pg_attribute flag > >* and tell phase 3 to verif

let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-07 Thread jian he
and constraints. [1] https://www.postgresql.org/docs/devel/sql-altertable.html#SQL-ALTERTABLE-DESC-DROP-COLUMN From 82f795b26e9438990680f0c56ff82853504e80eb Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 8 Sep 2025 02:06:18 +0800 Subject: [PATCH v1 1/1] let ALTER TABLE DROP COLUMN drop

NOT NULL NOT ENFORCED

2025-09-06 Thread jian he
tten extensive tests to cover the corner case, the tests may be overwhelming. [1]: https://www.postgresql.org/docs/devel/features-sql-standard.html From 12e06cc4c964b6c9c17c55dc94edac0a18653f2f Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 4 Sep 2025 10:52:30 +0800 Subject: [PATCH v1 1/1] N

pg_dump, pg_dumpall, pg_restore HELP progname descrption of "--no-table-access-method" is wrong?

2025-09-04 Thread jian he
hi. in pg_dump, pg_dumpall, pg_restore help(const char *progname) function we have: printf(_(" --no-table-access-method do not dump table access methods\n")); printf(_(" --no-tablespaces do not dump tablespace assignments\n")); but we do dump table access method. So the

Re: NOT NULL NOT ENFORCED

2025-09-04 Thread jian he
Or maybe I'm > missing something ...? > it's indeed a bug, which was introduced https://git.postgresql.org/cgit/postgresql.git/diff/src/backend/parser/parse_utilcmd.c?id=ca87c415e2fccf81cec6fd45698dde9fae0ab570 attached is the fix, also added a test on create_table_like.sql From 6ee

Re: pg_restore --no-policies should not restore policies' comment

2025-09-04 Thread jian he
On Wed, Sep 3, 2025 at 7:50 PM Fujii Masao wrote: > > > > > 02: make pg_dump dump security label for shared database objects, like > > > > subscription, roles. > > As I understand it, shared objects like roles are handled by pg_dumpall, > which already dumps their security labels via pg_shseclabel

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-09-03 Thread jian he
y once and also reduces redundant error checks. The logic is now more intuitive: we first error checking CreateStatsStmt->relations and then call transformStatsStmt to parse analysis CreateStatsStmt->exprs. please check the attached refactor CreateStatsStmt. From f11f1c97ef4a18a31d5442e4e745

Re: Refactoring: Use soft error reporting for *_opt_error functions

2025-09-03 Thread jian he
On Wed, Sep 3, 2025 at 7:52 PM Amul Sul wrote: > --- a/src/include/utils/numeric.h +++ b/src/include/utils/numeric.h -extern int32 numeric_int4_opt_error(Numeric num, bool *have_error); . +extern int32 numeric_int4_safe(Numeric num, Node *escontext); would any extensions using these function

fix NOT VALID NOT NULL with ALTER COLUMN SET IDENTITY

2025-09-03 Thread jian he
32dc89c57e47a89d8a0719a690f70a089d738925 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 3 Sep 2025 16:27:24 +0800 Subject: [PATCH v1 1/1] fix NOT VALID NOT NULL CONSTRAINT with identity column fix the below problem: CREATE TABLE notnull_tbl1 (a int, b int); INSERT INTO notnull_tbl1 VALUES (NULL

Re: support fast default for domain with constraints

2025-09-03 Thread jian he
s. [1] https://postgr.es/m/cacjufxfhwywzf2sjs9txskeya8hstxgdb8q2qwwwbo5q1sm...@mail.gmail.com From 78cf6b0d9013267ad7d8e2e9a1ac2fac564df077 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 2 Jun 2025 16:50:34 +0800 Subject: [PATCH v7 3/4] fast default for domain with constraints This is primarily done

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-29 Thread jian he
On Tue, Aug 26, 2025 at 4:05 PM Dmitry Koval wrote: > > Hi! > Thanks for the notes and patches! > hi. ORDER BY regclass seems not stable, see https://git.postgresql.org/cgit/postgresql.git/commit/?id=17bcf4f5450430f67b744c225566c9e0e6413e95 some of the SQL tests seem not necessary, so I refactore

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread jian he
d be fine. please check the attached POC, regress tests also added. main idea is first check CreateStatsStmt->relations, then call transformStatsStmt, transformStatsStmt only to transform CreateStatsStmt->exprs. also the above complaint about the relation lock issue will be resolved. From 049

[patch] ALTER COLUMN SET EXPRESSION [GENERATED|STORED]

2025-08-27 Thread jian he
column values as 0, isnull as true). what do you think? From cc458eec71fd100ea420629ae9d84d9e80bbdd88 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 28 Aug 2025 11:53:46 +0800 Subject: [PATCH v1 1/1] ALTER COLUMN SET EXPRESSION [GENERATED|STORED] example syntax explanation: ALTER TABLE gtest29

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-27 Thread jian he
On Mon, Aug 25, 2025 at 9:04 PM Kirill Reshke wrote: > > Hi! > > On Sun, 24 Aug 2025 at 14:05, jian he wrote: > > > > hi. > > > > --this ALTER COLUMN DROP EXPRESSION work as expected > > DROP TABLE IF EXISTS parent cascade; > > CREATE TABLE pare

Re: pg_restore --no-policies should not restore policies' comment

2025-08-26 Thread jian he
On Tue, Aug 26, 2025 at 7:43 PM Fujii Masao wrote: > > > > > summary of attached patch: > > Thanks for the patches! > > > 01: make pg_restore not restore comments if comments associated > > objects are excluded. > > > TODO: need perl tests > > How about adding tests for pg_restore --no-policies in

Re: SQL:2023 JSON simplified accessor support

2025-08-26 Thread jian he
On Tue, Aug 26, 2025 at 11:53 AM Alexandra Wang wrote: > > Hi Jian, > > I’ve attached v14, which includes only indentation and comment changes > from v13. > hi. still reviewing v14-0001 to v14-0005. I am confused by the comments in jsonb_subscript_transform "" * (b) jsonb_subscript_make_jso

Re: CREATE SCHEMA ... CREATE DOMAIN support

2025-08-25 Thread jian he
n encoding, if fail, error message may different on different machines, So we have to put some of the tests to collate.icu.utf8.sql. Please check the latest attached. v7-0001-Don-t-try-to-re-order-the-subcommands-of-CREATE-SCHEMA.patch v7-0002-CREATE-SCHEMA-CREATE-DOMAIN.patch v7-0003-CREATE-SCHEMA

Re: [PATCH] no table rewrite when set column type to constrained domain

2025-08-25 Thread jian he
On Thu, Jul 10, 2025 at 2:00 AM jian he wrote: > > we can add a new boolean field, coerce_to_domain, to NewColumnValue. this > field > is set to true only when changing an existing column's type to a constrained > domain. In such cases, a table scan is enough—no tab

Re: Problem in 'ORDER BY' of a column using a created collation?

2025-08-25 Thread jian he
On Mon, Aug 25, 2025 at 3:52 PM Nishant Sharma wrote: > > > Experiment 1:- > SQL File : PG_Exp_1.sql > > Actual Output : PG_Exp_1.out > > Created COLLATION : CREATE COLLATION test_coll ( > provider = icu, locale = 'ja-u-kr-latn-digit'); > > Experiment 2:- > SQL File : PG_Exp_2.sql > > Actual Outpu

Re: SQL:2023 JSON simplified accessor support

2025-08-25 Thread jian he
On Sat, Aug 23, 2025 at 3:34 AM Alexandra Wang wrote: > > I don’t understand the question. In the case of an unsupported Node > type (not an Indices in patch 0001 or 0002), we break out of the loop > to stop transforming the remaining subscripts. So there won’t be any > ‘not contiguous’ indirectio

Re: disallow alter individual column if partition key contains wholerow reference

2025-08-24 Thread jian he
On Mon, Aug 25, 2025 at 11:58 AM Chao Li wrote: > > I tested this patch with “partition by range”, it works for me. > > Just have a few small comments: > > + if (bms_is_member(0 - > FirstLowInvalidHeapAttributeNumber, expr_attrs)) > > Can we simply check “if (Var *)expr->var

Re: bug: virtual generated column can be partition key

2025-08-24 Thread jian he
On Tue, May 6, 2025 at 6:49 PM Yura Sokolov wrote: > > 06.05.2025 13:31, 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

Re: disallow alter individual column if partition key contains wholerow reference

2025-08-24 Thread jian he
On Tue, Apr 22, 2025 at 7:39 PM jian he wrote: > > demo: > drop table if exists t4; > CREATE TABLE t4(f1 int, f2 bigint) PARTITION BY list ((t4)); > create table t4_1 partition of t4 for values in ((1,2)); > alter table t4 alter column f2 set data type text using f2; > >

minor refactor on src/test/modules/test_ddl_deparse/sql/alter_table.sql

2025-08-24 Thread jian he
ALTER COLUMN SET EXPRESSION, so I added a test on it. From 55fed544cab5addb108d61f43fe6d2286fcb6f40 Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 24 Aug 2025 22:51:30 +0800 Subject: [PATCH v1 1/1] refactor test_ddl_deparse/sql/alter_table.sql 1. The test initially focuses on the "parent&

Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-24 Thread jian he
generated error: ERROR: 0A000: ALTER TABLE / DROP EXPRESSION must be applied to child tables too LOCATION: ATPrepDropExpression, tablecmds.c:8734 The attached patch fixes this potential issue. From 78f2d0734d492296289671cc0b740329d1f2da30 Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 24 Aug

Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)

2025-08-23 Thread jian he
hi. I just found this https://www.postgresql.org/message-id/flat/CALAY4q8o00Sg5nemi2AuqNuLvmGLaR6br%2BYrvM41ZuSPjM2Qvg%40mail.gmail.com maybe it's not that very helpful. IMV, pg_dump --option="view_name" is better than pg_dump -d cary --where="test1:a3 = ( select max(aa1) from test2 )" > testdump

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-22 Thread jian he
hi. will + if (!IsA(rln, RangeVar)) + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("CREATE STATISTICS only supports regular tables, materialized views, foreign table

Re: SQL:2023 JSON simplified accessor support

2025-08-22 Thread jian he
On Thu, Aug 21, 2025 at 12:54 PM Alexandra Wang wrote: > > Hi Jian, > > Thanks for reviewing! I’ve attached v13, which addresses your > feedback. > hi. in the context of v13-0001 and v13-0002. In transformIndirection: while (subscripts) { Node *newresult = (Node *) = transformContainer

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-21 Thread jian he
On Thu, Aug 21, 2025 at 2:45 PM jian he wrote: > > On Thu, Aug 21, 2025 at 10:53 AM jian he wrote: > > > > > this time, I only checked > > > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch hi. +static void +check_two_partitions_bounds_range(Relati

misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-21 Thread jian he
hi. while reviewing other work, some error messages in src/backend/tcop/utility.c seem not accurate. static void ProcessUtilitySlow(ParseState *pstate, PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context,

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
On Thu, Aug 21, 2025 at 10:53 AM jian he wrote: > > > this time, I only checked > > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch > > hi. we may need to change checkPartition. +-- ERROR: "sales_apr2022" is not a table +ALTER TABLE sales_range

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
On Wed, Aug 20, 2025 at 5:22 PM jian he wrote: > > this time, I only checked > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch > > typedef struct PartitionCmd > { > NodeTagtype; > RangeVar *name;/* name of partitio

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
hi. this time, I only checked v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch typedef struct PartitionCmd { NodeTagtype; RangeVar *name;/* name of partition to attach/detach/merge */ PartitionBoundSpec *bound;/* FOR VALUES, if attaching */

Re: UPDATE with invalid domain constraint

2025-08-19 Thread jian he
On Tue, Aug 19, 2025 at 10:08 PM jian he wrote: > > drop table if exists dt1; > drop domain if exists d1; > create domain d1 as int; > create table dt1(i int, c d1); > insert into dt1 values(1,2); > alter domain d1 add constraint cc check(value <> 2) not valid; &g

UPDATE with invalid domain constraint

2025-08-19 Thread jian he
hi. should UPDATE statement need to verify that the domain value is satisfied with invalid domain constraints? Álvaro Herrera already mentioned this in [1], but I just want to confirm it. drop table if exists dt1; drop domain if exists d1; create domain d1 as int; create table dt1(i int, c d1); i

Re: CREATE SCHEMA ... CREATE DOMAIN support

2025-08-18 Thread jian he
N.patch v6-0001-Don-t-try-to-re-order-the-subcommands-of-CREATE-SCHEMA.patch is refactor/rebase based on v1-0001-Don-t-try-to-re-order-the-subcommands-of-CREATE-S.patch v6-0002-CREATE-SCHEMA-CREATE-DOMAIN.patch for CREATE SCHEMA ... CREATE-DOMAIN v6-0003-CREATE-SCHEMA-CREATE-COLLATION.patch for C

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-17 Thread jian he
On Thu, Aug 14, 2025 at 5:02 PM Kirill Reshke wrote: > > I have few observations. > One is whether we should now support CREATE DOMAIN ... NOT NULL NOT > VALID syntax? This could be a separate patch though. > in gram.y: CreateDomainStmt: CREATE DOMAIN_P any_name opt_as Typename ColQu

Re: someone else to do the list of acknowledgments

2025-08-16 Thread jian he
hi. maybe we should start working on this? https://www.postgresql.org/developer/roadmap says 18 will be released in September 2025.

Re: Making jsonb_agg() faster

2025-08-15 Thread jian he
On Sat, Aug 16, 2025 at 12:57 AM Tom Lane wrote: > > I think you're missing the point: per the commit message for 0001, > > The real reason for doing it is to provide a mechanism whereby > pushJsonbValue() can be told to construct the JsonbValue tree > in a context that is not CurrentM

Re: Making jsonb_agg() faster

2025-08-14 Thread jian he
On Thu, Aug 14, 2025 at 4:59 PM jian he wrote: > > > 0001 is a somewhat invasive refactoring of the API for > > pushJsonbValue and friends. in pushJsonbValue: /* * pushJsonbValueScalar handles all cases not involving pushing a * container object as an ELEM or VALUE.

Re: Making jsonb_agg() faster

2025-08-14 Thread jian he
On Wed, Jul 23, 2025 at 12:37 AM Tom Lane wrote: > > There have been some complaints recently about how jsonb_agg() > is a lot slower than json_agg() [1]. That's annoying considering > that the whole selling point of JSONB is to have faster processing > than the original JSON type, so I poked int

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-13 Thread jian he
hi. rebase and minor cosmetic change. From b87caa1b2f78d3f1e94e1055219c97e038d2fe61 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 14 Aug 2025 10:40:49 +0800 Subject: [PATCH v3 1/1] ALTER DOMAIN ADD NOT NULL NOT VALID We have NOT NULL NO VALID for table constraints, we can make domain have

Re: on_error table, saving error info to a table

2025-08-12 Thread jian he
aving_table); > but where "error_saving_table_type" TYPE/TABLE will come from? "error_saving_table_type" either comes from built-in or makes it user defined. Preserving it as a built-in type would require broader consensus, which is likely difficult to achieve. user-define

Re: implement CAST(expr AS type FORMAT 'template')

2025-08-11 Thread jian he
m/CACJufxF4OW=x2rcwa+zmcgopdwgkdxha09qtftpcj3qstg6...@mail.gmail.com From ef719a5fcf2e96d7fc756a021aebd8caf5b0b385 Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 12 Aug 2025 14:23:02 +0800 Subject: [PATCH v4 1/1] CAST(val AS type FORMAT 'template') MIME-Version: 1.0 Content-Type: text/plain;

Re: alter check constraint enforceability

2025-08-11 Thread jian he
so here you don't need to consider RELKIND_PARTITIONED_TABLE. From a54609c8aa66174e171fdfd7c08519e587561d85 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 11 Aug 2025 17:51:56 +0800 Subject: [PATCH v3 1/1] alter check constraint enforceability syntax: ALTER TABLE ALTER CONSTRAINT [NOT] ENFOR

Re: Emitting JSON to file using COPY TO

2025-08-10 Thread jian he
e9104bcc0a6c4ca96df5ff3fdd3ae659885dd664 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 30 Jul 2025 19:50:41 +0800 Subject: [PATCH v18 3/3] Add option force_array for COPY JSON FORMAT force_array option can only be used in COPY TO with JSON format. it make the output json output behave like json array type

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-08-04 Thread jian he
On Mon, Aug 4, 2025 at 1:09 PM Corey Huinker wrote: >> >> so we need to handle numeric source types with fractional points with >> special care. >> currently, this applies only to numeric, float4, and float8. >> (hope this is all the corner case we need to catch...) > > > I'm fairly certain that t

Re: implement CAST(expr AS type FORMAT 'template')

2025-08-03 Thread jian he
hi. one more question: For binary coercible type casts, no formatted related function for it, should we error out? For example, should the following error out or return text '1'. select cast('1'::text as text format ''::text);

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-08-03 Thread jian he
hi. fix the regress tests failure in https://api.cirrus-ci.com/v1/artifact/task/5894868779663360/testrun/build/testrun/regress/regress/regression.diffs From e60e5190511326568eba8e6748062adb47f1134c Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 18 Jul 2025 13:00:19 +0800 Subject: [PATCH v4 2

Re: implement CAST(expr AS type FORMAT 'template')

2025-08-01 Thread jian he
On Tue, Jul 29, 2025 at 11:54 AM David G. Johnston wrote: > > The slight variation to this would be to specify these 2/4 and 1-arg > functions as optional “format_in” and “format_out” optional properties (like > typmod_in). The format-aware code can look for these which will end up > having th

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-07-31 Thread jian he
because it will call numeric_mul. so I made these 16 function errors safe. see v3-0001-make-some-numeric-cast-function-error-safe.patch From 0fa2361b7d7692a9c032d8a8a7f2b04ab4302849 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 18 Jul 2025 13:00:19 +0800 Subject: [PATCH

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

2025-07-29 Thread jian he
hi. rebase. From b3b2d794c83b36cf129d917d527ebf2cac46ca3b Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 30 Jul 2025 11:06:17 +0800 Subject: [PATCH v19 1/1] COPY (on_error set_null) Current grammar makes us unable to use "on_error null". if we did it, then in all the COPY command

Re: speedup COPY TO for partitioned table.

2025-07-29 Thread jian he
On Mon, Jul 28, 2025 at 9:22 AM torikoshia wrote: > > I think the behavior for materialized views can be described along with > that for partitioned tables. For example: > > COPY TO can be used with plain > tables, populated materialized views and partitioned tables. > For exampl

Re: split func.sgml to separated individual sgml files

2025-07-28 Thread jian he
hi. after run the v2 python script and ``git apply v2-0001-update-filelist.sgml-allfiles.sgml.no-cfbot`` git status -u shows: Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified

Re: implement CAST(expr AS type FORMAT 'template')

2025-07-28 Thread jian he
$ BEGIN RETURN '1'; END; $$ LANGUAGE plpgsql VOLATILE FORMAT; this function "test" format text based on second argument(template) and return json type. POC attached. what do you think? From c944169304c3922c3cc76166ccd7a54cfcf595ba Mon Sep 17 00:00:00 2001 From: jian he Date: Tue,

Re: implement CAST(expr AS type FORMAT 'template')

2025-07-28 Thread jian he
On Mon, Jul 28, 2025 at 2:31 AM Vik Fearing wrote: > > > On 27/07/2025 17:43, jian he wrote: > > hi. > > > > while working on CAST(... DEFAULT ON ERROR), I came across link[1]. I don't > > have access to the SQL standard, but based on the information in

implement CAST(expr AS type FORMAT 'template')

2025-07-27 Thread jian he
D'); --error select cast('2018-13-12' as date format '-DD-MM'); --no error select to_char(cast('2018-13-12' as date format '-DD-MM'), '-Mon-DD'); returns 2018-Dec-13 [1]: https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL_Standard#Major

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-07-24 Thread jian he
On Tue, Jul 22, 2025 at 8:26 PM Vik Fearing wrote: > > > On 22/07/2025 12:19, jian he wrote: > > On Tue, Jul 22, 2025 at 2:45 PM Vik Fearing > > wrote: > >> It was accepted into the standard after 2023 was released. I am the > >> author of this change

Re: support create index on virtual generated column.

2025-07-24 Thread jian he
ression or virtual generated column data type changes will cause the index to rebuild. Is this we want? Or should changing the generation expression or data type of a virtual generated column mark the associated index as invalid, without triggering a rebuild? From bbc6f3bd7daf53fe97e72bf92a6f9e1f1d71e

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-07-23 Thread jian he
7}'::text[] AS integer[] DEFAULT '{-1011}' ON CONVERSION ERROR); + int4 +- + {-1011} +(1 row) I didn't implement the [ FORMAT ] part for now. please check the attached regress test and tests expected result. From 47c181eee593468c3d7b7cb57aec3a1ea8cb3c1d Mon Sep 17

Re: Fix tab completion in v18 for ALTER DATABASE/USER/ROLE ... RESET

2025-07-22 Thread jian he
On Thu, Jul 17, 2025 at 1:41 AM Dagfinn Ilmari Mannsåker wrote: > > Hi hackers, > > These two patches are split out from my earlier thread about improving > tab completion for varous RESET forms > (https://postgr.es/m/87bjqwwtic@wibble.ilmari.org), so that the bug > fixes can be tracked as an

icu_validation_level INFO message level not displayed in pg_settings.enumvals

2025-07-22 Thread jian he
hi. src/backend/utils/misc/guc_tables.c: static const struct config_enum_entry icu_validation_level_options[] = { {"disabled", -1, false}, {"debug5", DEBUG5, false}, {"debug4", DEBUG4, false}, {"debug3", DEBUG3, false}, {"debug2", DEBUG2, false}, {"debug1", DEBUG1, false},

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-07-22 Thread jian he
On Tue, Jul 22, 2025 at 2:45 PM Vik Fearing wrote: > > It was accepted into the standard after 2023 was released. I am the > author of this change in the standard, so feel free to ask me anything > you're unsure about. > is the generally syntax as mentioned in this thread: CAST(source_expression

Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

2025-07-21 Thread jian he
ml [4] https://peter.eisentraut.org/blog/2023/04/04/sql-2023-is-finished-here-is-whats-new From 47c181eee593468c3d7b7cb57aec3a1ea8cb3c1d Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 18 Jul 2025 13:00:19 +0800 Subject: [PATCH v1 1/2] make ArrayCoerceExpr error safe similar to https://git.postgr

Re: sql/json query function JsonBehavior default expression's collation may differ from returning type's collation

2025-07-21 Thread jian he
On Mon, Jul 14, 2025 at 7:39 PM jian he wrote: > > overall, raising an error if the collation of the > JsonBehavior DEFAULT clause differs from that of the RETURNING clause > is the best option. > > what do you think? in exprSetCollation, the node can be T_CollateExpr. In that

Re: add function argument name to substring and substr

2025-07-20 Thread jian he
function argument name to function substr v6-0002: add function argument name to function substring v6-0002 incorporated some of the changes in v5-0002-v3-delta.patch. some of the changes in v5-0002-v3-delta.patch are not related to this thread, so I didn't incorporate them, right now. F

Re: array_random

2025-07-20 Thread jian he
On Fri, Jul 11, 2025 at 3:49 PM Dean Rasheed wrote: > > On Tue, 8 Jul 2025 at 15:26, Aleksander Alekseev > wrote: > > > > The proposed function seems to do two things at a time - generating > > random values and transforming them into an array of desired > > dimensions. Generally we try to avoid

get_rule_expr RelabelType node does not print COLLATE clause

2025-07-19 Thread jian he
hi. I found in some cases, we need to print COLLATE clauses for RelabelType Node. CREATE TABLE ttsa (c1 text[]); CREATE COLLATION case_sensitive (provider = icu, locale = ''); explain (verbose, cost off) SELECT count(*) FROM ttsa WHERE c1 = (array[1,2]::int[]::text[]) collate case_sensitive;

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

2025-07-18 Thread jian he
On Fri, Jul 18, 2025 at 5:11 AM Álvaro Herrera wrote: > > Anyway, here's a patch. > one minor issue in getDomainConstraints: for (int i = 0, j = 0; i < ntups; i++) { charcontype = (PQgetvalue(res, i, i_contype))[0]; constraint->contype = *(PQgetvalue(res, i,

duplicate line in ExecEvalJsonCoercionFinish

2025-07-16 Thread jian he
hi. ExecEvalJsonCoercionFinish duplicate line: jsestate->escontext.error_occurred = false; jsestate->escontext.error_occurred = false; https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/executor/execExprInterp.c#n5230

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-07-16 Thread jian he
bug: begin; drop table if exists pks cascade; create table pks(i int primary key, b int) partition by range (i); create table pks_34 partition of pks for values from (3) to (6); create table pks_d partition of pks default; insert into pks values (0), (1), (3), (4), (5); commit; alter table pks_d a

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

2025-07-15 Thread jian he
On Tue, Jul 15, 2025 at 2:10 PM jian he wrote: > > accidently found another existing bug. > > create schema test; > CREATE DOMAIN test.d1 AS integer NOT NULL default 11; > alter domain test.d1 add constraint a2 check(value > 1) not valid; > comment on CONSTRAINT a2 ON

  1   2   3   4   5   6   7   8   9   10   >