Re: PATCH: Add REINDEX tag to event triggers

2023-10-27 Thread jian he
On Fri, Oct 27, 2023 at 3:15 PM Michael Paquier wrote: > > On Mon, Sep 04, 2023 at 08:00:52PM +0200, Jim Jones wrote: > > LGTM. It applies and builds cleanly, all tests pass and documentation also > > builds ok. The CFbot seems also much happier now :) > > + /* > +* Open and lock the

Re: SQL:2011 application time

2023-10-28 Thread jian he
V16 patch doc/src/sgml/html/sql-createtable.html doc SET NULL description: ` SET NULL [ ( column_name [, ... ] ) ] Set all of the referencing columns, or a specified subset of the referencing columns, to null. A subset of columns can only be specified for ON DELETE actions. In a temporal foreign k

Re: Supporting MERGE on updatable views

2023-10-28 Thread jian he
hi. Excellent work! regress test passed! The code looks so intuitive! doc/src/sgml/ref/create_view.sgml. Do we need to add

Re: Issues with Information_schema.views

2023-10-28 Thread jian he
On Sat, Oct 28, 2023 at 5:27 PM Erki Eessaar wrote: > > Hello > > > /*After that: is_updatable=YES*/ > > 1. Indeed, now I can execute INSERT/UPDATE/DELETE against the view without > getting an error. However, I still cannot change the data in the database > through the views. https://www.postgr

Re: Issues with Information_schema.views

2023-10-29 Thread jian he
On Sun, Oct 29, 2023 at 4:05 PM Erki Eessaar wrote: > > Hello > > Thank you! I know that. > > > Secondly, the rule you demonstrated does not alone change IS_UPDATABLE value > to YES. I have to create two rules: > > CREATE OR REPLACE RULE emps_update AS ON UPDATE > TO Emps > DO INSTEAD UP

Re: Cleaning up array_in()

2023-10-29 Thread jian he
rebase after commit (https://git.postgresql.org/cgit/postgresql.git/commit/?id=611806cd726fc92989ac918eac48fd8d684869c7) From d37081ba00743585dae35c70e293ce2385201c9c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sat, 8 Jul 2023 22:19:48 +0300 Subject: [PATCH v9 5/7] Determine array dime

Re: SQL:2011 application time

2023-10-29 Thread jian he
hi. * The attached patch makes foreign keys with PERIOD fail if any of the foreign key columns is "generated columns". * The following queries will cause segmentation fault. not sure the best way to fix it. the reason in LINE: numpks = transformColumnNameList(RelationGetRelid(pkrel), fkconstraint

small erreport bug over partitioned table pgrowlocks module

2023-10-30 Thread jian he
hi. erreport bug over partitioned table in pgrowlocks. BEGIN; CREATE TABLE fk_parted_pk (a int PRIMARY KEY) PARTITION BY LIST (a); SELECT * FROM pgrowlocks('fk_parted_pk'); ERROR: only heap AM is supported error should be the following part: if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)

Re: Infinite Interval

2023-10-30 Thread jian he
On Mon, Oct 30, 2023 at 6:01 PM Ashutosh Bapat wrote: > > > Here's my version of commit message > > ``` > Support Infinite interval values > > Interval datatype uses the same input and output representation for > infinite intervals as other datatypes representing time that support > infinity. An i

Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value

2023-11-05 Thread jian he
minor doc issues. Returns the chunk id of the TOASTed value, or NULL if the value is not TOASTed. Should it be "chunk_id"? you may place it after pg_create_logical_replication_slot entry to make it look like alphabetical order. There is no test. maybe we can add following to src/test/regress/sql/

minor doc issues.

2023-11-05 Thread jian he
hi https://www.postgresql.org/docs/current/datatype-json.html Table 8.23. JSON Primitive Types and Corresponding PostgreSQL Types "SQL NULL is a different concept" can we change to "Only accept lowercase null. SQL NULL is a different concept" I saw people ask similar questions on stackoverflow. m

Re: SQL:2011 application time

2023-11-06 Thread jian he
hi. based on v17. I found several doc related issues. previously I didn't look closely + + In a temporal foreign key, the delete/update will use + FOR PORTION OF semantics to constrain the + effect to the bounds being deleted/updated in the referenced row. +

Re: Infinite Interval

2023-11-07 Thread jian he
On Wed, Nov 8, 2023 at 7:42 AM Dean Rasheed wrote: > > On Tue, 7 Nov 2023 at 14:33, Dean Rasheed wrote: > > > > New version attached doing that, to run it past the cfbot again. > > > > Ah, Windows Server didn't like that. Trying again with "INT64CONST(0)" > instead of just "0" in interval_um(). >

Re: Add the ability to limit the amount of memory that can be allocated to backends.

2023-11-10 Thread jian he
hi. +static void checkAllocations(); should be "static void checkAllocations(void);" ? PgStatShared_Memtrack there is a lock, but seems not initialized, and not used. Can you expand on it? So in view pg_stat_global_memory_tracking, column "total_memory_reserved" is a point of time, total memory

Re: EXCLUDE COLLATE in CREATE/ALTER TABLE document

2023-11-10 Thread jian he
On Wed, Nov 1, 2023 at 10:30 AM shihao zhong wrote: > > Thank you for your feedback on my previous patch. I have fixed the issue and > attached a new patch for your review. Could you please take a look for it if > you have a sec? Thanks > Your patch works fine. you can see it here: https://cirr

Re: maybe a type_sanity. sql bug

2023-11-10 Thread jian he
looking around. I found other three minor issues. attached. I am not sure the pg_class "relam" description part is correct. since partitioned indexes (relkind "I") also have the access method, but no storage. " If this is a table or an index, the access method used (heap, B-tree, hash, etc.); othe

Re: MERGE ... RETURNING

2023-11-12 Thread jian he
Hi. v13 works fine. all tests passed. The code is very intuitive. played with multi WHEN clauses, even with before/after row triggers, work as expected. I don't know when replace_outer_merging will be invoked. even set a breakpoint on it. coverage shows replace_outer_merging only called once. sql

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-11-15 Thread jian he
On Thu, Nov 9, 2023 at 4:12 AM Tom Lane wrote: > > Daniel Gustafsson writes: > >> On 8 Nov 2023, at 19:18, Tom Lane wrote: > >> I think an actually usable feature of this sort would involve > >> copying all the failed lines to some alternate output medium, > >> perhaps a second table with a TEXT

Re: [HACKERS] Allow INSTEAD OF DELETE triggers to modify the tuple for RETURNING

2023-11-15 Thread jian he
On Fri, Nov 3, 2023 at 12:34 AM Marko Tiikkaja wrote: > > I am now. Thanks! :-) Will try to keep an eye on the builds in the future. > > Attached v4 of the patch which should fix the issue. > doc seems to still have an issue. https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest%2

