Re: Do we want a hashset type?

2023-06-27 Thread jian he
On Tue, Jun 27, 2023 at 4:27 PM Joel Jacobson wrote: > > On Tue, Jun 27, 2023, at 04:35, jian he wrote: > > in SQLMultiSets.pdf(previously thread) I found a related explanation > > on page 45, 46. > > /home/jian/hashset/0001-make-int4hashset_contains-strict-and-header-fil

Re: Incremental View Maintenance, take 2

2023-06-28 Thread jian he
On Wed, Jun 28, 2023 at 4:06 PM Yugo NAGATA wrote: > > On Wed, 28 Jun 2023 00:01:02 +0800 > jian he wrote: > > > On Thu, Jun 1, 2023 at 2:47 AM Yugo NAGATA wrote: > > > > > > On Thu, 1 Jun 2023 23:59:09 +0900 > > > Yugo NAGATA wrote: > >

Re: [PGdocs] fix description for handling pf non-ASCII characters

2023-06-28 Thread jian he
On Fri, Jun 23, 2023 at 10:25 PM Hayato Kuroda (Fujitsu) wrote: > > Dear hackers, > > While discussing based on the article[1] with Japanese developers, > I found inconsistencies between codes and documents. > > 45b1a67a[2] changed the behavior when non-ASCII characters was set as > application_n

Re: Do we want a hashset type?

2023-06-28 Thread jian he
On Wed, Jun 28, 2023 at 4:50 PM Joel Jacobson wrote: > > On Wed, Jun 28, 2023, at 08:26, jian he wrote: > > > Hi there. > > I changed the function hashset_contains to strict. > > Changing hashset_contains to STRICT would cause it to return NULL > if any of the op

Re: Incremental View Maintenance, take 2

2023-06-29 Thread jian he
On Thu, Jun 29, 2023 at 12:40 AM jian he wrote: > > On Wed, Jun 28, 2023 at 4:06 PM Yugo NAGATA wrote: > > > > On Wed, 28 Jun 2023 00:01:02 +0800 > > jian he wrote: > > > > > On Thu, Jun 1, 2023 at 2:47 AM Yugo NAGATA wrote: > > > > > >

Re: Incremental View Maintenance, take 2

2023-06-29 Thread jian he
I cannot build the doc. git clean -fdx git am ~/Desktop/tmp/*.patch Applying: Add a syntax to create Incrementally Maintainable Materialized Views Applying: Add relisivm column to pg_class system catalog Applying: Allow to prolong life span of transition tables until transaction end Applying: Add

Re: Incremental View Maintenance, take 2

2023-06-29 Thread jian he
On Thu, Jun 29, 2023 at 6:51 PM jian he wrote: > > I cannot build the doc. > git clean -fdx > git am ~/Desktop/tmp/*.patch > > Applying: Add a syntax to create Incrementally Maintainable Materialized Views > Applying: Add relisivm column to pg_class system catalog > Ap

Re: Incremental View Maintenance, take 2

2023-06-29 Thread jian he
Hi there. in v28-0005-Add-Incremental-View-Maintenance-support-to-psql.patch I don't know how to set psql to get the output "Incremental view maintenance: yes"

Re: Do we want a hashset type?

2023-06-29 Thread jian he
On Thu, Jun 29, 2023 at 4:43 PM Joel Jacobson wrote: > > On Thu, Jun 29, 2023, at 08:54, jian he wrote: > > Anyway, this time, I added another macro,which seems to simplify the code. > > > > #define SET_DATA_PTR(a) \ > > (((char *) (a->data)) + CEIL_DIV(a->cap

Re: Incremental View Maintenance, take 2

2023-07-01 Thread jian he
This is probably not trivial. In function apply_new_delta_with_count. appendStringInfo(&querybuf, "WITH updt AS (" /* update a tuple if this exists in the view */ "UPDATE %s AS mv SET %s = mv.%s OPERATOR(pg_catalog.+) diff.%s " "%s " /* SET clauses for aggregates */ "FROM %s AS diff " "WHERE %s

Re: Incremental View Maintenance, take 2

2023-07-01 Thread jian he
ok. Now I really found a small bug. this works as intended: BEGIN; CREATE INCREMENTAL MATERIALIZED VIEW test_ivm AS SELECT i, MIN(j) as min_j FROM mv_base_a group by 1; INSERT INTO mv_base_a select 1,-2 where false; rollback; however the following one: BEGIN; CREATE INCREMENTAL MATERIALIZED VIEW

/src/include/access/htup_details.h some comments kind of confusing....

2023-07-02 Thread jian he
Hi, there... drop table infomask_test; CREATE TABLE infomask_test(acc_no integer PRIMARY KEY,amount numeric,misc text); INSERT INTO infomask_test VALUES (1, 100.00,default), (2, 200.00,repeat('abc',700)); BEGIN; SELECT acc_no,ctid,xmin,xmax FROM infomask_test WHERE acc_no = 1 FOR KEY SHARE;

