Re: add function argument names to regex* functions.

2024-01-10 Thread jian he
On Tue, Jan 9, 2024 at 8:52 AM Dian Fay wrote: > > On Mon Jan 8, 2024 at 9:26 AM EST, jian he wrote: > > On Mon, Jan 8, 2024 at 8:44 AM Dian Fay wrote: > > > The `regexp_replace` summary in table 9.10 is mismatched and still > > > specifies the first parameter name

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

2024-01-10 Thread jian he
On Wed, Jan 10, 2024 at 8:00 AM jian he wrote: > > ` > from the doc, add sortsupport function will only influence index build time? > > +/* > + * GiST sortsupport comparator for ranges. > + * > + * Operates solely on the lower bounds of the ranges, comparing them usin

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

2024-01-10 Thread jian he
On Tue, Jan 9, 2024 at 10:36 PM torikoshia wrote: > > On Tue, Dec 19, 2023 at 10:14 AM Masahiko Sawada > wrote: > > If we want only such a feature we need to implement it together (the > > patch could be split, though). But if some parts of the feature are > > useful for users as well, I'd recomm

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-01-11 Thread jian he
Hi. + /* Log immediately if dictated by log_statement and XID assigned. */ + if (GetTopTransactionIdIfAny() != InvalidTransactionId && + check_log_statement(parsetree_list)) change to + /* Log immediately if dictated by log_statement and XID assigned. */ + if ( check_log_statement(parsetree_list)

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-01-11 Thread jian he
Hi another big difference compare to HEAD: select name,setting frompg_settings where name in ('auto_explain.log_timing','auto_explain.log_analyze', 'auto_explain.log_min_duration','log_statement','log_line_prefix') ; name | setti

Re: Compile warnings in dbcommands.c building with meson

2024-01-11 Thread jian he
On Fri, Jan 12, 2024 at 1:05 AM Magnus Hagander wrote: > > On Wed, Jan 10, 2024 at 1:16 PM Aleksander Alekseev > wrote: > > > > Hi, > > > > > When building current head on debian bullseye I get this compile warning: > > > > > > In file included from ../src/backend/commands/dbcommands.c:20: > > >

Re: Compile warnings in dbcommands.c building with meson

2024-01-12 Thread jian he
On Fri, Jan 12, 2024 at 8:03 PM Alvaro Herrera wrote: > > On 2024-Jan-12, jian he wrote: > > > I saw it sometimes, sometimes not. > > Now I think the reason is: > > it will appear when you do `-Dbuildtype=release`. > > > > but it will not occur when I

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

2024-01-13 Thread jian he
On Fri, Jan 12, 2024 at 10:59 AM torikoshia wrote: > > > Thanks for reviewing! > > Updated the patch merging your suggestions except below points: > > > + cstate->num_errors = 0; > > Since cstate is already initialized in below lines, this may be > redundant. > > | /* Allocate workspace and

Re: SQL:2011 application time

2024-01-13 Thread jian he
On Thu, Jan 11, 2024 at 10:44 PM Peter Eisentraut wrote: > > On 31.12.23 09:51, Paul Jungwirth wrote: > > On Wed, Dec 6, 2023 at 12:59 AM Peter Eisentraut > > wrote: > > > > > > On 02.12.23 19:41, Paul Jungwirth wrote: > > > > So what do you think of this idea instead?: > > > > > > > > We co

Re: Compile warnings in dbcommands.c building with meson

2024-01-14 Thread jian he
Hi. one more feedback. I tested the original repo setup, but it does not generate a warning on my local setup. meson setup --reconfigure ${BUILD} \ -Dprefix=${PG_PREFIX} \ -Dpgport=5463 \ -Dplpython=enabled \ -Dcassert=true \ -Dtap_tests=enabled \ -Dicu=enabled \ -Ddebug=true \ -Dnls=disabled

Re: Emitting JSON to file using COPY TO

2024-01-15 Thread jian he
On Tue, Jan 9, 2024 at 4:40 AM Joe Conway wrote: > > On 1/8/24 14:36, Dean Rasheed wrote: > > On Thu, 7 Dec 2023 at 01:10, Joe Conway wrote: > >> > >> The attached should fix the CopyOut response to say one column. > >> > > > > Playing around with this, I found a couple of cases that generate an

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

2024-01-15 Thread jian he
ybe we don't need the variable should_free, if (newtuple != oldtuple) then we should free oldtuple and newtuple, because the content is already in the slot. Anyway, based on your patch, I modified it, also added a slightly more complicated test. From 5f41738b3c7dc7bf3d849539d16a568b52cedc55 Mon

Re: Emitting JSON to file using COPY TO

2024-01-15 Thread jian he
On Tue, Jan 16, 2024 at 11:46 AM jian he wrote: > > > I think the reason is maybe related to the function copy_dest_startup. I was wrong about this sentence. in the function CopyOneRowTo `if (!cstate->opts.json_mode)` else branch change to the following: else { Datum rowdata; Strin

sql-merge.html Compatibility section, typo.

2024-01-16 Thread jian he
hi. https://www.postgresql.org/docs/current/sql-merge.html Compatibility section: "WITH clause" should be WITH clause

Re: [PATCH] Add support function for containment operators

2024-01-16 Thread jian he
On Wed, Jan 17, 2024 at 5:46 AM Tom Lane wrote: > > But perhaps someone has an argument for a different rule? > > Anyway, pending discussion of that point, I think the code is good > to go. I don't like the test cases much though: they expend many more > cycles than necessary. You could prove th

Re: MERGE ... RETURNING

2024-01-17 Thread jian he
On Sat, Nov 18, 2023 at 8:55 PM Dean Rasheed wrote: > > The v13 patch still applies on top of this, so I won't re-post it. > Hi. minor issues based on v13. + +MERGING ( property ) + + The following are valid property values specifying what to return: + + + + ACTION + + +

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

2024-01-17 Thread jian he
On Thu, Jan 18, 2024 at 8:57 AM Masahiko Sawada wrote: > > On Thu, Jan 18, 2024 at 6:38 AM Tom Lane wrote: > > > > Alexander Korotkov writes: > > > On Wed, Jan 17, 2024 at 9:49 AM Kyotaro Horiguchi > > > wrote: > > >> On the other hand, SAVE_ERROR_TO takes 'error' or 'none', which > > >> indica

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

2024-01-18 Thread jian he
Hi. patch refactored based on "on_error {stop|ignore}" doc changes: --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -43,7 +43,7 @@ COPY { table_name [ ( column_name [, ...] ) | * } FORCE_NOT_NULL { ( column_name [, ...] ) | * } FORCE_NULL { ( column_name [, ...] ) |

Re: remaining sql/json patches

2024-01-19 Thread jian he
play with domain types. in ExecEvalJsonCoercion, seems func json_populate_type cannot cope with domain type. tests: drop domain test; create domain test as int[] check ( array_length(value,1) =2 and (value[1] = 1 or value[2] = 2)); SELECT * from JSON_QUERY(jsonb'{"rec": "{1,2,3}"}', '$.rec' return

Re: add function argument names to regex* functions.

2024-01-19 Thread jian he
On Thu, Jan 18, 2024 at 4:17 PM Peter Eisentraut wrote: > > On 10.01.24 15:18, jian he wrote: > > I put the changes into the new patch. > > Reading back through the discussion, I wasn't quite able to interpret > the resolution regarding Oracle compatibility. From the

Re: add function argument names to regex* functions.

2024-01-19 Thread jian he
On Sat, Jan 20, 2024 at 10:55 AM jian he wrote: > > > another regex* function argument changes: from "N" to "occurences", example: > + If occurrence is specified > + then the occurrence'th match of the pattern > + is located, > &

Re: remaining sql/json patches

2024-01-21 Thread jian he
based on v35. Now I only applied from 0001 to 0007. For {DEFAULT expression ON EMPTY} | {DEFAULT expression ON ERROR} restrict DEFAULT expression be either Const node or FuncExpr node. so these 3 SQL/JSON functions can be used in the btree expression index. I made some big changes on the doc. (s

Re: remaining sql/json patches

2024-01-21 Thread jian he
I found two main issues regarding cocece SQL/JSON function output to other data types. * returning typmod influence the returning result of JSON_VALUE | JSON_QUERY. * JSON_VALUE | JSON_QUERY handles returning type domains allowing null and not allowing null inconsistencies. in ExecInitJsonExprCoer

Re: Implement missing join selectivity estimation for range types

2024-01-22 Thread jian he
I cannot figure out why it aborts. as Tom mentioned in upthread about the test cases. similar to src/test/regress/sql/stats_ext.sql check_estimated_rows function. we can test it by something: create or replace function check_estimated_rows(text) returns table (ok bool) language plpgsql as $$ decl

Re: remaining sql/json patches

2024-01-22 Thread jian he
On Mon, Jan 22, 2024 at 10:28 PM Amit Langote wrote: > > > based on v35. > > Now I only applied from 0001 to 0007. > > For {DEFAULT expression ON EMPTY} | {DEFAULT expression ON ERROR} > > restrict DEFAULT expression be either Const node or FuncExpr node. > > so these 3 SQL/JSON functions can be

Re: Emitting JSON to file using COPY TO

2024-01-22 Thread jian he
csv, force_array false); ERROR: specify COPY FORCE_ARRAY is only allowed in JSON mode. If copy to table then call table_scan_getnextslot no need to worry about the Tupdesc. however if we copy a query output as format json, we may need to consider it. cstate->queryDesc->tupDesc is the

Re: remaining sql/json patches

2024-01-23 Thread jian he
On Mon, Jan 22, 2024 at 11:46 PM jian he wrote: > > On Mon, Jan 22, 2024 at 10:28 PM Amit Langote wrote: > > > > > based on v35. > > > Now I only applied from 0001 to 0007. > > > For {DEFAULT expression ON EMPTY} | {DEFAULT expression ON ERROR} > >

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-01-24 Thread jian he
On Wed, Jan 24, 2024 at 10:17 PM Sutou Kouhei wrote: > > I uploaded my benchmark script so that you can run the same > benchmark on your machine: > > https://gist.github.com/kou/be02e02e5072c91969469dbf137b5de5 > > Could anyone try the benchmark with master and master+0001? > sorry. I made a mist

Re: remaining sql/json patches

2024-01-25 Thread jian he
On 9.16.4. JSON_TABLE ` name type FORMAT JSON [ENCODING UTF8] [ PATH json_path_specification ] Inserts a composite SQL/JSON item into the output row ` i am not sure "Inserts a composite SQL/JSON item into the output row" I think it means, for any type's typecategory is TYPCATEGORY_STRING, if FORMAT

Re: remaining sql/json patches

2024-01-25 Thread jian he
On Thu, Jan 25, 2024 at 7:54 PM Amit Langote wrote: > > > > > The problem with returning comp_domain_with_typmod from json_value() > > seems to be that it's using a text-to-record CoerceViaIO expression > > picked from JsonExpr.item_coercions, which behaves differently than > > the expression tree

Re: Add new error_action COPY ON_ERROR "log"

2024-01-26 Thread jian he
On Fri, Jan 26, 2024 at 12:42 AM torikoshia wrote: > > Hi, > > As described in 9e2d870119, COPY ON_EEOR is expected to have more > "error_action". > (Note that option name was changed by b725b7eec) > > I'd like to have a new option "log", which skips soft errors and logs > information that should

Re: MERGE ... RETURNING

2024-01-28 Thread jian he
On Fri, Jan 19, 2024 at 1:44 AM Dean Rasheed wrote: > > > Thanks for reviewing. Updated patch attached. > > The wider question is whether people are happy with the overall > approach this patch now takes, and the new MERGING() function and > MergingFunc node. > one minor white space issue: git d

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

2024-01-28 Thread jian he
On Fri, Jan 26, 2024 at 11:09 PM David G. Johnston wrote: > > Hi, > > The option choice of "ignore" in the COPY ON_ERROR clause seems overly > generic. There would seem to be two relevant ways to ignore bad column input > data - drop the entire row or just set the column value to null. I can s

Re: SQL:2011 application time

2024-01-28 Thread jian he
I fixed your tests, some of your tests can be simplified, (mainly primary key constraint is unnecessary for the failed tests) also your foreign key patch test table, temporal_rng is created at line 141, and we use it at around line 320. it's hard to get the definition of temporal_rng. I drop the t

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

2024-01-29 Thread jian he
On Fri, Jan 26, 2024 at 8:42 AM Yugo NAGATA wrote: > > On Tue, 2 Jan 2024 08:00:00 +0800 > jian he wrote: > > > 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

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

2024-01-29 Thread jian he
On Tue, Jan 30, 2024 at 12:35 PM Yugo NAGATA wrote: > > > Sorry, I also attached a wrong file. > Attached is the correct one. I think you attached the wrong file again. also please name it as v4.

Re: MERGE ... RETURNING

2024-01-30 Thread jian he
I didn't find any issue with v15. no commit message in the patch, If a commit message is there, I can help proofread.

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

2024-01-30 Thread jian he
On Tue, Dec 5, 2023 at 6:55 PM Andrei Lepikhov wrote: > > Here is fresh version with the pg_dump.pl regex fixed. Now it must pass > buildfarm. +JumbleState * +JumbleExpr(Expr *expr, uint64 *queryId) +{ + JumbleState *jstate = NULL; + + Assert(queryId != NULL); + + jstate = (JumbleState *) palloc(

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

2024-01-30 Thread jian he
+/* + * Hash function that's compatible with guc_name_compare + */ +static uint32 +orclause_hash(const void *data, Size keysize) +{ + OrClauseGroupKey *key = (OrClauseGroupKey *) data; + uint64 hash; + + (void) JumbleExpr(key->expr, &hash); + hash += ((uint64) key->opno + (uint64) key->exprtype)

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

2024-01-31 Thread jian he
On Wed, Jan 31, 2024 at 10:55 AM jian he wrote: > > based on my understanding of > https://www.postgresql.org/docs/current/xoper-optimization.html#XOPER-COMMUTATOR > I think you need move commutator check right after the `if > (get_op_rettype(opno) != BOOLOID)` branch > I wa

Re: remaining sql/json patches

2024-01-31 Thread jian he
Hi. minor issues. I am wondering do we need add `pg_node_attr(query_jumble_ignore)` to some of our created structs in src/include/nodes/parsenodes.h in v39-0001-Add-SQL-JSON-query-functions.patch diff --git a/src/backend/parser/parse_jsontable.c b/src/backend/parser/parse_jsontable.c new file mode

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

2024-01-31 Thread jian he
On Wed, Jan 31, 2024 at 7:10 PM Alena Rybakina wrote: > > Hi, thank you for your review and interest in this subject. > > On 31.01.2024 13:15, jian he wrote: > > On Wed, Jan 31, 2024 at 10:55 AM jian he wrote: > > based on my understanding of > https://www.postgr

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

2024-02-01 Thread jian he
On Thu, Feb 1, 2024 at 12:45 PM Yugo NAGATA wrote: > > Here is a updated patch, v6. v6 patch looks good.

Re: SQL:2011 application time

2024-02-01 Thread jian he
On Mon, Jan 29, 2024 at 8:00 AM jian he wrote: > > I fixed your tests, some of your tests can be simplified, (mainly > primary key constraint is unnecessary for the failed tests) > also your foreign key patch test table, temporal_rng is created at > line 141, and we use it at

Re: Emitting JSON to file using COPY TO

2024-02-02 Thread jian he
On Wed, Jan 31, 2024 at 9:26 PM Alvaro Herrera wrote: > > On 2024-Jan-23, jian he wrote: > > > > + | FORMAT_LA copy_generic_opt_arg > > > + { > > > + $$ = makeDefElem("format", $2, @1); > > > +

Re: Emitting JSON to file using COPY TO

2024-02-02 Thread jian he
On Fri, Feb 2, 2024 at 5:48 PM Alvaro Herrera wrote: > > If you want the server to send this message when the JSON word is not in > quotes, I'm afraid that's not possible, due to the funny nature of the > FORMAT keyword when the JSON keyword appears after it. But why do you > care? If you use th

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

2024-02-02 Thread jian he
2 4 | {4} | NULL NULL | {5} | NULL From 19afa942af22fd3d2ed2436c6bc7ce02f00bb570 Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 3 Feb 2024 14:04:08 +0800 Subject: [PATCH v1 1/1] introduce copy on_error 'null' option on_error 'null', null needs single quoted. any data type conversion error will trea

on_error table, saving error info to a table

2024-02-02 Thread jian he
--+--- userid | 10 copy_tbl| 17920 filename| STDIN lineno | 1 line| 1,2,a colname | c raw_field_value | a err_message | invalid input syntax for type integer: "a" err_detail | errorcode | 22P

Re: Should we remove -Wdeclaration-after-statement?

2024-02-03 Thread jian he
On Mon, Jan 29, 2024 at 11:04 PM Jelte Fennema-Nio wrote: > > I feel like this is the type of change where there's not much > discussion to be had. And the only way to resolve it is to use some > voting to gauge community opinion. > > So my suggestion is for people to respond with -1, -0.5, +-0, +

Re: [PATCH] ltree hash functions

2024-02-04 Thread jian he
On Thu, Feb 1, 2024 at 11:11 PM vignesh C wrote: > > On Wed, 6 Dec 2023 at 04:08, Tommy Pavlicek wrote: > > > > Thanks. > > > > I've attached the latest version that updates the naming in line with > > the convention. > > > > On Mon, Dec 4

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

2024-02-04 Thread jian he
On Mon, Feb 5, 2024 at 10:29 AM torikoshia wrote: > > Hi, > > On 2024-02-03 15:22, jian he wrote: > > The idea of on_error is to tolerate errors, I think. > > if a column has a not null constraint, let it cannot be used with > > (on_error 'null') > &

Re: remaining sql/json patches

2024-02-05 Thread jian he
based on this query: begin; SET LOCAL TIME ZONE 10.5; with cte(s) as (select jsonb '"2023-08-15 12:34:56 +05:30"') select JSON_QUERY(s, '$.timestamp_tz()')::text,'+10.5'::text, 'timestamp_tz'::text from cte union all select JSON_QUERY(s, '$.time()')::text,'+10.5'::text, 'time'::text from cte union

recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability

2024-02-05 Thread jian he
Hi. this commit [0] changes immutability of jsonb_path_query, jsonb_path_query_first? If so, it may change other functions also. demo: begin; SET LOCAL TIME ZONE 10.5; with cte(s) as (select jsonb '"2023-08-15 12:34:56 +05:30"') select jsonb_path_query(s, '$.timestamp_tz()')::text,'+10.5'::text,

Re: remaining sql/json patches

2024-02-05 Thread jian he
On Thu, Jan 25, 2024 at 10:39 PM jian he wrote: > > On Thu, Jan 25, 2024 at 7:54 PM Amit Langote wrote: > > > > > > > > The problem with returning comp_domain_with_typmod from json_value() > > > seems to be that it's using a text-to-rec

Re: 2024-02-08 release announcement draft

2024-02-06 Thread jian he
On Tue, Feb 6, 2024 at 12:43 PM Jonathan S. Katz wrote: > > Hi, > > Attached is a draft of the 2024-02-08 release announcement. Please > review for accuracy and notable omissions. > > Please provide any feedback no later than 2024-02-08 12:00 UTC (and > preferably sooner). > * In PL/pgSQL, suppor

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

2024-02-06 Thread jian he
On Tue, Feb 6, 2024 at 3:46 PM Yugo NAGATA wrote: > > On Tue, 06 Feb 2024 09:39:09 +0900 (JST) > Kyotaro Horiguchi wrote: > > > At Mon, 5 Feb 2024 17:22:56 +0900, Yugo NAGATA wrote > > in > > > On Mon, 05 Feb 2024 11:28:59 +0900 > > > torikoshia wrote: > > > > > > > > Based on this, I've made

Re: clarify equalTupleDescs()

2024-02-06 Thread jian he
On Tue, Feb 6, 2024 at 8:59 PM Peter Eisentraut wrote: > > In a recent patch thread it was discussed[0] which fields should be > compared by equalTupleDescs() and whether it is ok to remove a field > from tuple descriptors and how that should affect their equality > (attstattarget in that case). >

Re: cataloguing NOT NULL constraints

2024-02-07 Thread jian he
On Mon, Feb 5, 2024 at 5:51 PM Alvaro Herrera wrote: > > On 2024-Feb-05, Alvaro Herrera wrote: > > > Hmm, let me have a look, I can probably get this one fixed today before > > embarking on a larger fix elsewhere in the same feature. > > You know what -- this missing CCI has a much more visible im

Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability

2024-02-07 Thread jian he
On Wed, Feb 7, 2024 at 7:36 PM Jeevan Chalke wrote: > Added checkTimezoneIsUsedForCast() check where ever we are casting timezoned > to non-timezoned types and vice-versa. https://www.postgresql.org/docs/devel/functions-json.html above Table 9.51. jsonpath Filter Expression Elements, the Note se

Re: pg_stat_advisor extension

2024-02-07 Thread jian he
On Tue, Feb 6, 2024 at 12:06 AM Ilia Evdokimov wrote: > > Hi hackers, > > I'm reaching out again regarding the patch with new extension > 'pg_stat_advisor' aimed at enhancing query plan efficiency through the > suggestion of creating statistics. > > I understand the community is busy, but I woul

Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability

2024-02-08 Thread jian he
On Thu, Feb 8, 2024 at 1:27 PM Jeevan Chalke wrote: > > > > On Wed, Feb 7, 2024 at 9:13 PM jian he wrote: >> >> On Wed, Feb 7, 2024 at 7:36 PM Jeevan Chalke >> wrote: >> > Added checkTimezoneIsUsedForCast() check where ever we are casting >> >

Re: Catalog domain not-null constraints

2024-02-08 Thread jian he
On Wed, Feb 7, 2024 at 4:11 PM Peter Eisentraut wrote: > > > > > Interesting. I couldn't reproduce this locally, even across different > > operating systems. The cfbot failures appear to be sporadic, but also > > happening across multiple systems, so it's clearly not just a local > > environment

Re: 2024-02-08 release announcement draft

2024-02-08 Thread jian he
On Thu, Feb 8, 2024 at 1:17 PM Tom Lane wrote: > > "Jonathan S. Katz" writes: > > On 2/6/24 3:19 AM, jian he wrote: > >> On Tue, Feb 6, 2024 at 12:43 PM Jonathan S. Katz > >> wrote: > >>> * In PL/pgSQL, support SQL commands that are `CREATE

