Re: redacting password in SQL statement in server log

2022-07-23 Thread Zhihong Yu
On Sat, Jul 23, 2022 at 5:27 PM Tom Lane wrote: > Zhihong Yu writes: > > Currently, in situation such as duplicate role creation, the server log > > would show something such as the following: > > > 2022-07-22 13:48:18.251 UTC [330] STATEMENT: CREATE ROLE test WITH LO

Re: redacting password in SQL statement in server log

2022-07-24 Thread Zhihong Yu
On Sat, Jul 23, 2022 at 5:27 PM Tom Lane wrote: > Zhihong Yu writes: > > Currently, in situation such as duplicate role creation, the server log > > would show something such as the following: > > > 2022-07-22 13:48:18.251 UTC [330] STATEMENT: CREATE ROLE test WITH LO

Re: Add proper planner support for ORDER BY / DISTINCT aggregates

2022-07-25 Thread Zhihong Yu
On Mon, Jul 25, 2022 at 4:39 PM David Rowley wrote: > On Fri, 22 Jul 2022 at 21:33, Richard Guo wrote: > > I can see this problem with > > the query below: > > > > select max(b order by b), max(a order by a) from t group by a; > > > > When processing the first aggregate, we compose the 'curr

Question about ExplainOneQuery_hook

2022-07-26 Thread Zhihong Yu
Hi, I was looking at ExplainOneQuery() where ExplainOneQuery_hook is called. Currently the call to the hook is in if block and normal processing is in else block. What if the hook doesn't want to duplicate the whole code printing execution plan ? Please advise. Thanks

Re: Skip partition tuple routing with constant partition key

2022-07-26 Thread Zhihong Yu
On Tue, Jul 26, 2022 at 3:28 PM David Rowley wrote: > Thank for looking at this. > > On Sat, 23 Jul 2022 at 01:23, Amit Langote > wrote: > > + /* > > +* The Datum has changed. Zero the number of times > we've > > +* found last_found_datu

Re: Making Vars outer-join aware

2022-08-01 Thread Zhihong Yu
On Mon, Aug 1, 2022 at 12:51 PM Tom Lane wrote: > Here's a rebase up to HEAD, mostly to placate the cfbot. > I accounted for d8e34fa7a (s/all_baserels/all_query_rels/ > in those places) and made one tiny bug-fix change. > Nothing substantive as yet. > > regards, tom lane >

Re: Add proper planner support for ORDER BY / DISTINCT aggregates

2022-08-02 Thread Zhihong Yu
> > > Hi, David: I was looking at the final patch and noticed that setno field in agg_presorted_distinctcheck struct is never used. Looks like it was copied from neighboring struct. Can you take a look at the patch ? Thanks > drop-setno-from-agg_presorted_distinctcheck.patch Description: Bin

Re: Add proper planner support for ORDER BY / DISTINCT aggregates

2022-08-02 Thread Zhihong Yu
On Tue, Aug 2, 2022 at 11:02 AM Zhihong Yu wrote: > >> Hi, David: > > I was looking at the final patch and noticed that setno field > in agg_presorted_distinctcheck struct is never used. > > Looks like it was copied from neighboring struct. > > Can you take a

Re: Parallel Aggregates for string_agg and array_agg

2022-08-02 Thread Zhihong Yu
On Tue, Aug 2, 2022 at 4:46 PM David Rowley wrote: > On Wed, 20 Jun 2018 at 19:08, David Rowley > wrote: > > I'll submit it again when there more consensus that we want this. > > Waking up this old thread again. If you don't have a copy, the entire > thread is in [1]. > > The remaining item that

dropping datumSort field

2022-08-08 Thread Zhihong Yu
Hi, I was looking at ExecSort() w.r.t. datum sort. I wonder if the datumSort field can be dropped. Here is a patch illustrating the potential simplification. Please take a look. Thanks drop-datum-sort-field.patch Description: Binary data

Re: dropping datumSort field

2022-08-09 Thread Zhihong Yu
On Tue, Aug 9, 2022 at 8:01 AM Robert Haas wrote: > On Mon, Aug 8, 2022 at 5:51 PM Zhihong Yu wrote: > > Hi, > > I was looking at ExecSort() w.r.t. datum sort. > > > > I wonder if the datumSort field can be dropped. > > Here is a patch illustrating the potenti

Re: dropping datumSort field

2022-08-09 Thread Zhihong Yu
On Tue, Aug 9, 2022 at 8:24 AM Robert Haas wrote: > On Tue, Aug 9, 2022 at 11:16 AM Zhihong Yu wrote: > > tupDesc is declared inside `if (!node->sort_Done)` block whereas the > last reference to tupDesc is outside the if block. > > Yep. > > > I take your review

Re: Fast COPY FROM based on batch insert

2022-08-09 Thread Zhihong Yu
On Tue, Aug 9, 2022 at 4:45 AM Etsuro Fujita wrote: > On Tue, Jul 26, 2022 at 7:19 PM Etsuro Fujita > wrote: > > Yeah, I think the patch is getting better, but I noticed some issues, > > so I'm working on them. I think I can post a new version in the next > > few days. > > * When running AFTER

Re: dropping datumSort field

2022-08-09 Thread Zhihong Yu
On Tue, Aug 9, 2022 at 9:04 PM David Rowley wrote: > On Wed, 10 Aug 2022 at 03:16, Zhihong Yu wrote: > > On Tue, Aug 9, 2022 at 8:01 AM Robert Haas > wrote: > >> > >> One problem with this patch is that, if I apply it, PostgreSQL does not > compile: > >

avoid negating LONG_MIN in cash_out()

2022-08-11 Thread Zhihong Yu
Hi, In cash_out(), we have the following code: if (value < 0) { /* make the amount positive for digit-reconstruction loop */ value = -value; The negation cannot be represented in type long when the value is LONG_MIN. It seems we can error out when LONG_MIN is detected inst