Re: Cleaning up array_in()

2023-07-02 Thread jian he
On Mon, Jun 5, 2023 at 9:48 AM Nikhil Benesch wrote: > > I took a look at 0002 because I attempted a similar but more surgical > fix in [0]. > > I spotted a few opportunities for further reducing state tracked by > `ArrayCount`. You may not find all of these suggestions to be > worthwhile. I pull

Re: Cleaning up array_in()

2023-07-03 Thread jian he
based on Nikhil Benesch idea. The attached diff is based on v1-0002-Rewrite-ArrayCount-to-make-dimensionality-checks.patch. diff compare v1-0002: select '{{1,{2}},{2,3}}'::text[]; ERROR: malformed array literal: "{{1,{2}},{2,3}}" LINE 1: select '{{1,{2}},{2,3}}'::text[]; ^ -DET

Re: [PGdocs] fix description for handling pf non-ASCII characters

2023-07-03 Thread jian he
On Thu, Jun 29, 2023 at 3:51 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Jian, > > Thank you for checking my patch! > > > > > in your patch: > > > printable ASCII characters will be replaced with a hex escape. > > > > My wording is not good. I think the result will be: ASCII characters > > will be

Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

2023-07-03 Thread jian he
On Mon, Jul 3, 2023 at 4:26 PM Palak Chaturvedi wrote: > > Hi Thomas, > Thank you for your suggestions. I have added the sql in the meson > build as well. > > On Sat, 1 Jul 2023 at 03:39, Thomas Munro wrote: > > > > On Fri, Jun 30, 2023 at 10:47 PM Palak Chaturvedi > > wrote: > > > pgbench=# sel

Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

2023-07-04 Thread jian he
the following will also crash. no idea why. begin; select count(*) from onek; select relpages from pg_class where relname = 'onek'; --queryA SELECT count(*) FROM pg_buffercache WHERE relfilenode = pg_relation_filenode('onek'::regclass); --queryB insert into onek values(default);

Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

2023-07-04 Thread jian he
On Tue, Jul 4, 2023 at 5:45 PM Japin Li wrote: > > On Tue, 04 Jul 2023 at 17:00, jian he wrote: > > the following will also crash. no idea why. > > begin; > > select count(*) from onek; > > select relpages from pg_class where relname = 'onek'; -

Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

2023-07-04 Thread jian he
On Sat, Jul 1, 2023 at 6:09 AM Thomas Munro wrote: > > > It should be restricted by role, but I wonder which role it should be. > Testing for superuser is now out of fashion. > as pg_buffercache/pg_buffercache--1.2--1.3.sql. You need pg_maintain privilege to use pg_buffercache. The following quer

contrib/pg_freespacemap first check input argument, then relation_open.

2023-07-05 Thread jian he
Hi. In: https://git.postgresql.org/cgit/postgresql.git/tree/contrib/pg_freespacemap/pg_freespacemap.c rel = relation_open(relid, AccessShareLock); if (blkno < 0 || blkno > MaxBlockNumber) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid block number"))); ---

Re: MERGE ... RETURNING

2023-07-06 Thread jian he
On Thu, Jul 6, 2023 at 1:13 PM Gurjeet Singh wrote: > > On Sat, Jul 1, 2023 at 4:08 AM Dean Rasheed wrote: > > > > On Mon, 13 Mar 2023 at 13:36, Dean Rasheed wrote: > > > > > > And another rebase. > > > > > > > I ran out of cycles to pursue the MERGE patches in v16, but hopefully > > I can make

Re: Add hint message for check_log_destination()

2023-07-06 Thread jian he
On Fri, Jul 7, 2023 at 1:06 PM Japin Li wrote: > > > Hi, hackers > > When I try to change log_destination using ALTER SYSTEM with the wrong value, > it complains of the "Unrecognized key word" without available values. This > patch tries to add a hint message that provides available values for >

Re: Adding OLD/NEW support to RETURNING

2024-08-21 Thread jian he
On Fri, Aug 16, 2024 at 6:39 PM Dean Rasheed wrote: > in Var comments: * varlevelsup is greater than zero in Vars that represent outer references. * Note that it affects the meaning of all of varno, varnullingrels, and * varnosyn, all of which refer to the range table of that query level. Do

Re: pgsql: Add more SQL/JSON constructor functions

2024-08-21 Thread jian he
On Tue, Jul 30, 2024 at 12:59 PM Amit Langote wrote: > > Hi, > > On Fri, Jul 26, 2024 at 11:19 PM jian he wrote: > > On Fri, Jul 26, 2024 at 4:53 PM Amit Langote > > wrote: > > > > > > > > > Pushed 0003-0005 ahead of 0001-0002. Will try to

