Re: JIT: The nullness of casetest.value can be determined at the JIT compile time.

2024-09-03 Thread Xing Guo
On Tue, Sep 3, 2024 at 8:09 PM Andreas Karlsson wrote: > > On 8/31/24 10:04 AM, Xing Guo wrote: > > The nullness of casetest.value can be determined at the JIT compile > > time. We can emit fewer codes by utilizing this property. The attached > > patch is trying to fix it.

Re: JIT: Remove some unnecessary instructions.

2024-09-01 Thread Xing Guo
On Fri, Aug 30, 2024 at 8:50 PM Andreas Karlsson wrote: > > On 8/30/24 5:55 AM, Xing Guo wrote: > > I find there are some unnecessary load/store instructions being > > emitted by the JIT compiler. > > Well spotted! All of these are obvious dead instructions and while

JIT: The nullness of casetest.value can be determined at the JIT compile time.

2024-08-31 Thread Xing Guo
Hi hackers, The nullness of casetest.value can be determined at the JIT compile time. We can emit fewer codes by utilizing this property. The attached patch is trying to fix it. Best Regards, Xing From e366f50ec5fff46b537994c0ff4babe6646a97e5 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Sat

JIT: Remove some unnecessary instructions.

2024-08-29 Thread Xing Guo
Best Regards, Xing From 6c7503b9e92c10b3dd9e6d33391273b854d53437 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Fri, 30 Aug 2024 11:43:45 +0800 Subject: [PATCH] JIT: Remove some unnecessary instructions. There're some unnecessary instructions being emitted by the JIT compiler. This pat

Re: Improve pg_re_throw: check if sigjmp_buf is valid and report error

2024-08-20 Thread Xing Guo
Hi On Mon, Aug 19, 2024 at 10:12 PM Tom Lane wrote: > > We have had multiple instances of code "return"ing out of a PG_TRY, > so I fully agree that some better way to detect that would be good. > But maybe we ought to think about static analysis for that. I have some static analysis scripts for

Fix an incorrect assertion condition in mdwritev().

2024-05-25 Thread Xing Guo
c77d1810ac6f13e9b58da5cd3ded5e47d44d03af Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Sat, 25 May 2024 23:36:29 +0800 Subject: [PATCH v1] Fix an incorrect assertion in mdwritev(). In commit 4908c58[^1], we added smgrwritev() which is a vectored variant of smgrwrite(). Since mdwritev() is to be used

Re: Set appropriate processing mode for auxiliary processes.

2024-05-09 Thread Xing Guo
c. I also noticed that there's an unnecessary call to "BackgroundWorkerInitializeConnection" in worker_spi.c (The worker_spi launcher has set the dboid correctly). Best Regards, Xing. From 4dbe54ef746203740202e181f731b7e08bb6e4ea Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Fri, 1

Re: Set appropriate processing mode for auxiliary processes.

2024-05-09 Thread Xing Guo
Sorry, forget to add an assertion to guard our codes in my previous patch. From 4f2d70fb27e3ff23b8572c5e679c791daa1f6665 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Thu, 9 May 2024 20:57:48 +0800 Subject: [PATCH v3] Remove redundant SetProcessingMode(InitProcessing) calls. After several

Re: Set appropriate processing mode for auxiliary processes.

2024-05-09 Thread Xing Guo
On Thu, May 9, 2024 at 10:13 PM Heikki Linnakangas wrote: > > On 09/05/2024 16:12, Xing Guo wrote: > > Hi hackers, > > > > After several refactoring iterations, auxiliary processes are no > > longer initialized from the bootstrapper. I think using the > >

Set appropriate processing mode for auxiliary processes.

2024-05-09 Thread Xing Guo
:00 2001 From: Xing Guo Date: Thu, 9 May 2024 20:57:48 +0800 Subject: [PATCH v1] Set appropriate processing mode for auxiliary processes. After several refactoring iterations, auxiliary processes are no longer initialized from the bootstrapper. Using the InitProcessing mode for initializing