Re: avoid negating LONG_MIN in cash_out()

2022-08-11 Thread Zhihong Yu
On Thu, Aug 11, 2022 at 10:40 AM Tom Lane wrote: > Zhihong Yu writes: > > In cash_out(), we have the following code: > > if (value < 0) > > { > > /* make the amount positive for digit-reconstruction loop */ > > value = -value; > &g

Re: avoid negating LONG_MIN in cash_out()

2022-08-11 Thread Zhihong Yu
On Thu, Aug 11, 2022 at 10:55 AM Zhihong Yu wrote: > > > On Thu, Aug 11, 2022 at 10:40 AM Tom Lane wrote: > >> Zhihong Yu writes: >> > In cash_out(), we have the following code: >> > if (value < 0) >> > { >> >

Re: avoid negating LONG_MIN in cash_out()

2022-08-11 Thread Zhihong Yu
On Thu, Aug 11, 2022 at 12:55 PM David Rowley wrote: > On Fri, 12 Aug 2022 at 05:58, Zhihong Yu wrote: > > Here is sample output with patch: > > > > # SELECT '-92233720368547758.085'::money; > > ERROR: value "-92233720368547758.085" is

Re: avoid negating LONG_MIN in cash_out()

2022-08-11 Thread Zhihong Yu
On Thu, Aug 11, 2022 at 6:28 PM Tom Lane wrote: > Zhihong Yu writes: > > How about patch v2 which uses the same check from cash_in() ? > > I'm not sure which part of this statement you're not getting: > it is completely unacceptable for cash_out to fail on valid >

Re: Multi-Column List Partitioning

2021-08-25 Thread Zhihong Yu
On Wed, Aug 25, 2021 at 5:41 AM Nitin Jadhav wrote: > > The new list bound binary search and related comparison support > > function look a bit too verbose to me. I was expecting > > partition_list_bsearch() to look very much like > > partition_range_datum_bsearch(), but that is not the case. T

Re: [PoC] Federated Authn/z with OAUTHBEARER

2021-08-25 Thread Zhihong Yu
On Wed, Aug 25, 2021 at 11:42 AM Jacob Champion wrote: > On Tue, 2021-06-22 at 23:22 +, Jacob Champion wrote: > > On Fri, 2021-06-18 at 11:31 +0300, Heikki Linnakangas wrote: > > > > > > A few small things caught my eye in the backend oauth_exchange > function: > > > > > > > + /* Handle

Re: [PoC] Federated Authn/z with OAUTHBEARER

2021-08-25 Thread Zhihong Yu
On Wed, Aug 25, 2021 at 3:25 PM Zhihong Yu wrote: > > > On Wed, Aug 25, 2021 at 11:42 AM Jacob Champion > wrote: > >> On Tue, 2021-06-22 at 23:22 +, Jacob Champion wrote: >> > On Fri, 2021-06-18 at 11:31 +0300, Heikki Linnakangas wrote: >> > > >

Re: [PoC] Federated Authn/z with OAUTHBEARER

2021-08-26 Thread Zhihong Yu
On Thu, Aug 26, 2021 at 9:13 AM Jacob Champion wrote: > On Wed, 2021-08-25 at 15:25 -0700, Zhihong Yu wrote: > > > > Hi, > > For v2-0001-common-jsonapi-support-FRONTEND-clients.patch : > > > > + /* Clean up. */ > > + termJsonLexContext(&lex); > &

Re: Gather performance analysis

2021-08-28 Thread Zhihong Yu
On Sat, Aug 28, 2021 at 12:11 AM Dilip Kumar wrote: > On Tue, Aug 24, 2021 at 8:48 PM Robert Haas wrote: > >> On Fri, Aug 6, 2021 at 4:31 AM Dilip Kumar wrote: >> > Results: (query EXPLAIN ANALYZE SELECT * FROM t;) >> > 1) Non-parallel (default) >> > Execution Time: 31627.492 ms >> > >> > 2) P

Re: Gather performance analysis

2021-08-28 Thread Zhihong Yu
On Sat, Aug 28, 2021 at 4:29 AM Zhihong Yu wrote: > > > On Sat, Aug 28, 2021 at 12:11 AM Dilip Kumar > wrote: > >> On Tue, Aug 24, 2021 at 8:48 PM Robert Haas >> wrote: >> >>> On Fri, Aug 6, 2021 at 4:31 AM Dilip Kumar >>> wrote: >>>

Re: Use extended statistics to estimate (Var op Var) clauses

2021-08-28 Thread Zhihong Yu
On Sat, Aug 28, 2021 at 6:53 AM Tomas Vondra wrote: > Hi, > > The attached patch series is modified to improve estimates for these > special clauses (Var op Var with the same var on both sides) without > extended statistics. This is done in 0001, and it seems fairly simple > and cheap. > > The 00