Re: remaining sql/json patches

2024-03-14 Thread jian he
one more question... SELECT JSON_value(NULL::int, '$' returning int); ERROR: cannot use non-string types with implicit FORMAT JSON clause LINE 1: SELECT JSON_value(NULL::int, '$' returning int); ^ SELECT JSON_query(NULL::int, '$' returning int); ERROR: cannot use no

Re: remaining sql/json patches

2024-03-15 Thread jian he
On Mon, Mar 11, 2024 at 11:30 AM jian he wrote: > > On Sun, Mar 10, 2024 at 10:57 PM jian he wrote: > > > > one more issue. > > Hi > one more documentation issue. > after applied V42, 0001 to 0003, > there are 11 appearance of `FORMAT JSON` in functions-jso

Re: SQL:2011 application time

2024-03-17 Thread jian he
Hi, minor issues from 1 to 0005. + + referencedagg + aggregates referenced rows' WITHOUT OVERLAPS +part + 13 + comparing with surrounding items, maybe need to add `(optional)`? I think the explanation is not good as explained in referencedagg entry below:

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

2024-03-17 Thread jian he
the data type of the argument just like pg_typeof(). If there's a chain of domain dependencies, it will recurse until finding the base type. also, I think this way, we only do one syscache lookup. From d50593e7a25f3e5f05139597d7be14f9dbfe48b9 Mon Sep 17 00:00:00 2001 From: jian