Re: Remove deprecated header file resowner_private.h.

2024-04-20 Thread Xing Guo
On Sat, Apr 20, 2024 at 5:03 PM Michael Paquier wrote: > > On Sat, Apr 20, 2024 at 11:54:29AM +0900, Michael Paquier wrote: > > Will clean up. > > While looking at the whole, I've noticed that this has been mentioned > here by Andres, but the committed patch did not get the call: > https://www.pos

Remove deprecated header file resowner_private.h.

2024-04-19 Thread Xing Guo
ab13ca575e92f26a4b936c0d4fa92df23865c2d4 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Sat, 20 Apr 2024 10:00:23 +0800 Subject: [PATCH v1] Remove deprecated header file. The resowner_private.h is deprecated after b8bff07. --- src/include/utils/resowner_private.h | 117 --- 1 file changed, 117 deletions

[plpython] Add missing volatile qualifier.

2024-04-01 Thread Xing Guo
Hi hackers, I'm playing a toy static analysis checker with PostgreSQL and found a variable is missing volatile qualifier. Best Regards, Xing From 7084055da64d0433b09e50faff630e551c363f27 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Mon, 1 Apr 2024 21:39:04 +0800 Subject: [PATCH v1] Add mi

Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-13 Thread Xing Guo
> On Wed, Mar 13, 2024 at 2:45 PM Peter Eisentraut wrote: > > On 12.03.24 14:38, Xing Guo wrote: > > When the PostgreSQL server is configured with --with-llvm, the pgxs.mk > > framework will generate LLVM bitcode for extensions automatically. > > Sometimes, I don

Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-12 Thread Xing Guo
> On Tue, Mar 12, 2024 at 10:40 PM Daniel Gustafsson wrote: > > > On 12 Mar 2024, at 14:38, Xing Guo wrote: > > > Would it be possible to add a new switch in the pgxs.mk framework to > > allow users to disable this feature? > > Something like that doesn't

Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-12 Thread Xing Guo
Hi hackers, When the PostgreSQL server is configured with --with-llvm, the pgxs.mk framework will generate LLVM bitcode for extensions automatically. Sometimes, I don't want to generate bitcode for some extensions. I can turn off this feature by specifying with_llvm=0 in the make command. ``` mak

Re: Control your disk usage in PG: Introduction to Disk Quota Extension

2024-02-26 Thread Xing Guo
On Tue, Feb 27, 2024 at 6:38 AM Stephen Frost wrote: > > Greetings, > > * Xing Guo (higuox...@gmail.com) wrote: > > Looks that many hackers are happy with the original patch except that > > the original patch needs a simple rebase, though it has been 3 years. > >

Re: Control your disk usage in PG: Introduction to Disk Quota Extension

2024-02-26 Thread Xing Guo
On Mon, Feb 26, 2024 at 7:27 PM Daniel Gustafsson wrote: > > > On 1 Jul 2020, at 10:36, Daniel Gustafsson wrote: > > > >> On 27 Mar 2020, at 11:22, Haozhou Wang wrote: > > > >> We rebased this patch with the newest master. > > > > This patch now fails to build according to Travis: > > > > smgr.c

Make PostgreSQL work with newer libxml2.

2023-12-03 Thread Xing Guo
generated. make[4]: *** [: xml.o] Error 1 Here is a quick workaround for it. [1] https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711 [2] https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7 Best Regards, Xing From bded3361f7f2ac7b4734d59de8ddb07875d9489d Mon Sep 17

Re: Don't pass NULL pointer to strcmp().

2023-11-02 Thread Xing Guo
lves trading one set > of hacks for another. > > -- > Nathan Bossart > Amazon Web Services: https://aws.amazon.com > -- Best Regards, Xing From d620d3a2b44cef63024baca4ccdf55bf7724737f Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Thu, 2 Nov 2023 16:42:00 +0800 Subject

Re: Don't pass NULL pointer to strcmp().