Re: Use extended statistics to estimate (Var op Var) clauses

2021-08-28 Thread Zhihong Yu
On Sat, Aug 28, 2021 at 9:30 AM Mark Dilger wrote: > > > > On Aug 28, 2021, at 6:52 AM, Tomas Vondra > wrote: > > > > Part 0003 fixes handling of those clauses so that we don't treat them as > simple, but it does that by tweaking statext_is_compatible_clause(), as > suggested by Dean. > > Functi

Re: dynamic result sets support in extended query protocol

2021-08-30 Thread Zhihong Yu
On Mon, Aug 30, 2021 at 1:23 PM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > rebased patch set > > On 22.07.21 08:06, vignesh C wrote: > > On Tue, Jun 29, 2021 at 7:10 PM Peter Eisentraut > > wrote: > >> > >> Here is an updated patch with some merge conflicts resolved, to keep i

Re: Use extended statistics to estimate (Var op Var) clauses

2021-08-30 Thread Zhihong Yu
On Mon, Aug 30, 2021 at 9:00 AM Tomas Vondra wrote: > On 8/28/21 6:30 PM, Mark Dilger wrote: > > > > > >> On Aug 28, 2021, at 6:52 AM, Tomas Vondra > >> wrote: > >> > >> Part 0003 fixes handling of those clauses so that we don't treat > >> them as simple, but it does that by tweaking > >> statex

Re: suboverflowed subtransactions concurrency performance optimize

2021-08-31 Thread Zhihong Yu
On Mon, Aug 30, 2021 at 1:43 AM Pengchengliu wrote: > Hi hackers, > I wrote a patch to resolve the subtransactions concurrency performance > problems when suboverflowed. > > When we use more than PGPROC_MAX_CACHED_SUBXIDS(64) subtransactions per > transaction concurrency, it will lead to subtrans

Re: [PATCH] Support pg_ident mapping for LDAP

2021-09-01 Thread Zhihong Yu
On Wed, Sep 1, 2021 at 11:43 AM Jacob Champion wrote: > On Wed, 2021-09-01 at 15:42 +, Jacob Champion wrote: > > The cfbot found a failure in postgres_fdw, which I completely neglected > > in my design. I think the desired functionality should be to allow the > > ldapuser connection option du

Re: [PATCH] Support pg_ident mapping for LDAP

2021-09-01 Thread Zhihong Yu
On Wed, Sep 1, 2021 at 1:56 PM Jacob Champion wrote: > On Wed, 2021-09-01 at 12:59 -0700, Zhihong Yu wrote: > > + if (strcmp(val, "1") == 0) > > + hbaline->ldap_map_dn = true; > > + else > > + hbaline->ldap_map_dn = f

Re: [PATCH] Partial foreign key updates in referential integrity triggers

2021-09-02 Thread Zhihong Yu
On Thu, Sep 2, 2021 at 12:11 PM Paul Martinez wrote: > On Wed, Sep 1, 2021 at 4:11 AM Daniel Gustafsson wrote: > > > This patch no longer applies, can you please submit a rebased version? > It > > currently fails on catversion.h, to keep that from happening repeatedly > you can > > IMO skip that

Re: ORDER BY pushdowns seem broken in postgres_fdw

2021-09-06 Thread Zhihong Yu
On Mon, Sep 6, 2021 at 1:17 AM Ronan Dunklau wrote: > Le vendredi 3 septembre 2021, 22:54:25 CEST David Zhang a écrit : > > The following review has been posted through the commitfest application: > > make installcheck-world: tested, failed > > Implements feature: tested, passed > > Spec c

Re: ORDER BY pushdowns seem broken in postgres_fdw

2021-09-06 Thread Zhihong Yu
On Mon, Sep 6, 2021 at 2:41 AM Ronan Dunklau wrote: > Le lundi 6 septembre 2021, 11:25:39 CEST Zhihong Yu a écrit : > > On Mon, Sep 6, 2021 at 1:17 AM Ronan Dunklau wrote: > > > Le vendredi 3 septembre 2021, 22:54:25 CEST David Zhang a écrit : > > > > The fo

Re: SQL:2011 application time

2021-09-06 Thread Zhihong Yu
On Mon, Sep 6, 2021 at 12:53 PM Paul A Jungwirth < p...@illuminatedcomputing.com> wrote: > On Sat, Sep 4, 2021 at 12:56 PM Jaime Casanova > wrote: > > > > patch 01: does apply but doesn't compile, attached the compile errors. > > patch 04: does not apply clean. > > Thanks for taking a look! I've

Re: Non-decimal integer literals

2021-09-07 Thread Zhihong Yu
On Tue, Sep 7, 2021 at 4:13 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 16.08.21 17:32, John Naylor wrote: > > The one thing that jumped out at me on a cursory reading is > > the {integer} rule, which seems to be used nowhere except to > > call process_integer_literal, whi

Re: Parallelize correlated subqueries that execute within each worker

2021-09-07 Thread Zhihong Yu
On Tue, Sep 7, 2021 at 6:17 AM James Coleman wrote: > On Wed, Sep 1, 2021 at 7:06 AM Daniel Gustafsson wrote: > > > > > On 7 May 2021, at 18:30, James Coleman wrote: > > > > > ..here we are now, and I finally have this patch cleaned up > > > enough to share. > > > > This patch no longer applies