Re: MERGE ... RETURNING

2023-11-16 Thread jian he
> > Attached is a separate patch with those doc updates, intended to be > applied and back-patched independently of the main RETURNING patch. > > Regards, > Dean + You will require the SELECT privilege and any column(s) + of the data_source and + target_table_name referred to + in any cond

Re: SQL:2011 application time

2023-11-16 Thread jian he
based on v17. begin; drop table if exists s1; CREATE TABLE s1 (id numrange, misc int, misc1 text); create role test101 login; grant update, select on s1 to test101; insert into s1 VALUES ('[1,1000]',2); set session authorization test101; update s1 set id = '[1,1000]'; savepoint sp1; update s1 FO

Re: remaining sql/json patches

2023-11-16 Thread jian he
hi. minor issues. In transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func) func.behavior->on_empty->location and func.behavior->on_error->location are correct. but in ExecInitJsonExpr, jsestate->jsexpr->on_empty->location is -1, jsestate->jsexpr->on_error->location is -1. Maybe we can pres

Re: Add pg_basetype() function to obtain a DOMAIN base type

2023-11-17 Thread jian he
On Thu, Sep 28, 2023 at 11:56 AM Alexander Korotkov wrote: > > The one thing triggering my perfectionism is that the patch does two > syscache lookups instead of one. In order to fit into one syscache > lookup we could add "bool missing_ok" argument to > getBaseTypeAndTypmod(). However, getBaseT

Re: SQL:2011 application time

2023-11-19 Thread jian he
On Sun, Nov 19, 2023 at 1:24 PM Paul A Jungwirth wrote: > > Thank you for continuing to review this submission! My changes are in > the v18 patch I sent a few days ago. Details below. > > On Sun, Oct 29, 2023 at 5:01 PM jian he wrote: > > * The attached patch makes foreign

Re: remaining sql/json patches