Re: SQL:2011 application time

2024-03-17 Thread jian he
one more minor issue related to error reporting. I've only applied v28, 0001 to 0005. -- (parent_id, valid_at) REFERENCES [implicit] -- FOREIGN KEY part should specify PERIOD CREATE TABLE temporal_fk_rng2rng ( id int4range, valid_at daterange, parent_id int4range, CONSTRAINT temporal_fk_rng2rng_pk

Re: Improve readability by using designated initializers when possible

2024-03-18 Thread jian he
On Mon, Mar 18, 2024 at 3:09 PM Peter Eisentraut wrote: > > On 14.03.24 01:26, Michael Paquier wrote: > > -EventTriggerSupportsObjectClass(ObjectClass objclass) > > +EventTriggerSupportsObject(const ObjectAddress *object) > > > > The shortcut introduced here is interesting, but it is inconsistent.

Re: Improve readability by using designated initializers when possible

2024-03-18 Thread jian he
On Mon, Mar 18, 2024 at 6:01 PM jian he wrote: > > On Mon, Mar 18, 2024 at 3:09 PM Peter Eisentraut wrote: > > > > On 14.03.24 01:26, Michael Paquier wrote: > > > -EventTriggerSupportsObjectClass(ObjectClass objclass) > > > +EventTriggerSupportsObject(const Ob

doc issues in event-trigger-matrix.html

2024-03-18 Thread jian he
hi. I think the "X" and "-" mean in this matrix [0] is not very intuitive. mainly because "X" tends to mean negative things in most cases. we can write a sentence saying "X" means this, "-" means that. or maybe Check mark [1] and Cross mark [2] are more universal. and we can use these marks. "O

Re: SQL:2011 application time

2024-03-19 Thread jian he
On Tue, Mar 19, 2024 at 6:49 AM Paul Jungwirth wrote: > > Rebased to 846311051e. > Hi, I just found out some minor issues. + * types matching the PERIOD element. periodprocoid is a GiST support function to + * aggregate multiple PERIOD element values into a single value + * (whose return type ne

Re: Catalog domain not-null constraints

2024-03-19 Thread jian he
create domain connotnull integer; create table domconnotnulltest ( col1 connotnull , col2 connotnull ); alter domain connotnull add not null value; --- the above query does not work in pg16. ERROR: syntax error at or near "not". after applying the patch, now this works. thi

Re: remaining sql/json patches

2024-03-19 Thread jian he
On Tue, Mar 19, 2024 at 6:46 PM Amit Langote wrote: > > I intend to commit 0001+0002 after a bit more polishing. > V43 is far more intuitive! thanks! if (isnull || (exprType(expr) == JSONBOID && btype == default_behavior)) coerce = true; else coerced_expr = coerce_to_target_type(pstate, expr, ex

Re: remaining sql/json patches

2024-03-19 Thread jian he
minor issues I found while looking through it. other than these issues, looks good! /* * Convert the a given JsonbValue to its C string representation * * Returns the string as a Datum setting *resnull if the JsonbValue is a * a jbvNull. */ static char * ExecGetJsonValueItemString(JsonbValue

Re: SQL:2011 application time

2024-03-20 Thread jian he
hi. minor cosmetic issues, other than that, looks good. *pk_period = (indexStruct->indisexclusion); to *pk_period = indexStruct->indisexclusion; if (with_period) { if (!fkconstraint->fk_with_period) ereport(ERROR, (errcode(ERRCODE_INVALID_FOREIGN_KEY), errmsg("foreign key uses PERIOD on the refe

Re: remaining sql/json patches

2024-03-20 Thread jian he
looking at documentation again. one very minor question (issue) + +The ON EMPTY clause specifies the behavior if the +path_expression yields no value at all; the +default when ON EMPTY is not specified is to return +a null value. + I think it should b

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

2024-03-20 Thread jian he
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 > >> pg_basetype(PG_FUNCTION_ARGS) > >> { > >> Oid oid; > >> > >>

Re: SQL:2011 application time

2024-03-21 Thread jian he
with foreign key "no action", in a transaction, we can first insert foreign key data, then primary key data. also the update/delete can fail at the end of transaction. based on [1] explanation about the difference between "no action" and "restrict". I only refactor the v31-0002-Support-multiranges

Re: doc issues in event-trigger-matrix.html

2024-03-21 Thread jian he
On Fri, Mar 22, 2024 at 5:47 AM Peter Eisentraut wrote: > > On 19.03.24 10:34, Daniel Gustafsson wrote: > >>> "Only for local objects" > >>> is there any reference explaining "local objects"? > >>> I think local object means objects that only affect one single database? > > That's a bigger problem

Re: SQL:2011 application time

2024-03-21 Thread jian he
On Fri, Mar 22, 2024 at 8:35 AM Paul Jungwirth wrote: > > Your patch had a lot of other noisy changes, e.g. > whitespace and reordering lines. If there are other things you intended to > add to the tests, can you > describe them? i think on update restrict, on delete restrict cannot be deferred,

Re: Catalog domain not-null constraints

2024-03-22 Thread jian he
On Thu, Mar 21, 2024 at 7:23 PM Peter Eisentraut wrote: > > On 20.03.24 12:22, Dean Rasheed wrote: > > Hmm, for CHECK constraints, the ALTER DOMAIN syntax for adding a > > constraint is the same as for CREATE DOMAIN, but that's not the case > > for NOT NULL constraints. So, for example, these both

Re: SQL:2011 application time

2024-03-22 Thread jian he
On Fri, Mar 22, 2024 at 11:49 PM Peter Eisentraut wrote: > > On 22.03.24 01:35, Paul Jungwirth wrote: > > > 1. In ri_triggers.c ri_KeysEqual, you swap the order of arguments to > > ri_AttributesEqual(): > > > > > > - if (!ri_AttributesEqual(riinfo->ff_eq_oprs[i], > > RIAttType(rel, at

Re: Adding OLD/NEW support to RETURNING

2024-03-24 Thread jian he
On Mon, Mar 18, 2024 at 6:48 PM Dean Rasheed wrote: > > On Tue, 12 Mar 2024 at 18:21, Dean Rasheed wrote: > > > > Updated version attached tidying up a couple of things and fixing another > > bug: > > > > Rebased version attached, on top of c649fa24a4 (MERGE ... RETURNING support). > hi, some

Re: Improve readability by using designated initializers when possible

2024-03-24 Thread jian he
looking through v4 again. v4 looks good to me.

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 by

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 {check_amproc_signature(procform->ampro

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

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, $5

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 t

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

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

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: 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-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 src/interfaces/ecpg/test/sql/s

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

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 

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

  1   2   3   4   5   6   7   8   9   10   >