Re: NOT ENFORCED constraint feature

2025-02-01 Thread jian he
hi. after applying the v11-0002 to v11-0006. there is a bug in ATExecAlterConstrRecurse, i think. in ATExecAlterConstrRecurse, after applying the patch, the code is if (currcon->condeferrable != cmdcon->deferrable || currcon->condeferred != cmdcon->initdeferred || currcon->conenforced !=

Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

2025-02-02 Thread jian he
hi. the following reviews based on v10-0001-Introduce-the-ability-to-set-index-visibility-us.patch. in src/test/regress/sql/create_index.sql seems there are no sql tests for "create index ... invisible"? VISIBLE Make the specified index visible. The index will be used fo

Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

2025-02-02 Thread jian he
hi. modules/test_ddl_deparse/test_ddl_deparse.so.p/test_ddl_deparse.c.o -c ../../Desktop/pg_src/src7/postgres/src/test/modules/test_ddl_deparse/test_ddl_deparse.c ../../Desktop/pg_src/src7/postgres/src/test/modules/test_ddl_deparse/test_ddl_deparse.c: In function ‘get_altertable_subcmdinfo’: .

Re: NOT ENFORCED constraint feature

2024-12-11 Thread jian he
On Tue, Dec 10, 2024 at 7:48 PM Amul Sul wrote: > > > > > static bool > > MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr, > > bool allow_merge, bool is_local, > > + bool is_enforced, > > bool is_initially_valid, > > bool is_no_inherit) > > { > > @@ -2729,12 +2738,

Re: Proposals for EXPLAIN: rename ANALYZE to EXECUTE and extend VERBOSE

2024-12-11 Thread jian he
do we also need to update doc/src/sgml/rules.sgml? https://www.postgresql.org/docs/current/rules-materializedviews.html

Re: Pass ParseState as down to utility functions.

2024-12-10 Thread jian he
add parser_errposition to some places in transformTableConstraint, transformColumnDefinition where v8 didn't. From b49e1b74b5d479b854599c0f9d6b6df1e61aa67c Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 10 Dec 2024 22:36:45 +0800 Subject: [PATCH v9 2/2] Print out error position for numb

Re: proposal: schema variables

2024-12-09 Thread jian he
hi. GRANT|REVOKE ALL VARIABLES IN SCHEMA schema_name [, ...] } seems to work. might be better to add tests. also src/bin/psql/tab-complete.in.c COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_grantables, we can also add "ALL VARIABLES IN SCHEMA " also need change this in grant.sgml: Th

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread jian he
On Thu, Dec 12, 2024 at 4:48 AM Tom Lane wrote: > > jian he writes: > > add parser_errposition to some places in > > transformTableConstraint, transformColumnDefinition > > where v8 didn't. > > I'm not loving the idea of cons'ing up ParseStates i

Re: not null constraints, again

2024-12-11 Thread jian he
On Wed, Dec 4, 2024 at 10:52 AM jian he wrote: > > hi. > > heap_create_with_catalog argument (cooked_constraints): > passed as NIL in function {create_toast_table, make_new_heap} > passed as list_concat(cookedDefaults,old_constraints) in DefineRelation > > in DefineRelati

Re: NOT ENFORCED constraint feature

2024-12-09 Thread jian he
hi. some minor issue about v7-0001. there are 5 appearances of "sizeof(CookedConstraint)" to make it safe, it would be nice to manual do ` cooked->is_enforced = true; ` for other kinds of constraints. static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr, bool a

Re: Virtual generated columns

2024-12-10 Thread jian he
On Fri, Nov 29, 2024 at 6:01 PM Peter Eisentraut wrote: > The purpose of check_modified_virtual_generated() for trigger functions > written in C. The prevent someone from inserting real values into the > trigger tuples, because they would then be processed by the rest of the > system, which would

Re: Pass ParseState as down to utility functions.

2024-12-11 Thread jian he
ftjq...@mail.gmail.com create domain d_fail as int constraint cc REFERENCES this_table_not_exists(i); like this command will fail, so we don't need to change create_domain.sgml synopsis section ? From 2f28cc9b4f605b981801a307e44de6cbc9f504e5 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu

Re: attndims, typndims still not enforced, but make the value within a sane threshold

2024-12-11 Thread jian he
hi. remove pg_type typndims column patch attached. From 656fc3bec597f65368a7bd1cdee183865d4070e7 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 12 Dec 2024 15:27:34 +0800 Subject: [PATCH v3 1/1] remove pg_type typndims discussion: https://postgr.es/m

Re: Pass ParseState as down to utility functions.