Re: a misbehavior of partition row movement (?)

2021-09-10 Thread Zhihong Yu
On Fri, Sep 10, 2021 at 7:06 AM Amit Langote wrote: > On Fri, Sep 3, 2021 at 12:23 PM Amit Langote > wrote: > > Hi Andrew, > > > > On Fri, Sep 3, 2021 at 6:19 AM Andrew Dunstan > wrote: > > > On 7/13/21 8:09 AM, Amit Langote wrote: > > > > Unfortunately, I don’t think I’ll have time in this CF

incorrect file name in backend_progress.c header

2021-09-10 Thread Zhihong Yu
Hi, I was looking at backend_progress.c and noticed that the filename and path were wrong in the header. Here is patch which corrects the mistake. Please take a look. Thanks backend_prog-hdr.patch Description: Binary data

Re: incorrect file name in backend_progress.c header

2021-09-10 Thread Zhihong Yu
On Fri, Sep 10, 2021 at 10:56 AM Justin Pryzby wrote: > On Fri, Sep 10, 2021 at 10:11:34AM -0700, Zhihong Yu wrote: > > Hi, > > I was looking at backend_progress.c and noticed that the filename and > path > > were wrong in the header. > > > > Here is patch whi

Re: incorrect file name in backend_progress.c header

2021-09-10 Thread Zhihong Yu
On Fri, Sep 10, 2021 at 11:07 AM Zhihong Yu wrote: > > > On Fri, Sep 10, 2021 at 10:56 AM Justin Pryzby > wrote: > >> On Fri, Sep 10, 2021 at 10:11:34AM -0700, Zhihong Yu wrote: >> > Hi, >> > I was looking at backend_progress.c and noticed that the file

Re: incorrect file name in backend_progress.c header

2021-09-10 Thread Zhihong Yu
On Fri, Sep 10, 2021 at 11:20 AM Justin Pryzby wrote: > > For the first list, do you want to include the path to the file for > > IDENTIFICATION ? > > If so, I can prepare a patch covering the files in that list. > > Since there's so few exceptions to the "rule", I think they should be > fixed fo

Re: Polyphase merge is obsolete

2021-09-11 Thread Zhihong Yu
On Fri, Sep 10, 2021 at 11:35 PM Jaime Casanova < jcasa...@systemguards.com.ec> wrote: > On Wed, Jul 14, 2021 at 06:04:14PM +0300, Heikki Linnakangas wrote: > > On 14/07/2021 15:12, vignesh C wrote: > > > On Sat, Jan 23, 2021 at 3:49 AM Heikki Linnakangas > wrote: > > > > Here's an updated versio

Re: document the need to analyze partitioned tables

2021-09-12 Thread Zhihong Yu
On Sun, Sep 12, 2021 at 8:54 PM Justin Pryzby wrote: > Adding -hackers, sorry for the duplicate. > > This seems to be deficient, citing > > https://www.postgresql.org/message-id/flat/0d1b394b-bec9-8a71-a336-44df7078b295%40gmail.com > > I'm proposing something like the attached. Ideally, there wo

Re: Getting ERROR "subplan "SubPlan 1" was not initialized" in EXISTS subplan when using for list partition.

2021-09-14 Thread Zhihong Yu
On Tue, Sep 14, 2021 at 10:44 AM Tom Lane wrote: > Rajkumar Raghuwanshi writes: > > I am getting "ERROR: subplan "SubPlan 1" was not initialized" error with > > below test case. > > > CREATE TABLE tbl ( c1 int, c2 int, c3 int ) PARTITION BY LIST (c1); > > create table tbl_null PARTITION OF tbl

Re: Refactoring postgres_fdw code to rollback remote transaction

2021-09-16 Thread Zhihong Yu
On Thu, Sep 16, 2021 at 7:31 PM Fujii Masao wrote: > Hi, > > In postgres_fdw, pgfdw_xact_callback() and pgfdw_subxact_callback() do > almost the same thing to rollback remote toplevel- and sub-transaction. > But their such rollback logics are implemented separately and > in different way. Which w

Re: So, about that cast-to-typmod-minus-one business

2021-09-18 Thread Zhihong Yu
On Sat, Sep 18, 2021 at 10:06 AM Tom Lane wrote: > We had left it as an open issue whether or not to risk back-patching > 5c056b0c2 into stable branches [1]. While updating the v14 release notes, > I realized that we can't put off that decision any longer, because we > have to decide now whether

Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings

2021-09-30 Thread Zhihong Yu
On Thu, Sep 30, 2021 at 7:45 AM Jelte Fennema wrote: > The new connection made by PQcancel does not use the tcp_user_timeout, > connect_timeout or any of the keepalive settings that are provided in the > connection string. This means that a call to PQcancel can block for a much > longer time than

Re: pg_stat_statements and "IN" conditions

2021-09-30 Thread Zhihong Yu
On Thu, Sep 30, 2021 at 6:49 AM Dmitry Dolgov <9erthali...@gmail.com> wrote: > >On Wed, Jun 16, 2021 at 04:02:12PM +0200, Dmitry Dolgov wrote: > > > > > I've prepared a new rebased version to deal with the new way of > > > computing query id, but as always there is one tricky part. From what I > >