2023-11-01 Thread Xing Guo
Thank you Tom! Your comment "NULL doesn't have semantics that are visibly different from an empty string" is exactly what I want to confirm :-) On 11/2/23, Tom Lane wrote: > I wrote: >> Hmm ... if we're doing it ourselves, I suppose we've got to consider >> it supported :-(. But I'm still wonde

Re: Don't pass NULL pointer to strcmp().

2023-11-01 Thread Xing Guo
NULL is a valid boot_val for string variables, I just came across some extensions that use NULL as their boot_val. If the boot_val can't be NULL in extensions, we should probably add some assertions or comments about it? Best Regards, Xing On Wed, Nov 1, 2023 at 11:30 PM Tom Lane wro

Re: Don't pass NULL pointer to strcmp().

2023-11-01 Thread Xing Guo
ore place with a similar code in guc.c around line 1472. > Although I don't have exact steps to trigger a crash I suggest adding > a similar check there. > > -- > Best regards, > Aleksander Alekseev > From bf0a9f848e69097a034692ed7b0be0ad81a5d991 Mon Sep 17 00:00:00 2001 From:

Don't pass NULL pointer to strcmp().

2023-11-01 Thread Xing Guo
Xing From dcd7a49190f0e19ba0a1e697cac45724450f6365 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Wed, 1 Nov 2023 16:41:49 +0800 Subject: [PATCH] Don't use strcmp() with nullable pointers. Passing a NULL pointer to strcmp() is an undefined behavior. It can make the PostgreSQL server crash.

Remove obsolete check for TTSOpsVirtual from slot_compile_deform

2023-10-30 Thread Xing Guo
on in slot_compile_deform. Patch is attached. [1] https://github.com/postgres/postgres/blob/0c60e8ba80e03491b028204a19a9dca6d216df91/src/backend/jit/llvm/llvmjit_expr.c#L322 Best Regards, Xing From 6db602bd7d0964b60134c4b20b4107a1e8717b78 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Mon, 30 Oct 2023 22:

Re: Guiding principle for dropping LLVM versions?

2023-10-21 Thread Xing Guo
Hi, Can we also check if the clang's version is compatible with llvm's version in llvm.m4? I have multiple llvm toolchains installed on my system and I have to specify the $CLANG and $LLVM_CONFIG variables each time I build the server against a toolchain that is not present in $PATH. If one of the

Re: [RFC] Clang plugin for catching suspicious typedef casting

2023-08-14 Thread Xing Guo
Hi, On 8/10/23, Dmitry Dolgov <9erthali...@gmail.com> wrote: >> On Wed, Aug 09, 2023 at 03:23:32PM +0200, Peter Eisentraut wrote: >> On 03.08.23 18:56, Dmitry Dolgov wrote: >> > I would like to get your opinion, folks. Does it sound interesting >> > enough for the community, is it worth it to purs

Re: PL/Python: Fix return in the middle of PG_TRY() block.

2023-05-04 Thread Xing Guo
Sorry for not responding to this thread for a long time and a huge thank you for pushing it forward! Best Regards, Xing On Fri, May 5, 2023 at 7:42 AM Nathan Bossart wrote: > On Thu, May 04, 2023 at 08:39:03AM -0400, Tom Lane wrote: > > Hmm, I'm not sure why PLy_trigger_build_args's plta

Re: PL/Python: Fix return in the middle of PG_TRY() block.

2023-01-18 Thread Xing Guo
On Mon, Jan 16, 2023 at 11:29 PM Tom Lane wrote: > Xing Guo writes: > > Are there any unsafe codes in pltcl.c? The return statement is in the > > PG_CATCH() block, I think the exception stack has been recovered in > > PG_CATCH block so the return statement in PG_CAT

Re: PL/Python: Fix return in the middle of PG_TRY() block.

2023-01-16 Thread Xing Guo
Hi, I revised my patch, added the missing one that Nathan mentioned. Are there any unsafe codes in pltcl.c? The return statement is in the PG_CATCH() block, I think the exception stack has been recovered in PG_CATCH block so the return statement in PG_CATCH block should be ok? ``` PG_TRY(); { UT

Re: PL/Python: Fix return in the middle of PG_TRY() block.

2023-01-13 Thread Xing Guo
Hi Nathan. On 1/13/23, Nathan Bossart wrote: > On Thu, Jan 12, 2023 at 11:19:29PM +0800, Xing Guo wrote: >> I was running static analyser against PostgreSQL and found there're 2 >> return statements in PL/Python module which is not safe. Patch is >> attache

PL/Python: Fix return in the middle of PG_TRY() block.

2023-01-12 Thread Xing Guo
Hi hackers, I was running static analyser against PostgreSQL and found there're 2 return statements in PL/Python module which is not safe. Patch is attached. -- Best Regards, Xing diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index 923703535a..c0e4a81283 100644 --- a/src

Re: [PATCH] Simple code cleanup in tuplesort.c.

2023-01-09 Thread Xing Guo
On 1/9/23, John Naylor wrote: > On Thu, Jan 5, 2023 at 8:18 AM John Naylor > wrote: >> >> The label TSS_BUILDRUNS has a similar style and also the following > comment, so I will push this patch with a similar comment added unless > someone wants to make a case for doing otherwise. >> >> * Note th

pg_regress/pg_isolation_regress: Fix possible nullptr dereference.

2022-11-30 Thread Xing Guo
Hi hackers, While playing with pg_regress and pg_isolation_regress, I noticed that there's a potential nullptr deference in both of them. How to reproduce: Specify the `--dbname=` option without providing any database name. //pg_regress --dbname= foo //pg_isolation_regress --dbname= foo Pa

Re: [PATCH] Simple code cleanup in tuplesort.c.

2022-09-30 Thread Xing Guo
Hi Richard, Sorry for not responding for a long time, I missed the previous email by accident :-) I attached a newer patch based on your suggestions and created an entry in cf manager. https://commitfest.postgresql.org/40/3924/ Best Regards, Xing Guo On 9/16/22, Richard Guo wrote: > On

[PATCH] Simple code cleanup in tuplesort.c.

2022-07-27 Thread Xing Guo
Hi hackers, The bounded heap sorting status flag is set twice in sort_bounded_heap() and tuplesort_performsort(). This patch helps remove one of them. Best Regards, Xing diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index d90a1aebdf..84dc0d07f9 100644 --- a/

Re: try_relation_open and relation_open behave different.

2021-10-18 Thread Xing GUO
On Mon, Oct 18, 2021 at 2:45 PM Michael Paquier wrote: > On Mon, Oct 18, 2021 at 01:56:07PM +0800, Xing GUO wrote: > > My question is, is it a deliberate design that makes try_relation_open > and > > relation_open different? Shall we mention it in the comment of > > try

try_relation_open and relation_open behave different.

2021-10-17 Thread Xing GUO
Hi hackers, I'm writing an extension that employs `object_access_hook`. I want to monitor the table creation event and record the mapping between `reloid` and `relfilenode` during a transaction. Here's my code snippet, ``` static void my_object_access_hook(ObjectAccessType access,

Re: `make check` doesn't pass on MacOS Catalina

2021-04-20 Thread Xing GUO
On 4/21/21, Tom Lane wrote: > Xing GUO writes: >> Thank you very much. I'm facing the same problem yesterday. May I >> suggest that document it in the installation guide on MacOS platform? > > It is documented --- see last para under > > https://www.postgres

Re: `make check` doesn't pass on MacOS Catalina

2021-04-20 Thread Xing GUO
Hi hackers, Thank you very much. I'm facing the same problem yesterday. May I suggest that document it in the installation guide on MacOS platform? On 4/21/21, Andrew Dunstan wrote: > > On 4/20/21 11:02 AM, Tom Lane wrote: >> Aleksander Alekseev writes: >>> While trying to build PostgreSQL from