Re: remaining sql/json patches

2024-05-27 Thread jian he
On Mon, May 20, 2024 at 7:51 PM Amit Langote wrote: > > Hi Thom, >> > > and I think we need to either remove the leading "select" keyword, or > > uppercase it in the examples. > > > > For example (on > > https://www.postgresql.org/docs/devel/functions-json.html#SQLJSON-QUERY-FUNCTIONS): > > > >

Re: struct RelOptInfo member relid comments

2024-05-23 Thread jian he
On Fri, May 24, 2024 at 11:14 AM Tom Lane wrote: > > jian he writes: > > imho, the above comment is not very helpful. > > we should say more about what kind of information relid says about a base > > rel? > > "Relid" is defined at the

struct RelOptInfo member relid comments

2024-05-23 Thread jian he
hi typedef struct RelOptInfo { /* * information about a base rel (not set for join rels!) */ Index relid; ... } imho, the above comment is not very helpful. we should say more about what kind of information relid says about a base rel? I don't know much about RelOptInfo, that's why I ask.

Re: POC: GROUP BY optimization

2024-05-23 Thread jian he
On Mon, May 20, 2024 at 4:54 PM jian he wrote: > > > The behavior is still the same as the master. > meaning that below quoted queries are still using "Presorted Key: x". > > > > EXPLAIN (COSTS OFF) SELECT count(*) FROM t1 GROUP BY x,z,y,w; > > > EXPLAI

Re: in parentesis is not usual on DOCs

2024-05-22 Thread jian he
On Wed, May 22, 2024 at 7:14 PM Peter Eisentraut wrote: > > On 20.05.24 02:00, jian he wrote: > >> removing parentheses means we need to rephrase this sentence? > >> So I come up with the following rephrase: > >> > >> The context_item specifies the inp

doc regexp_replace replacement string \n does not explained properly

2024-05-20 Thread jian he
hi. https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP <<

Re: PostgreSQL 17 Beta 1 release announcement draft

2024-05-20 Thread jian he
On Mon, May 20, 2024 at 5:35 AM Jonathan S. Katz wrote: > > On 5/15/24 9:45 PM, Jonathan S. Katz wrote: > > Hi, > > > > Attached is a copy of the PostgreSQL 17 Beta 1 release announcement > > draft. This contains a user-facing summary of some of the features that > > will be available in the

Re: POC: GROUP BY optimization

2024-05-20 Thread jian he
On Thu, May 16, 2024 at 3:47 PM Andrei Lepikhov wrote: > > On 24.04.2024 13:25, jian he wrote: > > hi. > > I found an interesting case. > > > > CREATE TABLE t1 AS > >SELECT (i % 10)::numeric AS x,(i % 10)::int8 AS y,'abc' || i % 10 AS > > z, i::in

Re: Underscore in positional parameters?

2024-05-19 Thread jian he
On Sun, May 19, 2024 at 10:43 PM Erik Wienhold wrote: > > On 2024-05-19 07:00 +0200, Alexander Lakhin wrote: > > I encountered anomalies that you address with this patch too. > > And I can confirm that it fixes most cases, but there is another one: > > SELECT $3 \bind 'foo' \g > > ERROR:

Re: in parentesis is not usual on DOCs

2024-05-19 Thread jian he
On Thu, May 16, 2024 at 12:14 PM jian he wrote: > > On Wed, May 15, 2024 at 8:34 PM Daniel Gustafsson wrote: > > > > > On 15 May 2024, at 14:04, Marcos Pegoraro wrote: > > > > > Why (context_item), (path_expression) and (json_path_name) are inside a > &

Re: First draft of PG 17 release notes

2024-05-17 Thread jian he
On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > I have committed the first draft of the PG 17 release notes; you can > see the results here: > > https://momjian.us/pgsql_docs/release-17.html > > It will be improved until the final release. The item count is 188, > which is

remove Todo item: Allow infinite intervals just like infinite timestamps

2024-05-17 Thread jian he
hi. https://wiki.postgresql.org/wiki/Todo Dates and Times[edit] Allow infinite intervals just like infinite timestamps https://www.postgresql.org/message-id/4eb095c8.1050...@agliodbs.com this done at

Re: First draft of PG 17 release notes

2024-05-16 Thread jian he
On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > I have committed the first draft of the PG 17 release notes; you can > see the results here: > > https://momjian.us/pgsql_docs/release-17.html > >> Add jsonpath methods to convert JSON values to different data types (Jeevan >>

Re: in parentesis is not usual on DOCs

2024-05-15 Thread jian he
On Wed, May 15, 2024 at 8:34 PM Daniel Gustafsson wrote: > > > On 15 May 2024, at 14:04, Marcos Pegoraro wrote: > > > Why (context_item), (path_expression) and (json_path_name) are inside a > > parentheses ? This is not usual when explaining any other feature. > > Agreed, that's inconsisent

Re: First draft of PG 17 release notes

2024-05-15 Thread jian he
On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > I have committed the first draft of the PG 17 release notes; you can > see the results here: > > https://momjian.us/pgsql_docs/release-17.html > >> Add local I/O block read/write timing statistics columns of >> pg_stat_statement

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
On Wed, May 15, 2024 at 10:13 AM David Rowley wrote: > > On Wed, 15 May 2024 at 13:44, jian he wrote: > >"Shared Hit Blocks": 0, > >"Shared Read Blocks": 0, > >"Shared Dirtied Blocks": 0, > >

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
explain (format json, analyze, wal, buffers, memory, serialize) insert into tenk1 select * from tenk1 limit 1; QUERY PLAN --- [ { "Plan": { "Node Type": "ModifyTable", "Operation": "Insert", "Parallel

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
On Tue, May 14, 2024 at 6:33 PM David Rowley wrote: > > On Tue, 14 May 2024 at 18:16, David Rowley wrote: > > I think for v17, we should consider adding a macro to explain.c to > > calculate the KB from bytes. There are other inconsistencies that it > > would be good to address. We normally

Bibliography section, some references cannot be found

2024-05-13 Thread jian he
hi. while reading this[1], << More information about partial indexes can be found in [ston89b], [olson93], and [seshadri95]. I googled around, still cannot find [olson93] related pdf or html link. in [2], I found out [ong90] “A Unified Framework for Version Modeling Using Production Rules in a

Re: SQL:2011 application time

2024-05-13 Thread jian he
On Tue, May 14, 2024 at 7:30 AM Paul Jungwirth wrote: > > On 5/13/24 03:11, Peter Eisentraut wrote: > > It looks like we missed some of these fundamental design questions early > > on, and it might be too > > late now to fix them for PG17. > > > > For example, the discussion on unique

explain format json, unit for serialize and memory are different.

2024-05-13 Thread jian he
hi. explain(analyze, format json, serialize, memory, costs off, Timing off) select * from tenk1; QUERY PLAN - [ { "Plan": { "Node Type": "Seq Scan", "Parallel Aware": false, "Async Capable": false, "Relation Name":

Re: SQL:2011 application time

2024-05-11 Thread jian he
On Mon, May 6, 2024 at 11:01 AM jian he wrote: > > On Wed, May 1, 2024 at 12:39 AM Paul Jungwirth > wrote: > > > > On 4/30/24 09:24, Robert Haas wrote: > > > Peter, could you have a look at > > > http://postgr.es/m/47550967-260b-4180-9791-b224859fe...@ill

Re: First draft of PG 17 release notes

2024-05-09 Thread jian he
On Thu, May 9, 2024 at 11:12 PM Bruce Momjian wrote: > > On Thu, May 9, 2024 at 07:49:55PM +0800, jian he wrote: > > On Thu, May 9, 2024 at 6:53 PM jian he wrote: > > > > > > On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > > > I have comm

Re: First draft of PG 17 release notes

2024-05-09 Thread jian he
On Thu, May 9, 2024 at 6:53 PM jian he wrote: > > On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > I have committed the first draft of the PG 17 release notes; you can > > see the results here: > > > > https://momjian.us/pgsql_docs/release-17.h

Re: First draft of PG 17 release notes

2024-05-09 Thread jian he
> << > Allow ALTER OPERATOR to set more optimization attributes (Tommy Pavlicek) > This is useful for extensions. > << sorry, I mean << Allow the creation of hash indexes on ltree columns (Tommy Pavlicek) This also enables hash join and hash aggregation on ltree columns. << better description

Re: First draft of PG 17 release notes

2024-05-09 Thread jian he
On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > I have committed the first draft of the PG 17 release notes; you can > see the results here: > > https://momjian.us/pgsql_docs/release-17.html > * Add function pg_buffercache_evict() to allow shared buffer eviction (Palak

Re: First draft of PG 17 release notes

2024-05-09 Thread jian he
On Thu, May 9, 2024 at 12:04 PM Bruce Momjian wrote: > > I have committed the first draft of the PG 17 release notes; you can > see the results here: > > https://momjian.us/pgsql_docs/release-17.html > another potential incompatibilities issue: ALTER TABLE DROP PRIMARY KEY see:

Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.

2024-05-06 Thread jian he
hi, SELECT table_name, column_name, is_updatable FROM information_schema.columns WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name, ordinal_position; at d1d286d83c0eed695910cb20d970ea9bea2e5001, this query in src/test/regress/sql/updatable_views.sql makes regress tests fail. maybe

Re: SQL:2011 application time

2024-05-05 Thread jian he
int, index_create) that these two constraints are indeed created, only after that we have a dependency linking these two constraints. I've attached a patch trying to solve this problem. the patch is not totally polished, but works as expected, and also has lots of comments. From 2028de0384b81bb9b2bff

Re: Document NULL

2024-05-03 Thread jian he
On Fri, May 3, 2024 at 2:47 PM Laurenz Albe wrote: > > On Thu, 2024-05-02 at 08:23 -0700, David G. Johnston wrote: > > Version 2 attached. Still a draft, focused on topic picking and overall > > structure. > > I'm fine with most of the material (ignoring ellipses and typos), except this: > > +

Re: [PoC] Reducing planning time when tables have many partitions

2024-05-02 Thread jian he
On Thu, May 2, 2024 at 3:57 PM Yuya Watari wrote: > hi. sorry to bother you, maybe a dumb question. trying to understand something under the hood. currently I only applied v24-0001-Speed-up-searches-for-child-EquivalenceMembers.patch. on v24-0001: +/* + * add_eq_member - build a new

EXPLAN redundant options

2024-05-02 Thread jian he
hi. just found out we can: explain (verbose, verbose off, analyze on, analyze off, analyze on) select count(*) from tenk1; similar to COPY, do we want to error out these redundant options?

Re: SQL:2011 application time

2024-05-01 Thread jian he
On Wed, May 1, 2024 at 12:39 AM Paul Jungwirth wrote: > > On 4/30/24 09:24, Robert Haas wrote: > > Peter, could you have a look at > > http://postgr.es/m/47550967-260b-4180-9791-b224859fe...@illuminatedcomputing.com > > and express an opinion about whether each of those proposals are (a) > > good

Re: CREATE TABLE/ProcessUtility hook behavior change

2024-04-30 Thread jian he
On Tue, Apr 30, 2024 at 4:35 PM David Steele wrote: > > On 4/30/24 12:57, jian he wrote: > > On Tue, Apr 30, 2024 at 10:26 AM David Steele wrote: > >> > >> Since bb766cde cannot be readily applied to older commits in master I'm > >> unable to continue bisec

Re: CREATE TABLE/ProcessUtility hook behavior change

2024-04-29 Thread jian he
On Tue, Apr 30, 2024 at 10:26 AM David Steele wrote: > > Hackers, > > While testing pgAudit against PG17 I noticed the following behavioral > change: > > CREATE TABLE public.test > ( > id INT, > name TEXT, > description TEXT, > CONSTRAINT test_pkey PRIMARY KEY (id)

Re: POC: GROUP BY optimization

2024-04-28 Thread jian he
On Wed, Apr 24, 2024 at 2:25 PM jian he wrote: > > hi. > I found an interesting case. > > CREATE TABLE t1 AS > SELECT (i % 10)::numeric AS x,(i % 10)::int8 AS y,'abc' || i % 10 AS > z, i::int4 AS w > FROM generate_series(1, 100) AS i; > CREATE INDEX t1_x_y_idx

pg_input_error_info doc 2 exampled crammed together

2024-04-28 Thread jian he
hi. select * from pg_input_error_info('420', 'integer') select message, detail from pg_input_error_info('1234.567', 'numeric(7,4)') I found above two examples at [0] crammed together. select * from pg_input_error_info('420', 'integer')

add tab-complete for memory, serialize option and other minor issues.

2024-04-26 Thread jian he
-complete for memory, SERIALIZE option. From bec2c92ef61bb8272608a49e6837141e7e8346b3 Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 27 Apr 2024 10:33:16 +0800 Subject: [PATCH v1 1/1] add Tab-complete for EXPLAIN MEMORY, EXPLAIN SERIALIZE --- src/bin/psql/tab-complete.c | 6 -- 1 file changed

Re: minor error message inconsistency in make_pathkey_from_sortinfo

2024-04-25 Thread jian he
On Wed, Apr 24, 2024 at 5:47 PM Yugo NAGATA wrote: > > On Wed, 24 Apr 2024 15:05:00 +0800 > jian he wrote: > > > hi. > > > > in make_pathkey_from_sortinfo > > > > equality_op = get_opfamily_member(opfamily, > > opcintype, > > opcint

Re: POC: GROUP BY optimization

2024-04-24 Thread jian he
hi one more question (maybe a dumb one) drop table if exists t1; CREATE TABLE t1 AS SELECT (i % 10)::numeric AS x,(i % 10)::int8 AS y,'abc' || i % 10 AS z, i::int4 AS w FROM generate_series(1, 100) AS i; CREATE INDEX t1_x_y_idx ON t1 (x, y); ANALYZE t1; SET enable_hashagg = off; SET

minor error message inconsistency in make_pathkey_from_sortinfo

2024-04-24 Thread jian he
hi. in make_pathkey_from_sortinfo equality_op = get_opfamily_member(opfamily, opcintype, opcintype, BTEqualStrategyNumber); if (!OidIsValid(equality_op)) /* shouldn't happen */ elog(ERROR, "missing operator %d(%u,%u) in opfamily %u", BTEqualStrategyNumber, opcintype, opcintype, opfamily);

Re: POC: GROUP BY optimization

2024-04-24 Thread jian he
hi. I found an interesting case. CREATE TABLE t1 AS SELECT (i % 10)::numeric AS x,(i % 10)::int8 AS y,'abc' || i % 10 AS z, i::int4 AS w FROM generate_series(1, 100) AS i; CREATE INDEX t1_x_y_idx ON t1 (x, y); ANALYZE t1; SET enable_hashagg = off; SET enable_seqscan = off; EXPLAIN (COSTS

clamp_row_est avoid infinite

2024-04-22 Thread jian he
hi. /* * clamp_row_est * Force a row-count estimate to a sane value. */ double clamp_row_est(double nrows) { /* * Avoid infinite and NaN row estimates. Costs derived from such values * are going to be useless. Also force the estimate to be at least one * row, to make explain output look

Re: POC: GROUP BY optimization

2024-04-22 Thread jian he
On Fri, Apr 19, 2024 at 6:44 PM jian he wrote: > > On Thu, Apr 18, 2024 at 6:58 PM Alexander Korotkov > wrote: > > > > Thank you for the fixes you've proposed. I didn't look much into > > details yet, but I think the main concern Tom expressed in [1] is > >

slightly misleading Error message in guc.c

2024-04-22 Thread jian he
hi. minor issue in guc.c. set work_mem to '1kB'; ERROR: 1 kB is outside the valid range for parameter "work_mem" (64 .. 2147483647) should it be ERROR: 1 kB is outside the valid range for parameter "work_mem" (64 kB .. 2147483647 kB) ? since the units for work_mem are { "B", "kB", "MB", "GB",

Re: documentation structure

2024-04-19 Thread jian he
On Wed, Apr 17, 2024 at 7:07 PM Dagfinn Ilmari Mannsåker wrote: > > > > It'd also be quite useful if clients could render more of the documentation > > for functions. People are used to language servers providing full > > documentation for functions etc... > > A more user-friendly version of \df+

Re: POC: GROUP BY optimization

2024-04-19 Thread jian he
On Thu, Apr 18, 2024 at 6:58 PM Alexander Korotkov wrote: > > Thank you for the fixes you've proposed. I didn't look much into > details yet, but I think the main concern Tom expressed in [1] is > whether the feature is reasonable at all. I think at this stage the > most important thing is to

Re: documentation structure

2024-04-18 Thread jian he
On Thu, Apr 18, 2024 at 2:37 AM Dagfinn Ilmari Mannsåker wrote: > > Andres Freund writes: > > > Hi, > > > > On 2024-04-17 12:07:24 +0100, Dagfinn Ilmari Mannsåker wrote: > >> Andres Freund writes: > >> > I think the manual work for writing signatures in sgml is not > >> > insignificant, > >> >

Re: "backend process" confused with "server process"

2024-04-15 Thread jian he
On Mon, Apr 15, 2024 at 5:27 PM Daniel Gustafsson wrote: > > > On 15 Apr 2024, at 11:07, Andrey M. Borodin wrote: > >> On 15 Apr 2024, at 14:01, jian he wrote: > > >> "is not a PostgreSQL server process" is the same thing as "not a > >

"backend process" confused with "server process"

2024-04-15 Thread jian he
hi. pg_log_backend_memory_contexts we have ` if (proc == NULL) { /* * This is just a warning so a loop-through-resultset will not abort * if one backend terminated on its own during the run. */ ereport(WARNING, (errmsg("PID %d is not a PostgreSQL server process", pid))); PG_RETURN_BOOL(false); }

Re: sql/json remaining issue

2024-04-14 Thread jian he
uot;}', '$.a2' returning text DEFAULT '"foo1"'::text::json::text ON ERROR); we have `if (contain_var_clause(expr))` further check it, so it should be fine? From 124cd4245266343daecdb4294b2013d9ebdd6b24 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 15 Apr 2024 12:37:36 +0800 Sub

Re: documentation structure

2024-04-14 Thread jian he
On Wed, Mar 20, 2024 at 5:40 AM Andrew Dunstan wrote: > > > +many for improving the index. > > My own pet docs peeve is a purely editorial one: func.sgml is a 30k line > beast, and I think there's a good case for splitting out at least the larger > chunks of it. > I think I successfully

call ATPostAlterTypeParse inconsistency

2024-04-14 Thread jian he
hi. one minor issue. within ATPostAlterTypeCleanup, we call ATPostAlterTypeParse: ATPostAlterTypeParse(oldId, relid, InvalidOid, (char *) lfirst(def_item), wqueue, lockmode, tab->rewrite); function ATPostAlterTypeParse is: static void ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId,

Re: SQL:2011 application time

2024-04-14 Thread jian he
On Wed, Apr 3, 2024 at 1:30 PM Paul Jungwirth wrote: > > On 3/24/24 00:38, Peter Eisentraut wrote:> I have committed the patches > > v33-0001-Add-temporal-FOREIGN-KEYs.patch and > > v33-0002-Support-multiranges-in-temporal-FKs.patch > > (together). > > Hi Hackers, > > I found some problems with

Re: sql/json remaining issue

2024-04-13 Thread jian he
On Fri, Apr 12, 2024 at 5:44 PM Amit Langote wrote: > > > elog(ERROR, "unrecognized json wrapper %d", wrapper); > > should be > > elog(ERROR, "unrecognized json wrapper %d", (int) wrapper); > > Fixed in 0003. > the fix seems not in 0003? other than that, everything looks fine. SELECT * FROM

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

2024-04-13 Thread jian he
On Fri, Apr 12, 2024 at 5:06 PM jian he wrote: > > On Tue, Mar 26, 2024 at 1:00 PM jian he wrote: > > > > On Mon, Mar 25, 2024 at 2:47 PM Paul Jungwirth > > wrote: > > > > > > On 3/23/24 10:04, Paul Jungwirth wrote: > > > > Perhaps if the p

Re: Can't find not null constraint, but \d+ shows that

2024-04-12 Thread jian he
On Fri, Apr 12, 2024 at 3:52 PM Alvaro Herrera wrote: > > On 2024-Apr-12, jian he wrote: > > > Now I am more confused... > > > +CREATE TABLE notnull_tbl1 (c0 int, c1 int, PRIMARY KEY (c0, c1)); > > +ALTER TABLE notnull_tbl1 DROP c1; > > > same query,

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

2024-04-12 Thread jian he
On Tue, Mar 26, 2024 at 1:00 PM jian he wrote: > > On Mon, Mar 25, 2024 at 2:47 PM Paul Jungwirth > wrote: > > > > On 3/23/24 10:04, Paul Jungwirth wrote: > > > Perhaps if the previous collation was nondeterministic we should force a > > > re-chec

Re: Can't find not null constraint, but \d+ shows that

2024-04-11 Thread jian he
On Thu, Apr 11, 2024 at 10:48 PM Alvaro Herrera wrote: > > > I'm still not ready with this -- still not convinced about the new AT > pass. Also, I want to add a test for the pg_dump behavior, and there's > an XXX comment. > Now I am more confused... +-- make sure attnotnull is reset correctly

Re: session username in default psql prompt?

2024-04-11 Thread jian he
On Tue, Mar 26, 2024 at 7:14 AM Andrew Dunstan wrote: > > > > On Mon, Mar 25, 2024 at 9:14 AM Jelte Fennema-Nio wrote: >> >> On Mon, 25 Mar 2024 at 14:06, Robert Haas wrote: >> > On Mon, Mar 25, 2024 at 4:30 AM Jelte Fennema-Nio >> > wrote: >> > > That problem seems easy to address by adding

Re: Can't find not null constraint, but \d+ shows that

2024-04-11 Thread jian he
On Thu, Apr 11, 2024 at 3:19 PM Tender Wang wrote: > >> +DROP TABLE notnull_tbl1; >> +-- make sure attnotnull is reset correctly when a PK is dropped indirectly >> +CREATE TABLE notnull_tbl1 (c0 int, c1 int, PRIMARY KEY (c0, c1)); >> +ALTER TABLE notnull_tbl1 DROP c1; >> +\d+ notnull_tbl1 >> +

Re: Can't find not null constraint, but \d+ shows that

2024-04-11 Thread jian he
On Wed, Apr 10, 2024 at 2:10 PM jian he wrote: > > DROP TABLE if exists notnull_tbl2; > CREATE TABLE notnull_tbl2 (c0 int generated by default as IDENTITY, c1 int); > ALTER TABLE notnull_tbl2 ADD CONSTRAINT Q PRIMARY KEY(c0, c1); > ALTER TABLE notnull_tbl2 DROP CONSTRAINT notnull_t

Re: sql/json remaining issue

2024-04-10 Thread jian he
On Wed, Apr 10, 2024 at 4:39 PM Amit Langote wrote: > > > Attached is a bit more polished version of that, which also addresses > the error messages in JsonPathQuery() and JsonPathValue(). I noticed > that there was comment I had written at one point during JSON_TABLE() > hacking that said that

Re: Can't find not null constraint, but \d+ shows that

2024-04-10 Thread jian he
On Wed, Apr 10, 2024 at 7:01 PM Alvaro Herrera wrote: > > On 2024-Apr-10, jian he wrote: > > > another related bug, in master. > > > > drop table if exists notnull_tbl1; > > CREATE TABLE notnull_tbl1 (c0 int not null, c1 int); > > ALTER TABLE notnull_t

Re: Can't find not null constraint, but \d+ shows that

2024-04-10 Thread jian he
another related bug, in master. drop table if exists notnull_tbl1; CREATE TABLE notnull_tbl1 (c0 int not null, c1 int); ALTER TABLE notnull_tbl1 ADD CONSTRAINT Q PRIMARY KEY(c0, c1); \d+ notnull_tbl1 ALTER TABLE notnull_tbl1 ALTER c0 DROP NOT NULL; ALTER TABLE notnull_tbl1 ALTER c1 DROP NOT NULL;

Re: Can't find not null constraint, but \d+ shows that

2024-04-10 Thread jian he
On Wed, Apr 10, 2024 at 1:29 AM Alvaro Herrera wrote: > > On 2024-Mar-29, Tender Wang wrote: > > > I think aboved case can explain what's meaning about comments in > > dropconstraint_internal. > > But here, in RemoveConstraintById() , we only care about primary key case, > > so NOT NULL is better

sql/json remaining issue

2024-04-09 Thread jian he
hi. ` | NESTED [ PATH ] json_path_specification [ AS json_path_name ] COLUMNS ( json_table_column [, ...] ) NESTED [ PATH ] json_path_specification [ AS json_path_name ] COLUMNS ( json_table_column [, ...] ) ` "json_path_specification" should be "path_expression"?

Re: remaining sql/json patches

2024-04-07 Thread jian he
On Mon, Apr 8, 2024 at 11:21 AM jian he wrote: > > On Mon, Apr 8, 2024 at 12:34 AM jian he wrote: > > > > On Sun, Apr 7, 2024 at 9:36 PM Amit Langote wrote: > > > 0002 needs an expanded commit message but I've run out of energy today. > > > > > other

Re: remaining sql/json patches

2024-04-07 Thread jian he
On Mon, Apr 8, 2024 at 12:34 AM jian he wrote: > > On Sun, Apr 7, 2024 at 9:36 PM Amit Langote wrote: > > 0002 needs an expanded commit message but I've run out of energy today. > > > +/* + * Fetch next row from a JsonTablePlan's path evaluation result and from + * an

Re: remaining sql/json patches

2024-04-07 Thread jian he
On Sun, Apr 7, 2024 at 9:36 PM Amit Langote wrote: > > > 0002 needs an expanded commit message but I've run out of energy today. > some cosmetic issues in v51, 0002. in struct JsonTablePathScan, /* ERROR/EMPTY ON ERROR behavior */ bool errorOnError; the comments seem not right. I think

Re: remaining sql/json patches

2024-04-07 Thread jian he
On Sun, Apr 7, 2024 at 12:30 PM jian he wrote: > > other than that, it looks good to me. while looking at it again. + | NESTED path_opt Sconst + COLUMNS '(' json_table_column_definition_list ')' + { + JsonTableColumn *n = makeNode(JsonTableColumn); + + n->coltype = JTC_NESTED; + n-

Re: remaining sql/json patches

2024-04-06 Thread jian he
hi. about v50. +/* + * JsonTableSiblingJoin - + * Plan to union-join rows of nested paths of the same level + */ +typedef struct JsonTableSiblingJoin +{ + JsonTablePlan plan; + + JsonTablePlan *lplan; + JsonTablePlan *rplan; +} JsonTableSiblingJoin; "Plan to union-join rows of nested paths of the

Re: remaining sql/json patches

2024-04-06 Thread jian he
On Fri, Apr 5, 2024 at 8:35 PM Amit Langote wrote: > > On Thu, Apr 4, 2024 at 9:02 PM Amit Langote wrote: > > I'll post the rebased 0002 tomorrow after addressing your comments. > > Here's one. Main changes: > > * Fixed a bug in get_table_json_columns() which caused nested columns > to be

Re: remaining sql/json patches

2024-04-06 Thread jian he
On Sat, Apr 6, 2024 at 2:03 PM Amit Langote wrote: > > > > > * problem with type "char". the view def output is not the same as > > the select * from v1. > > > > create or replace view v1 as > > SELECT col FROM s, > > JSON_TABLE(jsonb '{"d": ["hello", "hello1"]}', '$' as c1 > > COLUMNS(col

Re: remaining sql/json patches

2024-04-05 Thread jian he
On Fri, Apr 5, 2024 at 8:35 PM Amit Langote wrote: > Here's one. Main changes: > > * Fixed a bug in get_table_json_columns() which caused nested columns > to be deparsed incorrectly, something Jian reported upthread. > * Simplified the algorithm in JsonTablePlanNextRow() > > I'll post another

Re: add function argument names to regex* functions.

2024-04-04 Thread jian he
On Wed, Apr 3, 2024 at 4:45 AM Tom Lane wrote: > > jian he writes: > > On Thu, Jan 18, 2024 at 4:17 PM Peter Eisentraut > > wrote: > >> Reading back through the discussion, I wasn't quite able to interpret > >> the resolution regarding Oracle compatibility.

Re: remaining sql/json patches

2024-04-04 Thread jian he
On Thu, Apr 4, 2024 at 3:50 PM jian he wrote: > > On Thu, Apr 4, 2024 at 2:41 PM jian he wrote: > > > > On Wed, Apr 3, 2024 at 8:39 PM Amit Langote wrote: > > > > > > Attached updated patches. I have addressed your doc comments on 0001, > > > b

Re: remaining sql/json patches

2024-04-04 Thread jian he
On Thu, Apr 4, 2024 at 2:41 PM jian he wrote: > > On Wed, Apr 3, 2024 at 8:39 PM Amit Langote wrote: > > > > Attached updated patches. I have addressed your doc comments on 0001, > > but not 0002 yet. > > > about v49, 0002. --tests setup. drop table if exists s

Re: remaining sql/json patches

2024-04-04 Thread jian he
On Wed, Apr 3, 2024 at 8:39 PM Amit Langote wrote: > > Attached updated patches. I have addressed your doc comments on 0001, > but not 0002 yet. > in v49, 0002. +\sv jsonb_table_view1 +CREATE OR REPLACE VIEW public.jsonb_table_view1 AS + SELECT id, +a1, +b1, +a11, +a21, +a22

Re: remaining sql/json patches

2024-04-03 Thread jian he
hi. + + json_table is an SQL/JSON function which + queries JSON data + and presents the results as a relational view, which can be accessed as a + regular SQL table. You can only use json_table inside the + FROM clause of a SELECT, + UPDATE, DELETE, or MERGE + statement. + the

Re: remaining sql/json patches

2024-04-03 Thread jian he
On Wed, Apr 3, 2024 at 3:15 PM jian he wrote: > > On Wed, Apr 3, 2024 at 11:30 AM jian he wrote: > > > > On Tue, Apr 2, 2024 at 9:57 PM Amit Langote wrote: > > > > > > Please let me know if you have further comments on 0001. I'd like to > > > ge

Re: remaining sql/json patches

2024-04-03 Thread jian he
On Wed, Apr 3, 2024 at 11:30 AM jian he wrote: > > On Tue, Apr 2, 2024 at 9:57 PM Amit Langote wrote: > > > > Please let me know if you have further comments on 0001. I'd like to > > get that in before spending more energy on 0002. > > -- a/src/backend/parser/pa

Re: remaining sql/json patches

2024-04-02 Thread jian he
On Tue, Apr 2, 2024 at 9:57 PM Amit Langote wrote: > > Please let me know if you have further comments on 0001. I'd like to > get that in before spending more energy on 0002. > hi. some issues with the doc. i think, some of the "path expression" can be replaced by "path_expression". maybe not

Re: remaining sql/json patches

2024-04-02 Thread jian he
On Fri, Mar 22, 2024 at 12:08 AM Amit Langote wrote: > > On Wed, Mar 20, 2024 at 9:53 PM Amit Langote wrote: > > I'll push 0001 tomorrow. > > Pushed that one. Here's the remaining JSON_TABLE() patch. > I know v45 is very different from v47. but v45 contains all the remaining features to be

Re: remaining sql/json patches

2024-04-02 Thread jian he
hi. +/* + * Recursively transform child JSON_TABLE plan. + * + * Default plan is transformed into a cross/union join of its nested columns. + * Simple and outer/inner plans are transformed into a JsonTablePlan by + * finding and transforming corresponding nested column. + * Sibling plans are

Re: Emitting JSON to file using COPY TO

2024-04-01 Thread jian he
On Sat, Mar 9, 2024 at 9:13 AM jian he wrote: > > On Sat, Mar 9, 2024 at 2:03 AM Joe Conway wrote: > > > > On 3/8/24 12:28, Andrey M. Borodin wrote: > > > Hello everyone! > > > > > > Thanks for working on this, really nice feature! > >

Re: remaining sql/json patches

2024-04-01 Thread jian he
On Mon, Apr 1, 2024 at 8:00 AM jian he wrote: > > +-- Should fail (JSON arguments are not passed to column paths) > +SELECT * > +FROM JSON_TABLE( > + jsonb '[1,2,3]', > + '$[*] ? (@ < $x)' > + PASSING 10 AS x > + COLUMNS (y text FORMAT JSON PATH '$ ? (@ < $x)') >

Re: remaining sql/json patches

2024-03-31 Thread jian he
typedef struct JsonTableExecContext { int magic; JsonTablePlanState *rootplanstate; JsonTablePlanState **colexprplans; } JsonTableExecContext; imho, this kind of naming is kind of inconsistent. "state" and "plan" are mixed together. maybe typedef struct JsonTableExecContext { int magic;

Re: remaining sql/json patches

2024-03-31 Thread jian he
FAILED: src/interfaces/ecpg/test/sql/sqljson_jsontable.c /home/jian/postgres/buildtest6/src/interfaces/ecpg/preproc/ecpg --regression -I../../Desktop/pg_src/src6/postgres/src/interfaces/ecpg/test/sql -I../../Desktop/pg_src/src6/postgres/src/interfaces/ecpg/include/ -o

Re: Catalog domain not-null constraints

2024-03-31 Thread jian he
On Tue, Mar 26, 2024 at 2:28 AM Dean Rasheed wrote: > > On Fri, 22 Mar 2024 at 08:28, jian he wrote: > > > > On Thu, Mar 21, 2024 at 7:23 PM Peter Eisentraut > > wrote: > > > > > > Hmm. CREATE DOMAIN uses column constraint syntax, but ALTER DOMAIN use

Re: remaining sql/json patches

2024-03-29 Thread jian he
On Fri, Mar 29, 2024 at 11:20 AM jian he wrote: > > > + > +JSON_TABLE ( > +context_item, > path_expression AS > json_path_name > PASSING { value AS > varname } , ... > > +COLUMNS ( class="parameter">json_table_column , > ... ) >

Re: Can't find not null constraint, but \d+ shows that

2024-03-29 Thread jian he
hi. about v4, i think, i understand the changes you made. RemoveConstraintById(Oid conId) will drop a single constraint record. if the constraint is primary key, then primary key associated attnotnull should set to false. but sometimes it shouldn't. for example: drop table if exists t2; CREATE

Re: remaining sql/json patches

2024-03-28 Thread jian he
On Thu, Mar 28, 2024 at 1:23 PM Amit Langote wrote: > > On Wed, Mar 27, 2024 at 1:34 PM Amit Langote wrote: > > On Wed, Mar 27, 2024 at 12:42 PM jian he > > wrote: > > > hi. > > > I don't fully understand all the code in json_table patch. > > &g

Re: Can't find not null constraint, but \d+ shows that

2024-03-27 Thread jian he
On Wed, Mar 27, 2024 at 10:26 PM Tender Wang wrote: > > Alvaro Herrera 于2024年3月26日周二 23:25写道: >> >> On 2024-Mar-26, Tender Wang wrote: >> >> > postgres=# CREATE TABLE t1(c0 int, c1 int); >> > postgres=# ALTER TABLE t1 ADD CONSTRAINT Q PRIMARY KEY(c0, c1); >> > postgres=# ALTER TABLE t1 DROP

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

2024-03-27 Thread jian he
On Thu, Mar 21, 2024 at 10:34 AM jian he wrote: > > On Mon, Mar 18, 2024 at 11:43 PM Tom Lane wrote: > > > > Alexander Korotkov writes: > > > On Mon, Mar 18, 2024 at 2:01 AM jian he > > > wrote: > > >> ` > > >> Datum >

Re: remaining sql/json patches

2024-03-26 Thread jian he
On Tue, Mar 26, 2024 at 6:16 PM jian he wrote: > > On Fri, Mar 22, 2024 at 12:08 AM Amit Langote wrote: > > > > On Wed, Mar 20, 2024 at 9:53 PM Amit Langote > > wrote: > > > I'll push 0001 tomorrow. > > > > Pushed that one. Here's the remaini

Re: remaining sql/json patches

2024-03-26 Thread jian he
On Fri, Mar 22, 2024 at 12:08 AM Amit Langote wrote: > > On Wed, Mar 20, 2024 at 9:53 PM Amit Langote wrote: > > I'll push 0001 tomorrow. > > Pushed that one. Here's the remaining JSON_TABLE() patch. > hi. minor issues i found json_table patch. + if (!IsA($5, A_Const) || + castNode(A_Const,

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

2024-03-25 Thread jian he
On Mon, Mar 25, 2024 at 2:47 PM Paul Jungwirth wrote: > > On 3/23/24 10:04, Paul Jungwirth wrote: > > Perhaps if the previous collation was nondeterministic we should force a > > re-check. > > Here is a patch implementing this. It was a bit more fuss than I expected, so > maybe someone has a >

Re: SQL:2011 application time

2024-03-25 Thread jian he
On Sun, Mar 24, 2024 at 1:42 AM Paul Jungwirth wrote: > > v33 attached with minor changes. > > Okay, added those tests too. Thanks! > > Rebased to 697f8d266c. > hi. minor issues I found in v33-0003. there are 29 of {check_amproc_signature?.*false} only one

Re: session username in default psql prompt?

2024-03-25 Thread jian he
On Mon, Mar 25, 2024 at 6:32 PM Jelte Fennema-Nio wrote: > > Obviously I meant to put the \n before the %: > \set PROMPT1 '%n@%~%R\n%# ' > transaction related information lost. for example: jian@src6= # begin; BEGIN jian@src6= # select 1/0; 2024-03-25 18:37:59.313 CST [15252] ERROR: division

  1   2   3   4   5   >