Re: Multi-Column List Partitioning

2021-10-01 Thread Zhihong Yu
On Fri, Oct 1, 2021 at 6:56 AM Amit Langote wrote: > Hi, > > On Mon, Sep 13, 2021 at 7:17 PM Rajkumar Raghuwanshi > wrote: > > On PG head + Nitin's v3 patch + Amit's Delta patch. Make check is > failing with below errors. > > Thanks Rajkumar for testing. > > > --inherit.sql is failing with erro

Re: BufferAlloc: don't take two simultaneous locks

2021-10-01 Thread Zhihong Yu
On Fri, Oct 1, 2021 at 3:26 PM Yura Sokolov wrote: > Good day. > > I found some opportunity in Buffer Manager code in BufferAlloc > function: > - When valid buffer is evicted, BufferAlloc acquires two partition > lwlocks: for partition for evicted block is in and partition for new > block placeme

Re: very long record lines in expanded psql output

2021-10-03 Thread Zhihong Yu
On Sun, Oct 3, 2021 at 5:57 AM Platon Pronko wrote: > On 2021-09-24 14:42, Andrew Dunstan wrote: > > > > On 9/24/21 12:49 AM, Platon Pronko wrote: > >> On 2021-09-23 22:28, Andrew Dunstan wrote: > >>> > >>> 2. It would possibly be better to pass the relevant parts of the > options > >>> to print_

Re: using extended statistics to improve join estimates

2021-10-06 Thread Zhihong Yu
On Wed, Oct 6, 2021 at 12:33 PM Tomas Vondra wrote: > Hi, > > attached is an improved version of this patch, addressing some of the > points mentioned in my last message: > > 1) Adds a couple regression tests, testing various join cases with > expressions, additional conditions, etc. > > 2) Adds

Re: Add client connection check during the execution of the query

2021-10-07 Thread Zhihong Yu
On Thu, Oct 7, 2021 at 8:43 PM Thomas Munro wrote: > On Sat, Jun 12, 2021 at 8:31 PM Zhihong Yu wrote: > > +#ifdef POLLRDHUP > > + if ((cur_event->events & WL_SOCKET_CLOSED) && > > + (cur_pollfd->revents & (POLLRDHUP | errf

closing heap relation

2021-07-13 Thread Zhihong Yu
Hi, I was looking at index_drop() in PG 11 branch. In if (concurrent)block, the heap and index relations are overwritten since they were opened a few lines above the concurrent check. Shouldn't the two relations be closed first ? thanks diff --git a/src/backend/catalog/index.c b/src/backend/cata

Re: closing heap relation

2021-07-13 Thread Zhihong Yu
Hi, On Tue, Jul 13, 2021 at 3:13 PM Zhihong Yu wrote: > Hi, > I was looking at index_drop() in PG 11 branch. > In if (concurrent)block, the heap and index relations are overwritten > since they were opened a few lines above the concurrent check. > > Shouldn't the two re

Re: ResourceOwner refactoring

2021-07-14 Thread Zhihong Yu
On Wed, Jul 14, 2021 at 7:40 AM Heikki Linnakangas wrote: > On 14/07/2021 17:07, Alvaro Herrera wrote: > > On 2021-Jul-14, vignesh C wrote: > > > >> On Tue, Mar 9, 2021 at 6:10 PM Heikki Linnakangas > wrote: > > > >>> Here you go. > >> > >> The patch does not apply on Head anymore, could you reb

Re: ResourceOwner refactoring