Re: Vacuum statistics

2024-08-21 Thread jian he
On Wed, Aug 21, 2024 at 6:37 AM Alena Rybakina wrote: > > We check it there: "tabentry->vacuum_ext.type != type". Or were you talking > about something else? > > On 19.08.2024 12:32, jian he wrote: > > in pg_stats_vacuum > if (type == PGSTAT_EXTVA

Re: Disallow USING clause when altering type of generated column

2024-08-21 Thread jian he
On Wed, Aug 21, 2024 at 4:57 PM Peter Eisentraut wrote: > + /* + * Cannot specify USING when altering type of a generated column, because + * that would violate the generation expression. + */ + if (attTup->attgenerated && def->cooked_default) + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEF

Re: Emitting JSON to file using COPY TO

2024-08-21 Thread jian he
On Mon, Aug 19, 2024 at 8:00 AM jian he wrote: > > On Mon, Apr 1, 2024 at 8:00 PM jian he wrote: > > > rebased. > minor cosmetic error message change. > > I think all the issues in this thread have been addressed. hi. I did some minor changes based on the v11. mainly

Re: Virtual generated columns

2024-08-23 Thread jian he
drop table if exists gtest_err_1 cascade; CREATE TABLE gtest_err_1 ( a int PRIMARY KEY generated by default as identity, b int GENERATED ALWAYS AS (22), d int default 22); create view gtest_err_1_v as select * from gtest_err_1; SELECT events & 4 != 0 AS can_upd, events & 8 != 0 AS can_ins,events &

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

2024-08-25 Thread jian he
columns is not the same as the target table, then error ERROR: missing data for column \"%s\" ERROR: extra data after last expected column which is status quo. From d697684b4dc1356172d93179b1e5e157893c3e54 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 23 Aug 2024 22:26:44 +0800 Subject:

Re: POC, WIP: OR-clause support for indexes

2024-08-25 Thread jian he
On Fri, Aug 23, 2024 at 8:58 PM Alexander Korotkov wrote: > based on v37. + { + /* + * We have only Const's. In this case we can construct an array + * directly. + */ + int16 typlen; + bool typbyval; + char typalign; + Datum *elems; + int i = 0; + ArrayType *arrayConst; + + get_typlenbyvalal

Re: Set query_id for query contained in utility statement

2024-08-25 Thread jian he
On Mon, Aug 5, 2024 at 3:19 PM Anthonin Bonnefoy wrote: > > I've realised my initial approach was wrong, calling the post parse > for all nested queries in analyze.c prevents extension like pgss to > correctly track the query's nesting level. > > I've changed the approach to replicate what's done

Re: Statistics Import and Export

2024-08-26 Thread jian he
On Sat, Aug 24, 2024 at 4:50 AM Jeff Davis wrote: > > > I have attached version 28j as one giant patch covering what was > previously 0001-0003. It's a bit rough (tests in particular need some > work), but it implelements the logic to replace only those values > specified rather than the whole tup

Re: POC, WIP: OR-clause support for indexes

2024-08-26 Thread jian he
On Mon, Aug 26, 2024 at 6:41 PM Alena Rybakina wrote: > > + /* Construct the list of nested OR arguments */ > + for (j = group_start; j < i; j++) > + { > + Node *arg = list_nth(orargs, matches[j].argindex); > + > + rargs = lappend(rargs, arg); > + if (IsA(arg, RestrictInfo)) > + args = lappend(a

Re: Set query_id for query contained in utility statement

2024-08-27 Thread jian he
On Mon, Aug 26, 2024 at 4:55 PM Anthonin Bonnefoy wrote: > /* Evaluate parameters, if any */ if (entry->plansource->num_params) { - ParseState *pstate; - - pstate = make_parsestate(NULL); - pstate->p_sourcetext = queryString; you deleted the above these lines, but passed (ParseState *pstat

Re: Virtual generated columns

2024-08-29 Thread jian he
On Thu, Aug 29, 2024 at 8:15 PM Peter Eisentraut wrote: > > > > drop table if exists comment_test cascade; > > CREATE TABLE comment_test ( > >id int, > >positive_col int GENERATED ALWAYS AS (22) CHECK (positive_col > 0), > >positive_col1 int GENERATED ALWAYS AS (22) stored CHECK (pos

Re: ANALYZE ONLY

2024-08-30 Thread jian he
On Thu, Aug 29, 2024 at 7:31 PM Melih Mutlu wrote: > > Hi Michael, > > Michael Harris , 23 Ağu 2024 Cum, 13:01 tarihinde şunu > yazdı: >> >> V2 of the patch is attached. > > > Thanks for updating the patch. I have a few more minor feedbacks. > >> -ANALYZE [ ( option [, ...] ) ] >> [ table_and_co

Re: query_id, pg_stat_activity, extended query protocol

2024-08-30 Thread jian he
On Thu, Aug 15, 2024 at 5:06 AM Imseih (AWS), Sami wrote: > > > I think the testing discussion should be moved to a different thread. > > What do you think? > See v4. > > 0001 deals with reporting queryId in exec_execute_message and > exec_bind_message. > 0002 deals with reporting queryId after a

Re: Virtual generated columns

2024-09-02 Thread jian he
On Wed, Aug 21, 2024 at 6:52 PM Dean Rasheed wrote: > > On Wed, 21 Aug 2024 at 08:00, Peter Eisentraut wrote: > > > > On 08.08.24 20:22, Dean Rasheed wrote: > > > Looking at the rewriter changes, it occurred to me that it could > > > perhaps be done more simply using ReplaceVarsFromTargetList() f

Re: Virtual generated columns

2024-09-02 Thread jian he
On Thu, Aug 29, 2024 at 9:35 PM jian he wrote: > > On Thu, Aug 29, 2024 at 8:15 PM Peter Eisentraut wrote: > > > > > > The new patch does some rebasing and contains various fixes to the > > issues you presented. As I mentioned, I'll look into improving the

Re: pgsql: Add more SQL/JSON constructor functions

2024-09-03 Thread jian he
On Mon, Sep 2, 2024 at 4:18 PM Amit Langote wrote: > > > See 0001. > > > > > > See 0002. > > > > I'm also attaching 0003 to fix a minor annoyance that JSON_TABLE() > > columns' default ON ERROR, ON EMPTY behaviors are unnecessarily > > emitted in the deparsed output when the top-level ON ERROR be

Re: altering a column's collation leaves an invalid foreign key

2024-09-03 Thread jian he
on as long as it does not interact with FK. [1] https://www.postgresql.org/message-id/CACJufxEW6OMBqt8cbr%3D3Jt%2B%2BZd_SL-4YDjfk7Q7DhGKiSLcu4g%40mail.gmail.com From 024d818e0e286af10b74649bd3156836d6f28447 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 4 Sep 2024 14:31:43 +0800 Subject: [PATCH

Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN

2024-09-04 Thread jian he
On Wed, Jul 10, 2024 at 5:36 PM Tatsuo Ishii wrote: > > > Attached are the v2 patches. As suggested by David, I split them > into multiple patches so that each patch implements the feature for > each node. You need to apply the patches in the order of patch number > (if you want to apply all of th

Re: First draft of PG 17 release notes

2024-09-04 Thread jian he
hi. Allow partitions to be merged using ALTER TABLE ... MERGE PARTITIONS (Dmitry Koval) Allow partitions to be split using ALTER TABLE ... SPLIT PARTITION (Dmitry Koval) also these two items got reverted? see https://git.postgresql.org/cgit/postgresql.git/commit/?id=3890d90c1508125729ed20038d9051

Re: meson and check-tests

2024-09-04 Thread jian he
On Wed, Jun 5, 2024 at 7:26 PM Ashutosh Bapat wrote: > > > > On Mon, Jun 3, 2024 at 10:04 PM Tristan Partin wrote: >> >> On Sun Jun 2, 2024 at 12:25 AM CDT, Tom Lane wrote: >> > "Tristan Partin" writes: >> > > On Fri May 31, 2024 at 12:02 PM CDT, Ashutosh Bapat wrote: >> > >> We talked this off-

updatable view set default interact with base rel generated stored columns

2024-09-05 Thread jian he
hi. While reviewing virtual generated columns, I find some issues with the updatable view interacting with stored generated columns. --- drop table if exists base_tbl cascade; CREATE TABLE base_tbl (a int, b int GENERATED ALWAYS AS (22) stored, d int default 22); create view rw

Re: Virtual generated columns

2024-09-05 Thread jian he
On Wed, Sep 4, 2024 at 4:40 PM Peter Eisentraut wrote: > > > Here is an implementation of this. It's much nicer! It also appears to > fix all the additional test cases that have been presented. (I haven't > integrated them into the patch set yet.) > > I left the 0001 patch alone for now and put

Re: Vacuum statistics

2024-09-05 Thread jian he
On Thu, Sep 5, 2024 at 1:23 AM Alena Rybakina wrote: > > Hi, all! > > I have attached the new version of the code and the diff files > (minor-vacuum.no-cbot). > hi. still have white space issue when using "git apply", you may need to use "git diff --check" to find out where. /* -- dif

ATExecColumnDefault comments

2024-09-05 Thread jian he
hi. one minor issue for ATExecColumnDefault comments. /* * ALTER TABLE ALTER COLUMN SET/DROP DEFAULT * * Return the address of the affected column. */ static ObjectAddress ATExecColumnDefault(Relation rel, const char *colName, Node *newDefault, LOCKMODE lockmode) the comm

Re: Detailed release notes

2024-09-06 Thread jian he
he same. > > Big +1 to this. It would definitely be great if we would have these > commit links for previous release notes. But the PG17 GA release is > probably happening in 19 days on September 26th. I feel like we should > focus on getting the manual improvements from Jian He me

Re: Statistics Import and Export

2024-09-07 Thread jian he
On Fri, Sep 6, 2024 at 1:34 AM Corey Huinker wrote: >> >> >> this part elevel should always be ERROR? >> if so, we can just > > > I'm personally dis-inclined to error on any of these things, so I'll be > leaving it as is. I suspect that the proper balance lies between all-ERROR > and all-WARNING

Re: not null constraints, again

2024-09-08 Thread jian he
On Sat, Aug 31, 2024 at 11:59 AM Alvaro Herrera wrote: > > Hello > > Here I present another attempt at making not-null constraints be > catalogued. This is largely based on the code reverted at 9ce04b50e120, > except that we now have a not-null constraint automatically created for > every column

Re: not null constraints, again

2024-09-09 Thread jian he
On Mon, Sep 2, 2024 at 6:33 PM Tender Wang wrote: > > > > The attached patch adds List *nnconstraints, which store the not-null > definition, in struct CreateStmt. > This makes me a little confused about List *constraints in struct CreateStmt. > Actually, the List constraints > store ckeck cons

change "attnum <=0" to "attnum <0" for better reflect system attribute

2024-09-09 Thread jian he
hi, one minor issue. not that minor, since many DDLs need to consider the system attribute. looking at these functions: SearchSysCacheCopyAttName SearchSysCacheAttName get_attnum get_attnum says: Returns InvalidAttrNumber if the attr doesn't exist (or is dropped). So I conclude that "attnum == 0

Re: not null constraints, again

2024-09-10 Thread jian he
On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera wrote: > > Hello, here's a v2 of this patch. I have fixed --I think-- all the > issues you and Tender Wang reported (unless I declined a fix in some > previous email). > + /* + * The constraint must appear as inherited in children, so create a + * m

Re: not null constraints, again

2024-09-11 Thread jian he
On Wed, Sep 11, 2024 at 9:11 AM jian he wrote: > > On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera > wrote: > > > > Hello, here's a v2 of this patch. I have fixed --I think-- all the > > issues you and Tender Wang reported (unless I declined a fix in some

Re: not null constraints, again

2024-09-12 Thread jian he
> > On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera > > wrote: > > > > > > Hello, here's a v2 of this patch. I have fixed --I think-- all the > > > issues you and Tender Wang reported (unless I declined a fix in some > > > previous email). > > > PREPARE constr_meta (name[]) AS with cte as ( sele

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

2024-09-12 Thread jian he
On Mon, Sep 9, 2024 at 10:34 PM Jim Jones wrote: > > > Hi there > > On 26.08.24 02:00, jian he wrote: > > hi all. > > patch updated. > > simplified the code a lot. > > > > idea is same: > > COPY t_on_error_null FROM STDIN WITH (on_error set_to_n

Re: Add column name to error description

2024-09-13 Thread jian he
. Also this error ERROR: structure of query does not match function result type occurred quite often on the internet, see [1] but there are no tests for it. so we can add a test in src/test/regress/sql/plpgsql.sql [1] https://stackoverflow.com/search?q=structure+of+query+does+not+match+function+result+type Fr

Re: Emitting JSON to file using COPY TO

2024-09-13 Thread jian he
Hi. in ExecutePlan we have: for (;;) { ResetPerTupleExprContext(estate); slot = ExecProcNode(planstate); if (!TupIsNull(slot)) { if((slot != NULL) && (slot->tts_tupleDescriptor != NULL) && (slot->tts_tupleDescriptor->natts > 0)

Re: ANALYZE ONLY

2024-09-15 Thread jian he
hi. in https://www.postgresql.org/docs/current/ddl-inherit.html <<< Commands that do database maintenance and tuning (e.g., REINDEX, VACUUM) typically only work on individual, physical tables and do not support recursing over inheritance hierarchies. The respective behavior of each individual comm

information_schema.view attgenerated

2024-09-15 Thread jian he
hi. one minor issue in src/backend/catalog/information_schema.sql /* * 6.22 * COLUMNS view */ CREATE VIEW columns CAST(CASE WHEN a.attgenerated = '' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS column_default, can change to CAST(CASE WHEN a.attgenerated = '' AND a.atth

Re: Virtual generated columns

2024-09-16 Thread jian he
in v7. doc/src/sgml/ref/alter_table.sgml and column_constraint is: section need representation of: GENERATED ALWAYS AS ( generation_expr ) [VIRTUAL] in RelationBuildTupleDesc(Relation relation) we need to add "constr->has_generated_virtual" for the following code? if (constr->has_not_null

Re: altering a column's collation leaves an invalid foreign key

2024-07-16 Thread jian he
On Tue, Jun 18, 2024 at 4:50 PM Peter Eisentraut wrote: > > On 08.06.24 06:14, jian he wrote: > > if FK is nondeterministic, then it looks PK more like FK. > > the following example, one FK row is referenced by two PK rows. > > > > DROP TABLE IF EXISTS fktable, pkt

Re: Remove dependence on integer wrapping

2024-07-17 Thread jian he
On Wed, Jul 17, 2024 at 9:23 AM Joseph Koshakow wrote: > > Updated in the attached patch. > > Once again, the other patches, 0001, 0003, and 0004 are unchanged but > have their version number incremented. > +-- Test for overflow in array slicing +CREATE temp table arroverflowtest (i int[]); +INS

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-17 Thread jian he
d patch makes it return an error, similar to what we did for the fixed length string type. From d457e3efebaaf1882693f7c9e2afd49520bce2a8 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 18 Jul 2024 13:38:19 +0800 Subject: [PATCH v1 1/1] fix transformJsonBehavior coerce to different types. make transform

Re: Adding OLD/NEW support to RETURNING

2024-07-18 Thread jian he
On Sat, Jul 13, 2024 at 1:22 AM Dean Rasheed wrote: > > On Wed, 26 Jun 2024 at 12:18, Dean Rasheed wrote: > > > > I've added a new elog() error check to > > adjust_appendrel_attrs_mutator(), similar to the existing one for > > varnullingrels, to report if we ever attempt to apply a non-default >

Re: add function argument names to regex* functions.

2024-07-19 Thread jian he
On Fri, Jul 19, 2024 at 5:48 AM Tom Lane wrote: > > jian he writes: > > [ v5-0001-add-regex-functions-argument-names-to-pg_proc.patch ] > > I'm not sure whether we've bikeshedded this to death yet, but > personally I'm content with the naming choices here

Re: documentation structure

2024-07-19 Thread jian he
l [1] https://postgr.es/m/CACJufxH%2BYi521QrncwnW4sFGOhPmJQpsmoJ%2BYnj%2BVpHu5wAahQ%40mail.gmail.com\ [2] http://postgr.es/m/CACJufxEcMjjn-m6fpC2wXHsQbE5nyd%3Dxt6k-jDizBVUKK6O4KQ%40mail.gmail.com From cf98a802a7823bf3960b6e08aa1d06f6f944b3fe Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 19

Re: documentation structure

2024-07-21 Thread jian he
func_merge_support_end_lineno, func_subquery_begin_lineno, func_subquery_end_lineno, func_comparisons_begin_lineno, func_comparisons_end_lineno, func_srf_begin_lineno, fu

Re: Virtual generated columns

2024-07-22 Thread jian he
statistic related bug. borrow examples from https://www.postgresql.org/docs/current/sql-createstatistics.html CREATE TABLE t3 (a timestamp PRIMARY KEY, b timestamp GENERATED ALWAYS AS (a) VIRTUAL); CREATE STATISTICS s3 (ndistinct) ON b FROM t3; INSERT INTO t3(a) SELECT i FROM generate_series('20

Re: Virtual generated columns

2024-07-22 Thread jian he
another bug? drop table gtest12v; CREATE TABLE gtest12v (a int PRIMARY KEY, b bigint, c int GENERATED ALWAYS AS (b * 2) VIRTUAL); insert into gtest12v (a,b) values (11, 22147483647); table gtest12v; insert ok, but select error: ERROR: integer out of range should insert fail? CREATE TABLE gte

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-22 Thread jian he
On Mon, Jul 22, 2024 at 4:46 PM Amit Langote wrote: > > On Thu, Jul 18, 2024 at 3:04 PM jian he wrote: > > we still have problem in transformJsonBehavior > > > > currently transformJsonBehavior: > > SELECT JSON_VALUE(jsonb '1234', '$' RETURNIN

Re: Virtual generated columns

2024-07-22 Thread jian he
drop table t3; CREATE TABLE t3( b bigint, c int GENERATED ALWAYS AS (b * 2) VIRTUAL); insert into t3 (b) values (22147483647); ANALYZE t3; for ANALYZE since column c has no actual storage, so it's not analyzable? we need to change the function examine_attribute accordingly? For the above exampl

Re: Remove dependence on integer wrapping

2024-07-22 Thread jian he
On Tue, Jul 23, 2024 at 6:56 AM Joseph Koshakow wrote: > > The specific bug that this patch fixes is preventing the following > statement: > > # INSERT INTO arroverflowtest(i[-2147483648:2147483647]) VALUES ('{1}'); > > So we may want to add that test back in. > I agree with you. also v13-0

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-23 Thread jian he
SELECT * FROM JSON_TABLE(jsonb '"a"', '$' COLUMNS (a jsonb EXISTS PATH '$')); ERROR: cannot cast type boolean to jsonb i found out a typo in src/test/regress/expected/sqljson_queryfuncs.out, src/test/regress/sql/sqljson_queryfuncs.sql "fixed-leg

Re: Can't find bugs to work on

2024-07-23 Thread jian he
On Sat, Jul 13, 2024 at 12:09 AM David G. Johnston wrote: > > On Fri, Jul 12, 2024 at 8:44 AM Tom Lane wrote: >> >> >> As this example shows, it's now standard for PG commit log messages >> to include a link to the relevant email thread, so all you need >> is the message-ID of the first message i

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-23 Thread jian he
On Tue, Jul 23, 2024 at 8:52 PM Amit Langote wrote: > > In the attached patch, I've also taken care of the problem mentioned > in your latest email -- the solution I've chosen is not to produce the > error when ERROR ON ERROR is specified but to use runtime coercion > also for the jsonb type or an

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-24 Thread jian he
drop domain if exists djs; create domain djs as jsonb check ( value <> '"11"' ); SELECT JSON_QUERY(jsonb '"aaa"', '$.a' RETURNING djs keep quotes DEFAULT '"11"' ON empty); SELECT JSON_QUERY(jsonb '"aaa"', '$.a' RETURNING djs omit quotes DEFAULT '"11"' ON empty); SELECT JSON_QUERY(jsonb '"11"', '$'

Re: SQL:2011 application time

2024-07-24 Thread jian he
On Wed, Jul 24, 2024 at 12:08 AM Paul Jungwirth wrote: > > On 7/18/24 11:39, Paul Jungwirth wrote: > > So I swapped in the &&& patch, cleaned it up, and added tests. But > > something is wrong. After I get > > one failure from an empty, I keep getting failures, even though the table > > is empty

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

2024-07-25 Thread jian he
in the test script? > sure. please check attached. From 0b9e7a9c32d4e3163ef0cc955a0916b9d5c7f395 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 25 Jul 2024 22:46:07 +0800 Subject: [PATCH v2 1/1] refactor regex related tests some tests for regexp_instr, regexp_substr using "abcabcabc" as the sou

Re: add function argument names to regex* functions.

2024-07-26 Thread jian he
On Fri, Jul 19, 2024 at 5:48 AM Tom Lane wrote: > > The small issue is that table 9.10 offers this syntax diagram > for regexp_replace: > > regexp_replace ( string text, pattern text, replacement text [, start integer > ] [, flags text ] ) → text > > This implies that it's valid to write > >

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-26 Thread jian he
or(jexpr->on_error, context, "ERROR"); for json_value, json_query, i believe we can save some circles in ExecInitJsonExpr if you don't specify on error, on empty can you please check the attached, based on your latest attachment. From 618b48991d5239eb924070b0357c5208a9d1ca5c Mon Sep

Re: add function argument names to regex* functions.

2024-07-26 Thread jian he
On Fri, Jul 26, 2024 at 10:17 PM Tom Lane wrote: > > > << > > It has the syntax regexp_replace(string, pattern, replacement [, start > > [, N ]] [, flags ]). (Notice that N cannot be specified unless start > > is, but flags can be given in any case.) > > << > > doc, the above part still needs chan

Re: add function argument names to regex* functions.

2024-07-26 Thread jian he
On Fri, Jul 26, 2024 at 10:40 PM Tom Lane wrote: > > jian he writes: > > On Fri, Jul 26, 2024 at 10:17 PM Tom Lane wrote: > >> AFAICS, that one is correct, so I left it alone. (I didn't try to > >> merge the table's two entries into one like that, thoug

Re: Adding OLD/NEW support to RETURNING

2024-08-02 Thread jian he
On Thu, Aug 1, 2024 at 7:33 PM Dean Rasheed wrote: > > On Mon, 29 Jul 2024 at 11:22, Dean Rasheed wrote: > > > > Trivial rebase, following c7301c3b6f. > > > > Rebased version, forced by a7f107df2b. Evaluating the input parameters > of correlated SubPlans in the referencing ExprState simplifies th

Re: Detailed release notes

2024-08-05 Thread jian he
On Fri, Jul 26, 2024 at 10:11 PM Tom Lane wrote: > > Daniel Gustafsson writes: > >> On 26 Jul 2024, at 15:00, Marcos Pegoraro wrote: > >> But why is that just a hidden comment and not a visible link for us ? > > > That's likely the wrong level of detail for the overwhelming majority of > > relea

Re: Adding OLD/NEW support to RETURNING

2024-08-05 Thread jian he
On Fri, Aug 2, 2024 at 6:13 PM Dean Rasheed wrote: > > On Fri, 2 Aug 2024 at 08:25, jian he wrote: > > > > if (resultRelInfo->ri_projectReturning && (processReturning || saveOld)) > > { > > } > > > > "saveOld" imply &

Re: SQL:2011 application time

2024-08-05 Thread jian he
On Fri, Aug 2, 2024 at 1:09 AM Paul Jungwirth wrote: > > On 7/25/24 08:52, Paul Jungwirth wrote: > > Here is a patch moving the not-empty check into > > check_exclusion_or_unique_constraint. That is a more > > logical place for it than ExecConstraints, since WITHOUT OVERLAPS is part > > of the i

Re: SQL:2011 application time

2024-08-06 Thread jian he
On Tue, Aug 6, 2024 at 10:02 AM jian he wrote: > > On Fri, Aug 2, 2024 at 1:09 AM Paul Jungwirth > wrote: > > > > On 7/25/24 08:52, Paul Jungwirth wrote: > > > Here is a patch moving the not-empty check into > > > check_exclusion_or_unique_constraint. Th

Re: Detailed release notes

2024-08-07 Thread jian he
url prefix in release-17.sgml. it is not configurable though. From 209f151ac4fd5f07aa0233ab6f7ceb08d8ea56e3 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 8 Aug 2024 10:49:19 +0800 Subject: [PATCH v2 1/1] pg 17 release note add git commit link reference --- doc/s

Re: Detailed release notes

2024-08-08 Thread jian he
On Thu, Aug 8, 2024 at 8:51 PM Marcos Pegoraro wrote: > > Em qui., 8 de ago. de 2024 às 00:11, jian he > escreveu: >> >> >> adding the following line to postgres.sgml saved me. >> +https://postgr.es/c/";> > > > Comma at end of line of thes

Re: Remove dependence on integer wrapping

2024-08-08 Thread jian he
On Fri, Aug 9, 2024 at 6:16 AM Matthew Kim wrote: > > I've updated patch 0004 to check the return value of pg_mul_s32_overflow(). > Since tm.tm_year overflowed, the error message is hardcoded. > --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -257,7 +257,10 @@ make_date(

Re: Adding OLD/NEW support to RETURNING

2024-08-11 Thread jian he
hi. took me a while to understand how the returning clause Var nodes correctly reference the relations RT index. mainly in set_plan_references, set_plan_refs and set_returning_clause_references. do you think we need do something in set_returning_clause_references->build_tlist_index_other_vars to

Re: Detailed release notes

2024-08-12 Thread jian he
lor). > +[ee1b30f12], > +[30e144287], > +[667e65aac], > +[6dbb49026] > as your wish. From a511a80c7e00cd1ce4650e4450bb938868e69062 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 12 Aug 2024 17:14:40 +0800 Subject: [PATCH v4 1/1] pg 17 release note add gi

minor comments issue in ResultRelInfo src/include/nodes/execnodes.h

2024-08-12 Thread jian he
hi. { /* * For UPDATE/DELETE result relations, the attribute number of the row * identity junk attribute in the source plan's output tuples */ AttrNumberri_RowIdAttNo; /* Projection to generate new tuple in an INSERT/UPDATE */ ProjectionInfo *ri_projectNew;

Re: Remove dependence on integer wrapping

2024-08-12 Thread jian he
On Sat, Aug 10, 2024 at 11:41 PM Joseph Koshakow wrote: > > > > On Thu, Aug 8, 2024 at 9:01 PM jian he wrote: > > > > Should the error about integers be out of range? > > > > SELECT make_date(-2147483648, 1, 1); > > "-2147483648&qu

Re: Virtual generated columns

2024-08-13 Thread jian he
On Thu, Aug 8, 2024 at 2:23 PM Peter Eisentraut wrote: > > Thank you for your extensive testing. Here is a new patch set that has > fixed all the issues you have reported (MERGE, sublinks, statistics, > ANALYZE). if (coldef->generated && restdef->generated && coldef->generate

Re: Remove dependence on integer wrapping

2024-08-14 Thread jian he
On Thu, Aug 15, 2024 at 2:16 AM Nathan Bossart wrote: > +static inline bool +pg_neg_u64_overflow(uint64 a, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(0, a, result); +#elif defined(HAVE_INT128) + uint128 res = -((int128) a); + + if (unlikely(res < PG_

Re: SQL:2011 application time

2024-08-15 Thread jian he
On Thu, Aug 8, 2024 at 4:54 AM Paul Jungwirth wrote: > > Rebased to e56ccc8e42. I only applied to 0001-0003. in create_table.sgml, I saw the WITHOUT OVERLAPS change is mainly in table_constraint. but we didn't touch alter_table.sgml. Do we also need to change alter_table.sgml correspondingly? +

Re: Vacuum statistics

2024-08-16 Thread jian he
On Thu, Aug 15, 2024 at 4:49 PM Alena Rybakina wrote: > > Hi! I've applied all the v5 patches. 0002 and 0003 have white space errors. + +Number of times blocks of this index were already found +in the buffer cache by vacuum operations, so that a read was not necessary +

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