2023-11-22 Thread jian he
minor issue. maybe you can add the following after /src/test/regress/sql/jsonb_sqljson.sql: 127. Test coverage for ExecPrepareJsonItemCoercion function. SELECT JSON_VALUE(jsonb 'null', '$ts' PASSING date '2018-02-21 12:34:56 +10' AS ts returning date); SELECT JSON_VALUE(jsonb 'null', '$ts' PASSING

Re: remaining sql/json patches

2023-11-23 Thread jian he
+/* + * Evaluate or return the step address to evaluate a coercion of a JSON item + * to the target type. The former if the coercion must be done right away by + * calling the target type's input function, and for some types, by calling + * json_populate_type(). + * + * Returns the step address to

Re: PATCH: Add REINDEX tag to event triggers

2023-11-23 Thread jian he
On Mon, Nov 20, 2023 at 3:34 PM Michael Paquier wrote: > > On Sat, Oct 28, 2023 at 12:15:22PM +0800, jian he wrote: > > reindex_event_trigger_collect_relation called in > > ReindexMultipleInternal, ReindexTable (line 2979). > > Both are "under concurrent is false&qu

Re: remaining sql/json patches

2023-11-24 Thread jian he
hi. + /* + * Set information for RETURNING type's input function used by + * ExecEvalJsonExprCoercion(). + */ "ExecEvalJsonExprCoercion" comment is wrong? + /* + * Step to jump to the EEOP_JSONEXPR_FINISH step skipping over item + * coercion steps that will be added below, if any. + */ "EEOP_JSON

Re: pg_stats and range statistics

2023-11-25 Thread jian he
On Sat, Nov 25, 2023 at 7:06 AM Alexander Korotkov wrote: > > Hi! > > I'm going to push this if there are no objections. > > -- > Regards, > Alexander Korotkov src/include/catalog/pg_statistic.h 268: * range type's subdiff function. Only non-null rows are considered. should it be: * range

Re: pg_stats and range statistics

2023-11-25 Thread jian he
On Sat, Nov 25, 2023 at 7:06 AM Alexander Korotkov wrote: > > Hi! > Additionally, I found that the current patch can't handle infinite > range bounds and discards information about inclusiveness of range > bounds. The infinite bounds could be represented as NULL (while I'm > not sure how good thi

Re: PATCH: Add REINDEX tag to event triggers

2023-11-26 Thread jian he
On Fri, Nov 24, 2023 at 10:44 AM Michael Paquier wrote: > > As far as I can see, this patch is doing too much as presented. Could > you split the patch into more pieces, please? Based on v4 you have > sent, there are refactoring and basic piece parts like: > - Patch to make event triggers ddl_co

Re: Improve rowcount estimate for UNNEST(column)

2023-11-26 Thread jian he
Hi. Since both array_op_test, arrest both are not dropped at the end of src/test/regress/sql/arrays.sql. I found using table array_op_test test more convincing. select reltuples * 10 as original, reltuples * (select floor(elem_count_histogram[array_length(elem_count_histogram,1)])

Re: PATCH: Add REINDEX tag to event triggers

2023-11-27 Thread jian he
On Mon, Nov 27, 2023 at 6:58 PM Ajin Cherian wrote: > > I just started reviewing the patch. Some minor comments: > In patch 0001: > In standard_ProcessUtility(), since you are unconditionally calling > ProcessUtilitySlow() in case of T_ReindexStmt, you really don't need > the case statement for T_

Re: remaining sql/json patches

2023-11-27 Thread jian he
On Thu, Nov 23, 2023 at 6:46 PM jian he wrote: > > -however these four will not fail. > SELECT JSON_QUERY(jsonb '{"a":[3,4]}', '$.z' RETURNING int4range empty > object on error); > SELECT JSON_QUERY(jsonb '{"a":[3,4]}', '

Re: [PATCH] ltree hash functions

2023-11-28 Thread jian he
On Wed, Nov 29, 2023 at 6:09 AM Tommy Pavlicek wrote: > > On Thu, Jul 6, 2023 at 2:18 AM Daniel Gustafsson wrote: > > > > > On 19 Jun 2023, at 11:18, Tommy Pavlicek wrote: > > > > > Tommy, are you interested in extending ALTER OPERATOR to allow this, > > > which would also allow fixing the ltree

Re: Improve rowcount estimate for UNNEST(column)

2023-11-29 Thread jian he
On Mon, Nov 27, 2023 at 3:05 PM jian he wrote: > > Hi. > Since both array_op_test, arrest both are not dropped at the end of > src/test/regress/sql/arrays.sql. > I found using table array_op_test test more convincing. > > select > reltuples * 10 as original, >

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-03 Thread jian he
hi. here is my implementation based on previous discussions add a new COPY FROM flag save_error. save_error only works with non-BINARY flags. save_error is easier for me to implement, if using "save error" I worry, 2 words, gram.y will not work. save_error also works other flag like {csv mode, for

Re: [PATCH] ltree hash functions

2023-12-03 Thread jian he
On Fri, Dec 1, 2023 at 8:44 AM Tommy Pavlicek wrote: > > > Patch updated for those comments (and a touch of cleanup in the tests) > attached. it would be a better name as hash_ltree than ltree_hash, similar logic applies to ltree_hash_extended. that would be the convention. see: https://stackove

Re: PATCH: Add REINDEX tag to event triggers

2023-12-04 Thread jian he
On Mon, Dec 4, 2023 at 11:00 PM Alexander Lakhin wrote: > > Hi Michael, > > 04.12.2023 04:04, Michael Paquier wrote: > > Anyway, I've been working on the patch for the last few days, and > > applied it after tweaking a bit its style, code and comments. > > Please look at the assertion failure trig

ExecSetupTransitionCaptureState not declared in nodeModifyTable.c

2023-12-05 Thread jian he
hi. static void ExecSetupTransitionCaptureState(ModifyTableState *mtstate, EState *estate); not declared in src/backend/executor/nodeModifyTable.c. do we need to add the declaration?

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-06 Thread jian he
On Tue, Dec 5, 2023 at 6:07 PM Alena Rybakina wrote: > > Hi! > > Thank you for your contribution to this thread. > > > I reviewed it and have a few questions. > > 1. I have seen that you delete a table before creating it, to which you want > to add errors due to a failed "copy from" operation. I

Re: SQL:2011 application time

2023-12-06 Thread jian he
On Sun, Dec 3, 2023 at 2:11 AM Paul Jungwirth wrote: > > v19 patch series attached, rebased to a11c9c42ea. > this TODO: * TODO: It sounds like FOR PORTION OF might need to do something here too? based on comments on ExprContext. I refactor a bit, and solved this TODO. tring to the following TOD

Re: remaining sql/json patches

2023-12-06 Thread jian he
On Wed, Dec 6, 2023 at 10:02 PM Amit Langote wrote: > > Finally, I also fixed a couple of silly mistakes in 0003 around > transformJsonBehavior() and some further assorted tightening in the ON > ERROR / EMPTY expression coercion handling code. > typo: + * If a soft-error occurs, it will be check

Re: remaining sql/json patches

2023-12-07 Thread jian he
two JsonCoercionState in src/tools/pgindent/typedefs.list. +JsonCoercionState JsonConstructorExpr JsonConstructorExprState JsonConstructorType JsonEncoding +JsonExpr +JsonExprOp +JsonExprPostEvalState +JsonExprState +JsonCoercionState + post_eval->jump_eval_coercion = jsestate->jump_eval_resu

Re: remaining sql/json patches

2023-12-08 Thread jian he
Hi. function JsonPathExecResult comment needs to be refactored? since it changed a lot.

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-10 Thread jian he
ated-headers] Error 2 > > I have ubuntu 22.04 operation system. > > On 06.12.2023 13:47, jian he wrote: > > On Tue, Dec 5, 2023 at 6:07 PM Alena Rybakina > wrote: > > Hi! > > Thank you for your contribution to this thread. > > > I reviewed it and have a few que

Re: SQL:2011 application time

2023-12-11 Thread jian he
hi. some small issues diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index e3ccf6c7f7..6781e55020 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -1560,7 +1560,7 @@ ProcessUtilitySlow(ParseState *pstate, true, /* check_rights */ true, /* ch

Re: Report planning memory in EXPLAIN ANALYZE

2023-12-11 Thread jian he
On Mon, Dec 4, 2023 at 3:24 PM Ashutosh Bapat wrote: > > On Fri, Dec 1, 2023 at 8:27 AM Andrei Lepikhov > wrote: > > > > On 30/11/2023 18:40, Alvaro Herrera wrote: > > > Well, SUMMARY is enabled by default with ANALYZE, and I'd rather not > > > have planner memory consumption displayed by default

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-12 Thread jian he
On Mon, Dec 11, 2023 at 10:05 PM Alena Rybakina wrote: > > Hi! Thank you for your work. Your patch looks better! > Yes, thank you! It works fine, and I see that the regression tests have been > passed. 🙂 > However, when I ran 'copy from with save_error' operation with simple csv > files (copy_te

Re: Improve upcasting for INT range and multi range types

2023-12-12 Thread jian he
On Fri, Dec 8, 2023 at 4:21 AM Federico wrote: > > Hi, > > Postgresql seems to be missing upcasting when doing INT range and > multi-range operation, for example when checking if an int4 is inside > an int8 range. > Some non working example are the following > > SELECT 2::INT4 <@ '[1, 4)'::INT

Re: remaining sql/json patches

2023-12-13 Thread jian he
Hi. small issues I found... typo: +-- Test mutabilily od query functions + default: + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("only datetime, bool, numeric, and text types can be casted to jsonpath types"))); transformJsonPassingArgs's function: transformJsonValueExp

Re: remaining sql/json patches

2023-12-15 Thread jian he
hi. since InitJsonItemCoercions cannot return NULL. per transformJsonFuncExpr, jsexpr->item_coercions not null imply jsexpr->result_coercion not null. so I did the attached refactoring. now every ExecInitJsonExprCoercion function call followed with: scratch->opcode = EEOP_JUMP; scratch->d.jump.ju

Re: Adding OLD/NEW support to RETURNING

2023-12-16 Thread jian he
On Mon, Dec 4, 2023 at 8:15 PM Dean Rasheed wrote: > > I have been playing around with the idea of adding support for OLD/NEW > to RETURNING, partly motivated by the discussion on the MERGE > RETURNING thread [1], but also because I think it would be a very > useful addition for other commands (UP

Re: [PATCH] Add support function for containment operators

2023-12-16 Thread jian he
fix a typo and also did a minor change. from + if (lowerExpr != NULL && upperExpr != NULL) + return (Node *) makeBoolExpr(AND_EXPR, list_make2(lowerExpr, upperExpr), -1); + else if (lowerExpr != NULL) + return (Node *) lowerExpr; + else if (upperExpr != NULL) + return (Node *) upperExpr; to + if

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-17 Thread jian he
On Fri, Dec 15, 2023 at 4:49 AM Masahiko Sawada wrote: > > Hi, > > I've read this thread and the latest patch. IIUC with SAVE_ERROR > option, COPY FROM creates an error table for the target table and > writes error information there. > > While I agree that the final shape of this feature would be

Re: [PATCH]: Not to invaldiate CatalogSnapshot for local invalidation messages

2023-12-17 Thread jian he
Hi ---setup. drop table s2; create table s2(a int); After apply the patch alter table s2 add primary key (a); watch CatalogSnapshot #0 GetNonHistoricCatalogSnapshot (relid=1259) at ../../Desktop/pg_src/src7/postgresql/src/backend/utils/time/snapmgr.c:412 #1 0x55ba78f0d6ba in GetCat

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-17 Thread jian he
On Mon, Dec 18, 2023 at 1:09 PM torikoshia wrote: > > Hi, > > > save the error metadata to system catalogs would be more expensive, > > please see below explanation. > > I have no knowledge of publications. > > but i feel there is a feature request: publication FOR ALL TABLES > > exclude regex_pa

Re: remaining sql/json patches

2023-12-18 Thread jian he
Hi! another minor issue I found: +SELECT pg_get_expr(adbin, adrelid) +FROM pg_attrdef +WHERE adrelid = 'test_jsonb_constraints'::regclass +ORDER BY 1; + +SELECT pg_get_expr(adbin, adrelid) FROM pg_attrdef WHERE adrelid = 'test_jsonb_constraints'::regclass; I think these two queries are the same?

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-19 Thread jian he
On Tue, Dec 19, 2023 at 9:14 AM Masahiko Sawada wrote: > > > The error table hub idea is still unclear to me. I assume that there > are error tables at least on each database. And an error table can > have error data that happened during COPY FROM, including malformed > lines. Do the error tables

Re: remaining sql/json patches

2023-12-22 Thread jian he
Hi v33-0007-SQL-JSON-query-functions.patch, commit message: This introduces the SQL/JSON functions for querying JSON data using jsonpath expressions. The functions are: should it be "These functions are" + +Returns true if the SQL/JSON path_expression +applied to the contex

Re: remaining sql/json patches

2023-12-24 Thread jian he
Hi. +/* + * JsonTableFetchRow + * Prepare the next "current" tuple for upcoming GetValue calls. + * Returns FALSE if the row-filter expression returned no more rows. + */ +static bool +JsonTableFetchRow(TableFuncScanState *state) +{ + JsonTableExecContext *cxt = + GetJsonTableExecContext(state, "J

change regexp_substr first argument make tests more easier to understand.

2023-12-27 Thread jian he
hi. https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/strings.out#n928 SELECT regexp_substr('abcabcabc', 'a.c'); SELECT regexp_substr('abcabcabc', 'a.c', 2); SELECT regexp_substr('abcabcabc', 'a.c', 1, 3); SELECT regexp_substr('abcabcabc', 'a.c', 1, 4) IS NULL AS t; SEL

add function argument names to regex* functions.

2023-12-27 Thread jian he
Hi. similar to [1], add function argument names to the following functions: regexp_like, regexp_match,regexp_matches,regexp_replace, regexp_substr,regexp_split_to_array,regexp_split_to_table,regexp_count so I call these function in a different notation[2], like: SELECT regexp_like(string=>'a'||CH

Re: add function argument names to regex* functions.

2023-12-27 Thread jian he
On Thu, Dec 28, 2023 at 6:25 AM Peter Eisentraut wrote: > > On 27.12.23 17:53, jian he wrote: > > similar to [1], add function argument names to the following functions: > > regexp_like, regexp_match,regexp_matches,regexp_replace, > > regexp_substr,regexp_split_to_arr

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-12-27 Thread jian he
On Wed, Dec 20, 2023 at 8:27 PM Masahiko Sawada wrote: > > > Why do we need to use SPI? I think we can form heap tuples and insert > them to the error table. Creating the error table also doesn't need to > use SPI. > Thanks for pointing it out. I figured out how to form heap tuples and insert them

Re: change regexp_substr first argument make tests more easier to understand.

2023-12-27 Thread jian he
On Thu, Dec 28, 2023 at 12:13 AM jian he wrote: > > hi. > https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/strings.out#n928 > > SELECT regexp_substr('abcabcabc', 'a.c'); > SELECT regexp_substr('abcabcabc', 'a.c&

Re: Functions to return random numbers in a given range

2023-12-27 Thread jian he
On Fri, Dec 22, 2023 at 1:07 AM Dean Rasheed wrote: > > Attached is a patch that adds 3 SQL-callable functions to return > random integer/numeric values chosen uniformly from a given range: > > random(min int, max int) returns int > random(min bigint, max bigint) returns bigint > random(min

autoprewarm main function not tested background worker not listed in pg_stat_activity

2023-12-28 Thread jian he
Hi. https://coverage.postgresql.org/contrib/pg_prewarm/autoprewarm.c.gcov.html function autoprewarm_start_worker never gets tested, but autoprewarm_start_worker listed in our doc (https://www.postgresql.org/docs/16/pgprewarm.html) Maybe we should test it. also this part in function autoprewarm_mai

Re: Remove useless GROUP BY columns considering unique index

2023-12-31 Thread jian he
On Fri, Dec 29, 2023 at 11:05 PM Zhang Mingli wrote: > > Hi, > > This idea first came from remove_useless_groupby_columns does not need to > record constraint dependencie[0] which points out that > unique index whose columns all have NOT NULL constraints could also take the > work with primary

Re: Change GUC hashtable to use simplehash?

2024-01-01 Thread jian he
On Tue, Dec 26, 2023 at 4:01 PM John Naylor wrote: > > 0001-0003 are same as earlier > 0004 takes Jeff's idea and adds in an optimization from NetBSD's > strlen (I said OpenBSD earlier, but it goes back further). I added > stub code to simulate big-endian when requested at compile time, but a > la

Re: Add pg_basetype() function to obtain a DOMAIN base type

2024-01-01 Thread jian he
On Mon, Dec 4, 2023 at 5:11 PM John Naylor wrote: > > On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov > wrote: > > The one thing triggering my perfectionism is that the patch does two > > syscache lookups instead of one. > > For an admin function used interactively, I'm not sure why that > ma

Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value

2024-01-01 Thread jian he
On Mon, Nov 6, 2023 at 8:00 AM jian he wrote: > > minor doc issues. > Returns the chunk id of the TOASTed value, or NULL if the value is not > TOASTed. > Should it be "chunk_id"? > > you may place it after pg_create_logical_replication_slot entry to > ma

Re: Extract numeric filed in JSONB more effectively

2024-01-02 Thread jian he
hi. you don't need to change src/include/catalog/catversion.h as mentioned in https://wiki.postgresql.org/wiki/Committing_checklist Otherwise, cfbot will fail many times. +typedef enum JsonbValueTarget +{ + JsonbValue_AsJsonbValue, + JsonbValue_AsJsonb, + JsonbValue_AsText +} JsonbValueTarget; ch

Re: remaining sql/json patches

2024-01-03 Thread jian he
On Fri, Dec 22, 2023 at 9:01 PM jian he wrote: > > Hi > > + /* FALLTHROUGH */ > + case JTC_EXISTS: > + case JTC_FORMATTED: > + { > + Node *je; > + CaseTestExpr *param = makeNode(CaseTestExpr); > + > + param->collation = InvalidOid; > + param->typeId =

Re: remaining sql/json patches

2024-01-03 Thread jian he
some more minor issues: SELECT * FROM JSON_TABLE(jsonb '{"a":[123,2]}', '$' COLUMNS (item int[] PATH '$.a' error on error, foo text path '$' error on error)) bar; ERROR: JSON path expression in JSON_VALUE should return singleton scalar item the error message seems not so great, imho. since th

Re: Change GUC hashtable to use simplehash?

2024-01-03 Thread jian he
On Wed, Jan 3, 2024 at 10:12 PM John Naylor wrote: > > On Tue, Jan 2, 2024 at 6:56 AM jian he wrote: > > > > My local computer is slow. but here is the test results: > > > > select * from bench_cstring_hash_aligned(10);7318.893 ms > > select * from

Re: add function argument names to regex* functions.

2024-01-03 Thread jian he
e. to change from `N` to `occurrence`, we also need to change the doc, that is why this patch is more larger. [0]: https://www.google.com/search?q=regex+nth+match&oq=regex+nth+match&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg8MgYIAhBFGDzSAQc2MThqMGo5qAIAsAIA&sourceid=chrome&ie=UTF-8 From cb720fd696df3a34032ec

Re: SQL:2011 application time

2024-01-04 Thread jian he
On Tue, Jan 2, 2024 at 9:59 AM Paul Jungwirth wrote: > > On 12/31/23 00:51, Paul Jungwirth wrote: > > That's it for now. > > Here is another update. I fixed FOR PORTION OF on partitioned tables, in > particular when the attnums > are different from the root partition. > > Rebased to cea89c93a1. >

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2024-01-05 Thread jian he
On Fri, Jan 5, 2024 at 12:05 AM vignesh C wrote: > > On Thu, 28 Dec 2023 at 09:27, jian he wrote: > > > > On Wed, Dec 20, 2023 at 8:27 PM Masahiko Sawada > > wrote: > > > > > > > > > Why do we need to use SPI? I think we can form heap tuples

Re: Change GUC hashtable to use simplehash?

2024-01-05 Thread jian he
On Fri, Jan 5, 2024 at 6:54 PM John Naylor wrote: > > On Thu, Jan 4, 2024 at 10:01 AM jian he wrote: > > > > I still cannot git apply your patch cleanly. in > > I don't know why you're using that -- the git apply man page even says > > "Use git-am(1

Re: remaining sql/json patches

2024-01-05 Thread jian he
some tests after applying V33 and my small changes. setup: create table test_scalar1(js jsonb); insert into test_scalar1 select jsonb '{"a":"[12,13]"}' FROM generate_series(1,1e5) g; create table test_scalar2(js jsonb); insert into test_scalar2 select jsonb '{"a":12}' FROM generate_series(1,1e5) g;

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2024-01-05 Thread jian he
On Fri, Jan 5, 2024 at 4:37 PM jian he wrote: > > > > > be reused for a different user. > > > > > > > > > > You are right. > > > so I changed, now the schema owner will be the error table owner. > > > every error table tuple inserts,

Re: Change GUC hashtable to use simplehash?

2024-01-05 Thread jian he
On Sat, Jan 6, 2024 at 9:04 AM John Naylor wrote: > > On Fri, Jan 5, 2024 at 6:58 PM jian he wrote: > > -Dcassert=true \ > > > -Dbuildtype=debug \ > > These probably don't matter much for this test, but these should be &

Re: remaining sql/json patches

2024-01-07 Thread jian he
On Sat, Jan 6, 2024 at 8:44 AM jian he wrote: > > some tests after applying V33 and my small changes. > setup: > create table test_scalar1(js jsonb); > insert into test_scalar1 select jsonb '{"a":"[12,13]"}' FROM > generate_series(1,1e5) g; >

Re: Extract numeric filed in JSONB more effectively

2024-01-07 Thread jian he
-0001-Improve-performance-of-Jsonb-extract-via-key-and-c.no-cfbot this one also based on your patch. but as a minimum patch to optimize (jsonb(object) -> 'key')::numerica_data_type case only. (this one will not run CI test). From 5ac139d3eb213beaa53e6cd39c25b2ecb334ba56 Mon Sep 17 0

alter table add x wrong error position

2024-01-07 Thread jian he
hi. Maybe this is a small printout err_position bug. create table atacc2 ( test int, a int, b int) ; success tests: alter table atacc2 add CONSTRAINT x PRIMARY KEY (id, b ); alter table atacc2 add CONSTRAINT x PRIMARY KEY (id, b a); alter table atacc2 add CONSTRAINT x PRIMARY KEYa (id, b); tests

Re: add function argument names to regex* functions.

2024-01-08 Thread jian he
On Mon, Jan 8, 2024 at 8:44 AM Dian Fay wrote: > > On Thu Jan 4, 2024 at 2:03 AM EST, jian he wrote: > > On Thu, Jan 4, 2024 at 7:26 AM Jim Nasby wrote: > > > > > > On 1/3/24 5:05 PM, Dian Fay wrote: > > > > > > Another possibility is `index`, wh

Re: SQL:2011 application time

2024-01-08 Thread jian he
On Fri, Jan 5, 2024 at 1:06 PM jian he wrote: > > On Tue, Jan 2, 2024 at 9:59 AM Paul Jungwirth > wrote: > > > > On 12/31/23 00:51, Paul Jungwirth wrote: > > > That's it for now. > > > > Here is another update. I fixed FOR PORTION OF on partitio

Re: SQL:2011 application time

2024-01-08 Thread jian he
On Tue, Jan 9, 2024 at 2:54 AM Paul Jungwirth wrote: > > On 1/8/24 06:54, jian he wrote: > > On Fri, Jan 5, 2024 at 1:06 PM jian he wrote: > > > > range_intersect returns the intersection of two ranges. > > I think here we are doing the opposite. &g

Re: [PATCH] Add sortsupport for range types and btree_gist

2024-01-09 Thread jian he
On Thu, Dec 1, 2022 at 1:27 AM Bernd Helmle wrote: > > Hi, > > No deep code review yet, but CF is approaching its end and i didn't > have time to look at this earlier :/ > > Below are some things i've tested so far. > > Am Mittwoch, dem 15.06.2022 um 12:45 +0200 schrieb Christoph Heiss: > > > > Te

Re: Support prepared statement invalidation when result types change

2023-08-29 Thread jian he
On Tue, Aug 29, 2023 at 12:51 AM Jelte Fennema wrote: > > Could you share the full set of commands that cause the reporting > issue? I don't think my changes should impact this reporting, so I'm > curious if this is a new issue, or an already existing one. I didn't apply your v2 patch. full set o

Re: Incremental View Maintenance, take 2

2023-09-01 Thread jian he
hi based on v29. based on https://stackoverflow.com/a/4014981/1560347: I added a new function append_update_set_caluse, and deleted functions: {append_set_clause_for_count, append_set_clause_for_sum, append_set_clause_for_avg, append_set_clause_for_minmax} I guess this way is more extensible/gene

Re: PATCH: Add REINDEX tag to event triggers

2023-09-01 Thread jian he
On Wed, Aug 30, 2023 at 8:38 PM Jim Jones wrote: > > Greetings > > > > I was unable to apply it in 7ef5f5f > > $ git apply -v v2-0001-Add-REINDEX-tag-to-event-triggers.patch > Checking patch doc/src/sgml/event-trigger.sgml... > Checking patch src/backend/commands/indexcmds.c... > error: while sear

Re: PATCH: Add REINDEX tag to event triggers

2023-09-01 Thread jian he
On Fri, Sep 1, 2023 at 6:40 PM Jim Jones wrote: > > On 01.09.23 11:23, jian he wrote: > > because the change made in here: > > https://git.postgresql.org/cgit/postgresql.git/diff/src/backend/commands/indexcmds.c?id=11af63fb48d278b86aa948a5b57f136ef03c2bb7 > > > >

Re: Extract numeric filed in JSONB more effectively

2023-09-01 Thread jian he
I think the last patch failed. I am not 100% sure. https://cirrus-ci.com/task/5464366154252288 says "Created 21 hours ago", I assume the latest patch. the diff in Artifacts section. you can go to testrun/build/testrun/regress/regress/regression.diffs diff -U3 /tmp/cirrus-ci-build/src/test/regress

add (void) cast inside advance_aggregates for function ExecEvalExprSwitchContext

2023-09-02 Thread jian he
Hi. In src/backend/executor/nodeAgg.c 817: advance_aggregates(AggState *aggstate) Do we need to add "(void)" before ExecEvalExprSwitchContext?

Re: Cleaning up array_in()

2023-09-03 Thread jian he
hi. attached v4. v4, 0001 to 0005 is the same as v3 in https://www.postgresql.org/message-id/5859ce4e-2be4-92b0-c85c-e1e24eab57c6%40iki.fi v4-0006 doing some modifications to address the corner case mentioned in the previous thread (like select '{{1,},{1},}'::text[]). also fixed all these FIXME, H

Re: Incremental View Maintenance, take 2

2023-09-04 Thread jian he
On Sat, Sep 2, 2023 at 7:46 PM Tatsuo Ishii wrote: > > > attached is my refactor. there is some whitespace errors in the > > patches, you need use > > git apply --reject --whitespace=fix > > basedon_v29_matview_c_refactor_update_set_clause.patch > > > > Also you patch cannot use git apply, i final

Re: Cleaning up array_in()

2023-09-04 Thread jian he
On Mon, Sep 4, 2023 at 8:00 AM jian he wrote: > > hi. > attached v4. > v4, 0001 to 0005 is the same as v3 in > https://www.postgresql.org/message-id/5859ce4e-2be4-92b0-c85c-e1e24eab57c6%40iki.fi > > v4-0006 doing some modifications to address the corner case mentioned >

Re: Extract numeric filed in JSONB more effectively

2023-09-05 Thread jian he
On Mon, Sep 4, 2023 at 10:35 PM Andy Fan wrote: > > Hi, > > v13 attached. Changes includes: > > 1. fix the bug Jian provides. > 2. reduce more code duplication without DirectFunctionCall. > 3. add the overlooked jsonb_path_query and jsonb_path_query_first as > candidates > > > -- > Best Re

<    1   2   3   4   5   6   7   8   9   10   >