2021-07-14 Thread Zhihong Yu
On Wed, Jul 14, 2021 at 8:26 AM Heikki Linnakangas wrote: > Thanks for having a look! > > On 14/07/2021 18:18, Zhihong Yu wrote: > > For the loop over the hash: > > > > + for (int idx = 0; idx < capacity; idx++) > > { > > -

Re: Have I found an interval arithmetic bug?

2021-07-14 Thread Zhihong Yu
On Thu, Jul 8, 2021 at 10:22 AM Zhihong Yu wrote: > > > On Wed, Jun 30, 2021 at 9:35 AM Bruce Momjian wrote: > >> On Tue, Jun 29, 2021 at 06:49:45PM +0200, Daniel Gustafsson wrote: >> > > On 29 Jun 2021, at 18:50, Zhihong Yu wrote: >> > >> > &

free C string

2021-07-14 Thread Zhihong Yu
Hi, I was looking at fmgr_internal_validator(). It seems prosrc is only used internally. The patch frees the C string prosrc points to, prior to returning. Please take a look. Thanks free-c-str.patch Description: Binary data

Re: free C string

2021-07-14 Thread Zhihong Yu
On Wed, Jul 14, 2021 at 10:17 AM Tom Lane wrote: > Zhihong Yu writes: > > I was looking at fmgr_internal_validator(). > > It seems prosrc is only used internally. > > The patch frees the C string prosrc points to, prior to returning. > > There's really very

Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers

2021-07-14 Thread Zhihong Yu
On Wed, Jul 14, 2021 at 11:02 AM Alvaro Herrera wrote: > On 2020-Oct-27, Justin Pryzby wrote: > > > I think either way could be ok - if you assume that the trigger was > disabled > > with ONLY, then it'd make sense to restore it with ONLY, but I think > it's at > > least as common to ALTER TABLE

Re: Removing unneeded self joins

2021-07-15 Thread Zhihong Yu
On Thu, Jul 15, 2021 at 7:49 AM Andrey Lepikhov wrote: > On 6/7/21 13:49, Hywel Carver wrote: > > On Mon, Jul 5, 2021 at 2:20 PM Andrey Lepikhov > > mailto:a.lepik...@postgrespro.ru>> wrote: > > Looking through the email chain, a previous version of this patch added > > ~0.6% to planning time in

Re: Removing unneeded self joins

2021-07-15 Thread Zhihong Yu
On Thu, Jul 15, 2021 at 8:25 AM Zhihong Yu wrote: > > > On Thu, Jul 15, 2021 at 7:49 AM Andrey Lepikhov > wrote: > >> On 6/7/21 13:49, Hywel Carver wrote: >> > On Mon, Jul 5, 2021 at 2:20 PM Andrey Lepikhov >> > mailto:a.lepik...@postgrespro.ru>> w

Re: Have I found an interval arithmetic bug?

2021-07-20 Thread Zhihong Yu
On Mon, Jul 19, 2021 at 9:14 PM Bruce Momjian wrote: > On Wed, Jul 14, 2021 at 09:03:21AM -0700, Zhihong Yu wrote: > > On Thu, Jul 8, 2021 at 10:22 AM Zhihong Yu wrote: > > On Wed, Jun 30, 2021 at 9:35 AM Bruce Momjian > wrote: > > > > On Tue, Ju

Re: Have I found an interval arithmetic bug?

2021-07-20 Thread Zhihong Yu
On Tue, Jul 20, 2021 at 3:53 PM Bruce Momjian wrote: > On Tue, Jul 20, 2021 at 02:33:07PM -0700, Zhihong Yu wrote: > > On Mon, Jul 19, 2021 at 9:14 PM Bruce Momjian wrote: > > > Obviously this should return '1 mon 26 days', but with my most > recent > &g

Re: Have I found an interval arithmetic bug?

2021-07-22 Thread Zhihong Yu
On Wed, Jul 21, 2021 at 6:43 PM Bruce Momjian wrote: > On Wed, Jul 21, 2021 at 06:39:26PM -0700, Bryn Llewellyn wrote: > > Your statement > > > > > > “months-to-days conversion is almost always an approximation, while > the > > days to seconds conversion is almost always accurate.” > > >

Re: Have I found an interval arithmetic bug?

2021-07-22 Thread Zhihong Yu
On Thu, Jul 22, 2021 at 2:59 PM Zhihong Yu wrote: > > > On Wed, Jul 21, 2021 at 6:43 PM Bruce Momjian wrote: > >> On Wed, Jul 21, 2021 at 06:39:26PM -0700, Bryn Llewellyn wrote: >> > Your statement >> > >> > >> > “months-to-days conv

Re: Segment fault when excuting SPI function On PG with commit 41c6a5be

2021-07-30 Thread Zhihong Yu
On Fri, Jul 30, 2021 at 3:30 AM Greg Nancarrow wrote: > On Fri, Jul 30, 2021 at 6:57 PM liuhuail...@fujitsu.com > wrote: > > > > When I used SPI_execute_plan function on PG12 which commit 41c6a5be is > used, > > Segment fault occurred. > > I'm not seeing any such commit. > Can you provide a link

Re: Record a Bitmapset of non-pruned partitions

2021-08-01 Thread Zhihong Yu
On Sun, Aug 1, 2021 at 5:31 AM David Rowley wrote: > On Fri, 30 Jul 2021 at 19:10, Amit Langote > wrote: > > > > 0001 looks mostly fine, except I thought the following could be worded > > to say that the bitmap members are offsets into the part_rels array. > > To avoid someone confusing them wit

Re: Implementing Incremental View Maintenance

2021-08-02 Thread Zhihong Yu
On Sun, Aug 1, 2021 at 11:30 PM Yugo NAGATA wrote: > Hi hackers, > > On Mon, 19 Jul 2021 09:24:30 +0900 > Yugo NAGATA wrote: > > > On Wed, 14 Jul 2021 21:22:37 +0530 > > vignesh C wrote: > > > > The patch does not apply on Head anymore, could you rebase and post a > > > patch. I'm changing the

Re: Implementing Incremental View Maintenance

2021-08-06 Thread Zhihong Yu
On Sun, Aug 1, 2021 at 11:30 PM Yugo NAGATA wrote: > Hi hackers, > > On Mon, 19 Jul 2021 09:24:30 +0900 > Yugo NAGATA wrote: > > > On Wed, 14 Jul 2021 21:22:37 +0530 > > vignesh C wrote: > > > > The patch does not apply on Head anymore, could you rebase and post a > > > patch. I'm changing the

Re: Implementing Incremental View Maintenance

2021-08-07 Thread Zhihong Yu
On Sat, Aug 7, 2021 at 12:00 AM Zhihong Yu wrote: > > > On Sun, Aug 1, 2021 at 11:30 PM Yugo NAGATA wrote: > >> Hi hackers, >> >> On Mon, 19 Jul 2021 09:24:30 +0900 >> Yugo NAGATA wrote: >> >> > On Wed, 14 Jul 2021 21:22:37 +0530 >>

Re: Estimating HugePages Requirements?

2021-08-09 Thread Zhihong Yu
On Mon, Aug 9, 2021 at 3:57 PM Bossart, Nathan wrote: > On 6/9/21, 8:09 PM, "Bossart, Nathan" wrote: > > On 6/9/21, 3:51 PM, "Mark Dilger" wrote: > >>> On Jun 9, 2021, at 1:52 PM, Bossart, Nathan > wrote: > >>> > >>> I'd be happy to clean it up and submit it for > >>> discussion in pgsql-hacke

Re: Keep notnullattrs in RelOptInfo (Was part of UniqueKey patch series)

2021-08-15 Thread Zhihong Yu
On Sun, Aug 15, 2021 at 7:33 AM Andy Fan wrote: > Hi: > > I have finished the parts for baserel, joinrel, subquery, distinctrel. I > think > the hardest ones have been verified. Here is the design overview. > > 1. Use EC instead of expr to cover more UniqueKey cases. > 2. Redesign the UniqueKey

Re: Window Function "Run Conditions"

2021-08-16 Thread Zhihong Yu
On Mon, Aug 16, 2021 at 3:28 AM David Rowley wrote: > On Thu, 1 Jul 2021 at 21:11, David Rowley wrote: > > 1) Unsure of the API to the prosupport function. I wonder if the > > prosupport function should just be able to say if the function is > > either monotonically increasing or decreasing or