2024-12-16 Thread jian he
1h1p...@mail.gmail.com have extensive tests. From d3bd24b36868186c45183d2ae0bf7e8cc5720dfd Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 16 Dec 2024 16:11:30 +0800 Subject: [PATCH v12 1/3] add error position for ATPrepAlterColumnType: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cont

Re: Virtual generated columns

2024-12-16 Thread jian he
hi. some minor issues... SET EXPRESSION AS This form replaces the expression of a generated column. Existing data in the column is rewritten and all the future changes will apply the new generation expression. the second sentence seems not to ap

using index to speedup add not null constraints to a table

2024-12-15 Thread jian he
ss.pgh.pa.us [2] https://postgr.es/m/CA%2BTgmoa5NKz8iGW_9v7wz%3D-%2BzQFu%3DE4SZoaTaU1znLaEXRYp-Q%40mail.gmail.com [3] https://postgr.es/m/900056D1-32DF-4927-8251-3E0C0DC407FD%40anarazel.de From 476cee10531330fa8d83aa940c227deaaad8ab47 Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 16 Dec 2024 15:03:18 +080

Re: proposal: schema variables

2024-12-17 Thread jian he
hi. /* * has_session_variable_privilege variants *These are all named "has_session_variable_privilege" at the SQL level. *They take various combinations of variable name, variable OID, *user name, user OID, or implicit user = current_user. * *The result is a b

Re: New "single" COPY format

2024-12-18 Thread jian he
I have reviewed v21-0001 again. v21-0001-Introduce-CopyFormat-and-replace-csv_mode-and-binary.patch is a good refactor. overall looks good to me.

in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

2024-12-18 Thread jian he
hi. generally COPY TO``COPY table`` is faster than ``COPY (select * from table)``. in BeginCopyTo. we have """ else if (rel->rd_rel->relkind == RELKIND_MATVIEW) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot copy fro

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

2024-12-12 Thread jian he
ot allow null values From 47bdeda8911596950463e70e33253e773ef13192 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 13 Dec 2024 11:03:16 +0800 Subject: [PATCH v9 1/1] new COPY on_error option: set_to_null extent "on_error action", introduce new option: on_error set_to_null. due to c

Re: on_error table, saving error info to a table

2024-12-13 Thread jian he
y created table Oid, I think it somehow counts as repeating name lookups, see relevant linke [1], [2]. [1] https://postgr.es/m/20240808171351.a9.nmi...@google.com [2] https://postgr.es/m/CA+TgmobHYix=nn8d4ruha6fhuvpr88kgamq1pbfngfofejr...@mail.gmail.com From 4e38c800a7481c1a4fad1b6beb3c11dd24235001 Mon Sep

speedup COPY TO for partitioned table.

2024-12-19 Thread jian he
ndirection. The simple benchmark shows around 7.7% improvement in my local environment. local environment: PostgreSQL 18devel_debug_build_382092a0cd on x86_64-linux, compiled by gcc-14.1.0, 64-bit From ba2307cca8bd1d53e0febddaf11c932dae5d31e0 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 19 Dec

Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

2024-12-19 Thread jian he
On Fri, Dec 20, 2024 at 8:02 AM Michael Paquier wrote: > > On Thu, Dec 19, 2024 at 02:28:21PM +0800, jian he wrote: > > Since materialized views have physical storage, > > > > we can make materialized views also using COPY table_name, instead of > > COPY(query).

Re: Re: proposal: schema variables

2024-12-19 Thread jian he
hi. review is based on v20241219-0002-Storage-for-session-variables-and-SQL-interface.patch and v20241219-0001-Enhancing-catalog-for-support-session-variables-and-.patch. in doc/src/sgml/catalogs.sgml defaclobjtype char Type of object this entry is for: r = relation (table, view), S = sequenc

wrong comments in ClassifyUtilityCommandAsReadOnly

2024-12-20 Thread jian he
hi. /* * Determine the degree to which a utility command is read only. * * Note the definitions of the relevant flags in src/include/utility/tcop.h. */ static int ClassifyUtilityCommandAsReadOnly(Node *parsetree) Is the comment wrong? it should be " * Note the definitions of the relevant fla

Re: Proposal to use JSON for Postgres Parser format

2024-11-21 Thread jian he
On Tue, Dec 5, 2023 at 12:45 AM Matthias van de Meent wrote: > > On Mon, 31 Oct 2022 at 15:56, Michel Pelletier > wrote: > > On Mon, Oct 31, 2022 at 6:15 AM Matthias van de Meent > > wrote: > >> On Mon, 31 Oct 2022 at 13:46, Alexander Korotkov > >> wrote: > >>> On Fri, Oct 28, 2022 at 4:27 PM