Re: Allow parallel DISTINCT

2021-08-17 Thread Zhihong Yu
On Mon, Aug 16, 2021 at 10:07 PM David Rowley wrote: > On Wed, 11 Aug 2021 at 16:51, David Rowley wrote: > > The patch is just some plumbing work to connect all the correct paths > > up to make it work. It's all fairly trivial. > > I looked at this patch again and realise that it could be done a

Re: Allow parallel DISTINCT

2021-08-17 Thread Zhihong Yu
On Tue, Aug 17, 2021 at 3:59 AM David Rowley wrote: > On Tue, 17 Aug 2021 at 20:07, Zhihong Yu wrote: > > Can you attach updated patch so that we know more detail about the two > new functions; create_final_distinct_paths and > > create_partial_distinct_paths ? > > Must&

Re: [PATCH] Allow multiple recursive self-references

2021-08-17 Thread Zhihong Yu
On Tue, Aug 17, 2021 at 5:58 AM Denis Hirn wrote: > > The tests fail when you build with assertions enabled (configure > --enable-cassert). > > Thank you for pointing that out. The new version of this patch fixes that. > The tests are working properly now. All style related issues are fixed as >

Re: Allow parallel DISTINCT

2021-08-17 Thread Zhihong Yu
On Tue, Aug 17, 2021 at 1:47 PM David Rowley wrote: > On Wed, 18 Aug 2021 at 02:42, Zhihong Yu wrote: > > Since create_partial_distinct_paths() calls > create_final_distinct_paths(), I wonder if numDistinctRows can be passed to > create_final_distinct_paths() so that the latter

Re: Don't clean up LLVM state when exiting in a bad way

2021-08-18 Thread Zhihong Yu
On Wed, Aug 18, 2021 at 8:01 AM Jelte Fennema wrote: > Hi, > > I ran into some segfaults when using Postgres that was compiled with LLVM > 7. According to the backtraces these crashes happened during the call to > llvm_shutdown, during cleanup after another out of memory condition. It > seems tha

Re: Push down time-related SQLValue functions to foreign server

2021-08-19 Thread Zhihong Yu
On Thu, Aug 19, 2021 at 2:52 AM Alexander Pyhalov wrote: > Hi. > > The attached patches allow pushing down > current_timestamp/localtimestamp/current_time/localtime and now() to > remote PostgreSQL server as locally computed parameters. > The idea is based on oracle_fdw behavior. > > Examples. >

Re: Push down time-related SQLValue functions to foreign server

2021-08-19 Thread Zhihong Yu
On Thu, Aug 19, 2021 at 2:52 AM Alexander Pyhalov wrote: > Hi. > > The attached patches allow pushing down > current_timestamp/localtimestamp/current_time/localtime and now() to > remote PostgreSQL server as locally computed parameters. > The idea is based on oracle_fdw behavior. > > Examples. >

Re: [PATCH] Proof of concept for GUC improvements

2021-08-19 Thread Zhihong Yu
On Thu, Aug 19, 2021 at 3:17 PM David Christensen < david.christen...@crunchydata.com> wrote: > -hackers, > > Enclosed, find a POC patch that implements "special values" for int GUCs. > We have quite a few GUCs > with values that have special meaning atop other settings. I have > attempted to ide

Re: Push down time-related SQLValue functions to foreign server