Re: Remove useless GROUP BY columns considering unique index

2024-11-22 Thread jian he
que-not-null columns can be (a,b) (a,b,c) since (a,b) only has two columns, using (a,b) to remove other columns in the groupby expression. some tests are copied from Zhang Mingli. Code implementation is quite different. From 6b6689038de51fc7c56f710f9b613c1998ea2bd1 Mon Sep 17 00:00:00 2001 From: jian

Re: CREATE SCHEMA ... CREATE DOMAIN support

2024-11-22 Thread jian he
as text not null; i fixed these two issues, and add the above example as tests in src/test/regress/sql/create_schema.sql I didn't add a doc entry. I will do it later. From aa1d229544636453fddbb0ba01ddb12bd515f55e Mon Sep 17 00:00:00 2001 From: jian he Date: Sat, 23 Nov 2024 13:13:

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2024-12-06 Thread jian he
On Fri, Dec 6, 2024 at 10:48 PM Alvaro Herrera wrote: > > On 2024-Dec-06, jian he wrote: > > > basically processCASbits > > from > > processCASbits($3, @3, "NOT NULL") > > processCASbits($5, @5, "CHECK") > > to > > processCASbits($

Re: Virtual generated columns

2024-12-03 Thread jian he
On Fri, Nov 29, 2024 at 6:13 PM Peter Eisentraut wrote: > > - Added support for virtual columns in trigger column lists. (For that, > I renamed ExecInitStoredGenerated() to ExecInitGenerated(), which > handles the computation of ri_extraUpdatedCols.) > why not duplicate some code from ExecInitSt

CREATE TABLE NOT VALID for check and foreign key

2024-12-05 Thread jian he
hi. I found for foreign keys, check constraints, you specify it as NOT VALID, it will not be marked as NOT VALID in the CREATE TABLE statement. CREATE TABLE s6(id bigint , CONSTRAINT con1 check(id > 1) not valid); src2=# \d s6 Table "public.s6" Column | Type | Collation | Nullab

Re: proposal: schema variables

2024-12-06 Thread jian he
On Thu, Dec 5, 2024 at 2:52 PM Pavel Stehule wrote: > > Hi > > only rebase hi. disclaimer, i *only* applied v20241205-0001-Enhancing-catalog-for-support-session-variables-and-.patch. create variable v2 as text; alter variable v2 rename to v2; ERROR: session variable "v2" already exists in schem

Re: Non-text mode for pg_dumpall

2025-01-11 Thread jian he
hi. the following two tests, you can add to src/bin/pg_dump/t/001_basic.pl command_fails_like( [ 'pg_restore', '--globals-only', '-f', 'xxx' ], qr/\Qpg_restore: error: option -g\/--globals-only requires option -d\/--dbname\E/, 'pg_restore: error: option -g/--globals-only requires optio

Re: Re: proposal: schema variables

2025-01-08 Thread jian he
hi. you forgot change acldefault should add 'V' for SESSION VARIABLE in doc/src/sgml/ddl.sgml maybe some examples () of session variables being shadowed would be great. because doc/src/sgml/ref/create_variable.sgml said Session variables can be shadowed by other identifiers. For

Re: Virtual generated columns

2025-01-09 Thread jian he
On Thu, Jan 9, 2025 at 12:14 AM Peter Eisentraut wrote: > > Here is a new patch version where I have gathered various pieces of > feedback and improvement suggestions that are scattered over this > thread. I hope I got them all. I will respond to the respective > messages directly to give my res

using PGOPTIONS in meson

2025-01-08 Thread jian he
hi. i am wondering ways to do ``make check PGOPTIONS="-c debug_parallel_query=regress -c work_mem=50MB"`` in meson way, especially the PGOPTIONS part. I have looked at [1] and [2]. [1] https://www.postgresql.org/docs/current/regress-run.html#REGRESS-RUN-CUSTOM-SETTINGS [2] https://wiki.postgresql

Re: Non-text mode for pg_dumpall

2025-01-10 Thread jian he
in src/bin/pg_dump/pg_dumpall.c main i think you need do archDumpFormat = parseDumpFormat(formatName); /* * Open the output file if required, otherwise use stdout. If required, * then create new files with global.dat and map.dat names. */ if (archDumpFormat != archNull)

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

2025-01-09 Thread jian he
can skip progress reports for (on_error set_to_null) case. 2. The doc is not very great, I guess. 3. do we settled (on_error set_to_null) syntax. From 2f77abbb058c952715838d31b1e04f678a079e30 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 10 Jan 2025 14:33:55 +0800 Subject: [PATCH v10 1/1] ex

Re: Statistics Import and Export

2025-01-21 Thread jian he
On Tue, Jan 21, 2025 at 2:43 PM Corey Huinker wrote: > > > > On Mon, Jan 20, 2025 at 10:59 PM Corey Huinker > wrote: >>> >>> Are you saying that there is a path for a partitioned index to have >>> stats today? If so, we can just follow that locking protocol. If not, >>> I'm concerned about tryin

Re: Non-text mode for pg_dumpall

2025-01-20 Thread jian he
hi. $BIN10/pg_restore --globals-only --verbose --file=test.sql x.dump it will create a "test.sql" file, but it should create file test.sql (no double quotes). --<-- if (archDumpFormat != archNull && (!filename || strcmp(filename, "") == 0)) { pg_log_error("options -F/--for

Re: Non-text mode for pg_dumpall

2025-01-23 Thread jian he
hi. The four patches attached are to solve the TODO1: We need to think for --exclude-database=PATTERN for pg_restore. it is based on your v11_pg_dumpall-with-directory-tar-custom-format-21-jan.patch 0001. pg_dumpall --exclude-database=PATTERN already works, main function resolve pattern matching

Re: Non-text mode for pg_dumpall

2025-01-24 Thread jian he
On Thu, Jan 23, 2025 at 6:35 PM Mahendra Singh Thalor wrote: > > On Thu, 23 Jan 2025 at 14:59, jian he wrote: > > > > hi. > > The four patches attached are to solve the > > TODO1: We need to think for --exclude-database=PATTERN for pg_restore. > > it is ba

Re: Statistics Import and Export

2025-01-18 Thread jian he
On Fri, Jan 17, 2025 at 10:20 PM jian he wrote: > > hi. > > SELECT * FROM pg_catalog.pg_restore_relation_stats( > 'relation', 'public.tenk1_hundred'::regclass, > 'version', '18'::integer, > 'relpages', &#x

Re: Statistics Import and Export

2025-01-20 Thread jian he
On Thu, Jan 16, 2025 at 4:56 AM Corey Huinker wrote: >> >> >> >> I do like the idea of a "Statistics for ..." prefix, and I think it's >> doable. > > > And that's now implemented. > > >> The caller needs some knowledge about that anyway, to correctly output >> the statistics dump when the schema i

Re: Non-text mode for pg_dumpall

2025-01-20 Thread jian he
hi. some minor issues come to my mind when I look at it again. looking at set_null_conf, i think "if (archDumpFormat != archNull)" can be: if (archDumpFormat != archNull) { OPF = fopen(toc_path, "w"); if (!OPF) pg_fatal("could not open global.dat file: \"%s\" for writing: %m", toc_path); } s

Re: Non-text mode for pg_dumpall

2025-01-26 Thread jian he
hi. attached patching trying to refactor ReadOneStatement for properly handling the single and double quotes. the commit message also has some tests on it. it is based on your v11_pg_dumpall-with-directory-tar-custom-format-21-jan.patch. v11-0001-refactoring-ReadOneStatement.no-cfbot Description

Re: Statistics Import and Export

2025-01-27 Thread jian he
On Tue, Jan 21, 2025 at 7:31 AM Jeff Davis wrote: > > On Mon, 2025-01-20 at 16:45 -0500, Corey Huinker wrote: > > > > What I struggle to understand is how that purpose isn't served better > > by statistics being in SECTION_NONE like COMMENTs are, so that they > > are imported immediately after the

Re: speedup COPY TO for partitioned table.

2025-01-26 Thread jian he
On Wed, Jan 22, 2025 at 6:54 AM Melih Mutlu wrote: > > Hi Jian, > > Thanks for the patch. > > jian he , 19 Ara 2024 Per, 15:03 tarihinde şunu > yazdı: >> >> attached copy_par_regress_test.sql is a simple benchmark sql file, >> a partitioned table with

Re: add function argument name to substring and substr

2025-01-26 Thread jian he
hi. I forgot to attach the patch. here we are. From 249a083627b0d8ad15c698601f7b7649be5262a1 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 22 Jan 2025 14:19:15 +0800 Subject: [PATCH v1 1/1] add function argument name to function substring and substr --- src/backend/catalog

Re: Emitting JSON to file using COPY TO

2025-01-27 Thread jian he
oduce-CopyFormat-and-replace-csv_mode-and-bi.patch, author is by Joel Jacobson. As I mentioned in above, replacing 3 bool fields by an enum didn't change the struct CopyFormatOptions. but consolidated 3 bool fields into one enum to make code more lean. I think the refactoring (v14-0001) is worth i

Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

2025-01-27 Thread jian he
On Mon, Jan 6, 2025 at 5:34 PM jian he wrote: > > hi. > > about this issue, > last email in 2012 (https://postgr.es/m/8967.1353167...@sss.pgh.pa.us) > """ > Even if it happens to be trivial in the current patch, it's an added > functional requirement

Re: Extended Statistics set/restore/clear functions.

2025-01-28 Thread jian he
hi. I reviewed 0001 only. in src/backend/statistics/mvdistinct.c no need #include "nodes/pg_list.h" since src/include/statistics/statistics.h sub level include "nodes/pg_list.h" no need #include "utils/palloc.h" sicne #include "postgres.h" already included it. select '[{"6, -32768,,": -11}]':

Re: Extended Statistics set/restore/clear functions.

2025-01-28 Thread jian he
hi. select '{"1, 0B100101":"NaN"}'::pg_ndistinct; pg_ndistinct {"1, 37": -2147483648} (1 row) this is not what we expected? For the VALUE part of pg_ndistinct, float8 has 3 special values: inf, -inf, NaN. For the key part of pg_ndistinct, see example. select '{"1,

Re: Non-text mode for pg_dumpall

2025-01-21 Thread jian he
hi. + printfPQExpBuffer(query, + "SELECT substring ( " + " '%s' , " + " '%s' ) ", str, ptrn); + result = executeQuery(conn, query->data); + if (PQresultStatus(result) == PGRES_TUPLES_OK) + { + if (PQntuples(result) == 1) + { + const char *outstr; + + outstr = PQgetvalue(result, 0, 0); i think he

Re: Statistics Import and Export

2025-01-21 Thread jian he
hi. now stats_lock_check_privileges comments need to change? * Lock relation in ShareUpdateExclusive mode, check privileges, and close the * relation (but retain the lock). since the above comments will not be true for RELKIND_INDEX. Yes, there are comments within the function explaining the ex

add function argument name to substring and substr

2025-01-21 Thread jian he
hi. attached patch add function argument name to function substring and substr you can see the visual changes. mater behavior: \df substring List of functions Schema | Name| Result data type | Argument data types | Type +---+

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

2025-01-13 Thread jian he
On Sat, Jan 11, 2025 at 5:54 PM Kirill Reshke wrote: > > On Fri, 10 Jan 2025 at 11:38, jian he wrote: > > I think there are three remaining issues that may need more attention > > 1. > > Table 27.42. pg_stat_progress_copy View > > (pg_

Support --include-analyze in pg_dump, pg_dumpall, pg_restore

2025-01-14 Thread jian he
: jian -- ANALYZE public.prt1_p1; -- -- Name: prt1_p2; Type: ANALYZE; Schema: public; Owner: jian -- ANALYZE public.prt1_p2; ---<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> TODO item: writing tests. idea cr

Re: question about executor hooks

2025-01-14 Thread jian he
On Tue, Jan 14, 2025 at 5:08 PM Luca Ferrari wrote: > > In the file backend/executor/execMain.c there are the following hook types: > > /* Hooks for plugins to get control in ExecutorStart/Run/Finish/End */ > ExecutorStart_hook_type ExecutorStart_hook = NULL; > ExecutorRun_hook_type ExecutorRun_ho

Re: Re: proposal: schema variables

2025-01-02 Thread jian he
hi. in the function svariableStartupReceiver all these "ereport(ERROR" cannot happen, since transformLetStmt already did all the heavy work. base on https://www.postgresql.org/docs/current/error-message-reporting.html all these "ereport(ERROR," in the svariableStartupReceiver can be simplified as

Re: Re: proposal: schema variables

2025-01-04 Thread jian he
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 9c2957eb546..624858db301 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -361,6 +361,9 @@ typedef struct Const * of the `paramid' field contain the SubLink's subLinkId, and * the l

Re: Re: proposal: schema variables

2025-01-05 Thread jian he
+ /* + * The arguments of EXECUTE are evaluated by a direct expression + * executor call. This mode doesn't support session variables yet. + * It will be enabled later. + */ + if (pstate->p_hasSessionVariables) + elog(ERROR, "session variable cannot be used as an argument"); it should be: /*

Re: Proposal: Progressive explain

2024-12-30 Thread jian he
hi. [48/208] Compiling C object contrib/postgres_fdw/postgres_fdw.so.p/postgres_fdw.c.o FAILED: contrib/postgres_fdw/postgres_fdw.so.p/postgres_fdw.c.o /usr/local/gcc-14.1.0/bin/gcc-14.1.0 -Icontrib/postgres_fdw/postgres_fdw.so.p -Isrc/include -I../../Desktop/pg_src/src5/postgres/src/include -Isrc

Re: general purpose array_sort

2024-12-21 Thread jian he
func.sgml, some lines are too long, adjust it to several lines. From be56e368bb00f07e25b5d73a97816baceb46a92a Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 22 Dec 2024 12:23:14 +0800 Subject: [PATCH v15 1/2] general purpose array_sort Introduce the SQL-callable function array_sort(anyarray). The

Re: Non-text mode for pg_dumpall

2025-01-15 Thread jian he
On Sun, Jan 12, 2025 at 5:31 AM Mahendra Singh Thalor wrote: > > > > > you also need change > > > > -f > class="parameter">filename > > --file= > class="parameter">filename > > > > > > Send output to the specified file. If this is omitted, the > >

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2025-01-14 Thread jian he
On Wed, Jan 15, 2025 at 12:37 AM Alvaro Herrera wrote: > > Hello, > > On 2024-Dec-09, jian he wrote: > > > ALTER DOMAIN ADD CONSTRAINT syntax more simple than CREATE DOMAIN. > > Your proposed patch makes the code simpler, yes, but I think it also > makes the error

pg_dumpall appendPQExpBuffer construct sql need an white space

2025-01-15 Thread jian he
hi. in src/bin/pg_dump/pg_dumpall.c appendPQExpBuffer(buf, " FROM pg_auth_members a " "LEFT JOIN %s ur on ur.oid = a.roleid " "LEFT JOIN %s um on um.oid = a.member " "LEFT JOIN %s ug on ug.oid = a.grantor "

Re: Non-text mode for pg_dumpall

2025-01-15 Thread jian he
hi. in master src/bin/pg_dump/pg_restore.c: main function if (opts->tocSummary) PrintTOCSummary(AH); else { ProcessArchiveRestoreOptions(AH); RestoreArchive(AH); } opts->tocSummary is true (pg_restore --list), no query will be executed. but your patch (pg_re

Re: Non-text mode for pg_dumpall

2025-01-16 Thread jian he
hi. $BIN6/pg_dumpall --format=directory --verbose --file=test1 pg_dumpall: executing SELECT pg_catalog.set_config('search_path', '', false); pg_dumpall: error: could not create directory "test1": File exists we should first validate --file option, if not ok error out immediately. if ok then conne

Re: Inquiry About Determining Parallel Plans for REFRESH MATERIALIZED VIEW

2025-01-15 Thread jian he
On Thu, Jan 16, 2025 at 3:05 PM Zhang Mingli wrote: > > > Thank you for your help! That’s certainly a viable approach to logging the > plan during the REFRESH operation. > However, I want to clarify that we’re particularly interested in examining > the SQL cases. When there are numerous queries

Re: Statistics Import and Export

2025-01-16 Thread jian he
On Thu, Jan 16, 2025 at 4:56 AM Corey Huinker wrote: >> > Attached is just the pg_dump stuff, and only for relation/attribute stats. > The extended stats and vacuumdb work will be in their own threads going > forward. I didn't follow this thread actively, so if the following issue is already ad

Re: Eager aggregation, take 3

2025-01-08 Thread jian he
hi. in create_grouping_expr_infos tce = lookup_type_cache(exprType((Node *) tle->expr), TYPECACHE_BTREE_OPFAMILY); if (!OidIsValid(tce->btree_opf) || !OidIsValid(tce->btree_opintype)) return; /* *

tests for pg_stat_progress_copy.tuples_skipped

2025-01-10 Thread jian he
;num_errors) The attached patch did minor changes on src/test/regress/sql/copy.sql. so we can check if pgstat_progress_update_param(PROGRESS_COPY_TUPLES_SKIPPED..) is working as intended or not. From f87c3769751e39daaf049728df7f7f5bcb226861 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 10 Jan 20

Re: Statistics Import and Export

2025-01-17 Thread jian he
hi. SELECT * FROM pg_catalog.pg_restore_relation_stats( 'relation', 'public.tenk1_hundred'::regclass, 'version', '18'::integer, 'relpages', '11'::integer, 'reltuples', '1'::real, 'relallvisible', '0'::integer ); dump and execute the above query generated a warning WARNI

Re: Virtual generated columns

2025-01-09 Thread jian he
On Thu, Jan 9, 2025 at 3:28 AM Peter Eisentraut wrote: > > On 08.01.25 17:38, Tom Lane wrote: > > Peter Eisentraut writes: > >> On 03.12.24 15:15, jian he wrote: > >>> SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE > >>> attgenera

Re: pg_dump, pg_dumpall, pg_restore: Add --no-policies option

2025-01-14 Thread jian he
hi. around src/bin/pg_dump/pg_dump.c line 1117 right after "ropt->no_comments = dopt.no_comments;" we also need add ropt->no_policies = dopt.no_policies; ? overall looks good to me. The tests seem wrong per https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F5499 I have no idea how

Re: Virtual generated columns

2025-02-13 Thread jian he
ve the out join semantic issue. i am wondering, can we do the virtual generated column expansion in the rewrite stage as is, and wrap the expressions in PHVs if the virtual generated columns come from the nullable side of an outer join. I am looking at pullup_replace_vars_callback, but it seems not

Re: Non-text mode for pg_dumpall

2025-02-11 Thread jian he
On Wed, Feb 12, 2025 at 1:17 AM Mahendra Singh Thalor wrote: > > > > > There are some tests per https://commitfest.postgresql.org/52/5495, I > > will check it later. hi. the cfbot failure is related to function _tocEntryRequired if (strcmp(te->desc, "DATABASE") == 0 || strcmp(te->desc, "DATA

Re: how to see the generated nodetags.h

2025-03-14 Thread jian he
On Sat, Mar 15, 2025 at 2:26 AM Hao Zhang wrote: > > Hello Hackers > > It seems nodetags.h is generated by gen_node_support.pl. Where and how can I > see this generated header to get a full list of all possible node tags? Thx > > > typedef enum NodeTag > { > T_Invalid = 0, > > #include "nodes

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
7.3. also add an example about using named natation call substring: substring(string=>'foobar', pattern=> 'o.b') the patch is small, I just put the \df substring \df substr (before and after patch) output into the commit message. From f0b49ccd27d41ff1bd1619284656efcb1d3c

Re: general purpose array_sort

2025-03-16 Thread jian he
best to include such a test case, so I've attached a patch. [0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=4618045bee4a6d3efcb489c319649d8dd9aaa738 From 9ab98e6470dd5f16ef6024c291e5aa99ebfbecde Mon Sep 17 00:00:00 2001 From: jian he Date: Sun, 16 Mar 2025 21:31:55 +0800 Sub

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

2025-03-17 Thread jian he
TM: "invalid values in %llu rows were replaced with null" > changed based on this. also minor documentation tweaks. From 3553eee56c8dd0c3ce334d1f37b511acbbc640af Mon Sep 17 00:00:00 2001 From: jian he Date: Tue, 18 Mar 2025 11:51:48 +0800 Subject: [PATCH v13 1/1] COPY (on_error set_to_null) Extent "on

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
On Wed, Mar 19, 2025 at 8:19 AM David G. Johnston wrote: > > The vast majority of examples throughout the manual use traditional function > call syntax func_name(arg1, arg2, etc.); I'd rather keep with convention > than start to scatter about alternative syntax choices just to give the > rand

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-17 Thread jian he
null constraints: "nc1" NOT NULL "a" Access method: heap --- some regress tests added. need more polishing, but overall it works as the above described. not sure if this idea is crazy or not, what do you think? From 5a66a8da2a8c5fef88

Re: support virtual generated column not null constraint

2025-03-19 Thread jian he
think you mean this thread: https://postgr.es/m/173591158454.714.7664064332419606...@wrigleys.postgresql.org should i put a test into generated_virtual.sql? + * We implement this by consing up a NullTest node for each virtual trivial question. I googled, and still found any explanation of th

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread jian he
On Thu, Mar 20, 2025 at 5:54 PM Rushabh Lathia wrote: > hi. looking at the regress tests. +-- verify NOT NULL VALID/NOT VALID +CREATE TABLE notnull_tbl1 (a INTEGER, b INTEGER); +INSERT INTO notnull_tbl1 VALUES (NULL, 1); +INSERT INTO notnull_tbl1 VALUES (NULL, 2); +INSERT INTO notnull_tbl1 VALUES

Re: add function argument name to substring and substr

2025-03-18 Thread jian he
From 835dc9364f9f986445b77af8fa761e7577cbbdff Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 19 Mar 2025 11:58:55 +0800 Subject: [PATCH v3 1/1] add argument name to function substring and substr also add substr and substring (no keywords) functions entry to doc. Table 9.9 is about keywords substring entry, now Table 9.10

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

2025-04-06 Thread jian he
On Thu, Mar 27, 2025 at 11:29 AM Sutou Kouhei wrote: > We can merge 0001 quickly, right? I did a brief review of v39-0001 and v39-0002. text: COPY_FILE COPY_FRONTEND still appear on comments in copyfrom_internal.h and copyto.c, Should it be removed? +#include "commands/copyto_internal.h" #incl

Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).

2025-04-05 Thread jian he
tables and populated materialized views. For example, COPY table TO copies the same rows as SELECT * FROM ONLY table. However it doesn't directly support other relation types, such as partitioned tables, inheritance child tables, or views. > The tests seem to

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-05 Thread jian he
CREATE TABLE LIKE. CREATE TABLE LIKE will copy the invalid not-null constraint and will become valid, i think this is what we want. The added regress test is a little bit verbose, trying to make it less verbose. polish comments here and there. From 8583163960b136a52aea7ab02b5cd8b5a81deeca Mon Sep 17

two occurrences of assign print_notnull within pg_dump.c

2025-04-05 Thread jian he
hi. in src/bin/pg_dump/pg_dump.c within function dumpTableSchema: there are two occurrences of: print_notnull = (tbinfo->notnull_constrs[j] != NULL && (tbinfo->notnull_islocal[j] || dopt->binary_upgrade

Re: support virtual generated column not null constraint

2025-04-05 Thread jian he
hi. rebase, and some minor code comments change. From 0af096b3959cc6f146bbe8a54a018c0e69beff2e Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 24 Mar 2025 11:22:54 +0800 Subject: [PATCH v6 1/1] not null for virtual generated column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8

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

2025-04-05 Thread jian he
On Sat, Apr 5, 2025 at 5:33 AM Masahiko Sawada wrote: > > On Fri, Apr 4, 2025 at 4:55 AM jian he wrote: > > > > On Tue, Mar 25, 2025 at 2:31 PM vignesh C wrote: > > > > > > 2) Here in error we say column c1 violates not-null constraint and in > > &

support ALTER TABLE DROP EXPRESSION for virtual generated column

2025-03-26 Thread jian he
ssion. From b3b23e5d7fee6143521560790bf4ad14e21e8a49 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 27 Mar 2025 09:49:29 +0800 Subject: [PATCH v1 1/1] support ALTER TABLE DROP EXPRESSION for virtual generated column It seems fairly straightforward: drop the generation expressi

Re: speedup COPY TO for partitioned table.

2025-03-27 Thread jian he
hi. I made a mistake. The regress test sql file should have a new line at the end of the file. From a4c643ac3a9f40bbdf07dcacc38527ef6e86f1bc Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 28 Mar 2025 11:05:53 +0800 Subject: [PATCH v5 1/1] support COPY partitioned_table TO CREATE TABLE pp (id

Re: speedup COPY TO for partitioned table.

2025-03-27 Thread jian he
es. so: copy t1 to stdout(header); ERROR: cannot copy from foreign table "t1" DETAIL: partition "t1" is a foreign table HINT: Try the COPY (SELECT ...) TO variant. From a2db87abfe0e1a4dda0ace47c65a9778f29fe5f2 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 28 Mar 2025 1

support create index on virtual generated column.

2025-03-26 Thread jian he
eeds to be rebuilt. * ALTER COLUMN SET DATA TYPE will also cause table rewrite, so we really need to track the virtual generated column attribute number that index was built on. From 8a60de43a7d1abf765a16890d6da7dc7e7f8a06d Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 26 Mar 2025 15:01:28 +08

ALTER COLUMN SET DATA TYPE does not change the generation expression's collation

2025-03-25 Thread jian he
hi. ATPrepAlterColumnType forbids us to ALTER COLUMN SET DATA TYPE USING (expr) for generated columns. however we can still change the generated column type from non-text to text or text type from one collation to another collation. In ATExecAlterColumnType, we also need to set the generation exp

duplicated comments on get_relation_constraints

2025-03-27 Thread jian he
hi. in plancat.c, function: get_relation_constraints ``` for (i = 0; i < num_check; i++) { Node *cexpr; /* * If this constraint hasn't been fully validated yet, we must * ignore it here. Also ignore if NO INHERIT and we weren't told * that that's safe. */

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-28 Thread jian he
On Fri, Mar 28, 2025 at 3:25 AM Alvaro Herrera wrote: > > On 2025-Mar-24, jian he wrote: > > > hi. > > you may like the attached. it's based on your idea: attnotnullvalid. > > This is quite close to what I was thinking, yeah. I noticed a couple of > bugs ho

<    4   5   6   7   8   9   10   11   12   >