2021-08-20 Thread Zhihong Yu
On Fri, Aug 20, 2021 at 12:13 AM Alexander Pyhalov wrote: > Hi. > > Ranier Vilela писал 2021-08-19 14:01: > > Em qui., 19 de ago. de 2021 às 07:50, Zhihong Yu > >> Hi, > >> For 0001 patch: > >> > >> + if ((s->op != SVFOP

including pid's for `There are XX other sessions using the database`

2022-08-19 Thread Zhihong Yu
Hi, Currently errdetail_busy_db() only shows the number of other sessions using the database but doesn't give any detail about them. For one of the customers,pg_stat_activity is showing lower number of connections compared to the number revealed in the error message. Looking at CountOtherDBBackend

Re: including pid's for `There are XX other sessions using the database`

2022-08-20 Thread Zhihong Yu
On Fri, Aug 19, 2022 at 9:31 PM Euler Taveira wrote: > On Fri, Aug 19, 2022, at 2:10 PM, Zhihong Yu wrote: > > I want to poll the community on whether including proc->pid's in the error > message would be useful for troubleshooting. > > Such message is only use

timing information for switching database

2022-08-21 Thread Zhihong Yu
Hi, In sqlsh, I issued `\timing on`. I don't see timing information displayed for `\c database`. Does someone know how I can obtain such information ? Thanks

Re: including pid's for `There are XX other sessions using the database`

2022-08-21 Thread Zhihong Yu
On Sun, Aug 21, 2022 at 6:39 AM Julien Rouhaud wrote: > Hi, > > On Sat, Aug 20, 2022 at 02:52:29AM -0700, Zhihong Yu wrote: > > On Fri, Aug 19, 2022 at 9:31 PM Euler Taveira wrote: > > > > > > > Thanks for responding. > > > > Since pg_stat_activi

Re: [BUG] parenting a PK constraint to a self-FK one (Was: Self FK oddity when attaching a partition)

2022-08-23 Thread Zhihong Yu
On Tue, Aug 23, 2022 at 8:07 AM Jehan-Guillaume de Rorthais wrote: > Hi all, > > I've been able to work on this issue and isolate where in the code the > oddity > is laying. > > During ATExecAttachPartition(), AttachPartitionEnsureIndexes() look for > existing > required index on the partition to

Re: [BUG] parenting a PK constraint to a self-FK one (Was: Self FK oddity when attaching a partition)

2022-08-23 Thread Zhihong Yu
On Tue, Aug 23, 2022 at 9:30 AM Alvaro Herrera wrote: > On 2022-Aug-23, Jehan-Guillaume de Rorthais wrote: > > Hi, > > [...] > > > However, it seems get_relation_idx_constraint_oid(), introduced in > eb7ed3f3063, > > assume there could be only ONE constraint depending to an index. But in > fact,

Re: [BUG] parenting a PK constraint to a self-FK one (Was: Self FK oddity when attaching a partition)

2022-08-23 Thread Zhihong Yu
On Tue, Aug 23, 2022 at 9:47 AM Alvaro Herrera wrote: > On 2022-Aug-23, Zhihong Yu wrote: > > > I was thinking of the following patch. > > Basically, if there is only one matching constraint. we still return it. > > > > diff --git a/src/postgres/src/backend/cat

handling multiple matching constraints in DetachPartitionFinalize()

2022-08-23 Thread Zhihong Yu
Hi, I was looking at the following code in DetachPartitionFinalize(): /* If there's a constraint associated with the index, detach it too */ constrOid = get_relation_idx_constraint_oid(RelationGetRelid(partRel), idxid); As mentio

Re: handling multiple matching constraints in DetachPartitionFinalize()

2022-08-23 Thread Zhihong Yu
On Tue, Aug 23, 2022 at 10:10 AM Zhihong Yu wrote: > Hi, > I was looking at the following code in DetachPartitionFinalize(): > > /* If there's a constraint associated with the index, detach it > too */ > constrOid = > get_relation_idx_constraint_oi

Re: handling multiple matching constraints in DetachPartitionFinalize()

2022-08-23 Thread Zhihong Yu
On Tue, Aug 23, 2022 at 10:53 AM Alvaro Herrera wrote: > On 2022-Aug-23, Zhihong Yu wrote: > > > This is what I came up with. > > I suggest you provide a set of SQL commands that provoke some wrong > behavior with the original code, and show that they generate good >

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

2022-08-24 Thread Zhihong Yu
Hi, I was looking at 0004-COPY_IGNORE_ERRORS.patch + * Ignore constraints if IGNORE_ERRORS is enabled + */ +static void +safeExecConstraints(CopyFromState cstate, ResultRelInfo *resultRelInfo, TupleTableSlot *myslot, EState *estate) I think the existing ExecConstraints() can be expanded by checki

Re: Removing unneeded self joins

2022-08-26 Thread Zhihong Yu
Hi, For v36-0001-Remove-self-joins.patch : bq removes inner join of plane table to itself plane table -> plain table For relation_has_unique_index_ext(), it seems when extra_clauses is NULL, there is no need to compute `exprs`. Cheers >

Re: Removing unneeded self joins

2022-08-28 Thread Zhihong Yu
On Fri, Aug 26, 2022 at 3:02 PM Zhihong Yu wrote: > Hi, > For v36-0001-Remove-self-joins.patch : > > bq removes inner join of plane table to itself > > plane table -> plain table > > For relation_has_unique_index_ext(), it seems when extra_clauses is NULL, > ther

Re: cataloguing NOT NULL constraints

2022-08-31 Thread Zhihong Yu
On Wed, Aug 31, 2022 at 3:19 PM Alvaro Herrera wrote: > So I was wrong in thinking that "this case was simple to implement" as I > replied upthread. Doing that actually required me to rewrite large > parts of the patch. I think it ended up being a good thing, because in > hindsight the approach

<    1   2   3   4   5   6   >