Re: pgsql: Centralize json and jsonb handling of datetime types

2018-01-16 Thread Amit Langote
On Wed, Jan 17, 2018 at 9:29 AM, Andrew Dunstan wrote: > Centralize json and jsonb handling of datetime types [ ... ] > src/include/utils/date.h | 4 +- I noticed that these changes cause the following warning to be emitted when compiling with gcc (GCC) 6.2.0: In file included from gram.

Re: pgsql: Centralize json and jsonb handling of datetime types

2018-01-17 Thread Amit Langote
On Wed, Jan 17, 2018 at 5:34 PM, Andrew Dunstan wrote: > > > On 01/17/2018 12:34 AM, Amit Langote wrote: >> On Wed, Jan 17, 2018 at 9:29 AM, Andrew Dunstan wrote: >>> Centralize json and jsonb handling of datetime types >> [ ... ] >> >>> src/include

Re: pgsql: Local partitioned indexes

2018-01-29 Thread Amit Langote
On 2018/01/19 23:55, Alvaro Herrera wrote: > Local partitioned indexes > > Modified Files > -- > doc/src/sgml/catalogs.sgml| 23 + > doc/src/sgml/ref/alter_index.sgml | 14 + > doc/src/sgml/ref/alter_table.sgml | 8 +- > doc/src/sgml/ref/create_index.sgm

Re: pgsql: Local partitioned indexes

2018-02-10 Thread Amit Langote
On Sat, Feb 10, 2018 at 10:09 PM, Alvaro Herrera wrote: > Amit Langote wrote: >> On 2018/01/19 23:55, Alvaro Herrera wrote: >> > Local partitioned indexes > >> I noticed that the declarative partitioning section in ddl.sgml hasn't >> been updated to ref

Re: pgsql: Local partitioned indexes

2018-02-12 Thread Amit Langote
On 2018/02/10 23:32, Amit Langote wrote: > On Sat, Feb 10, 2018 at 10:09 PM, Alvaro Herrera > wrote: >> Amit Langote wrote: >>> On 2018/01/19 23:55, Alvaro Herrera wrote: >>>> Local partitioned indexes >> >>> I noticed that the declarative partitio

Re: pgsql: Reorganize partitioning code

2018-04-14 Thread Amit Langote
Thanks for the commit... On Sun, Apr 15, 2018 at 9:15 AM, Alvaro Herrera wrote: > Reorganize partitioning code > > There's been a massive addition of partitioning code in PostgreSQL 11, > with little oversight on its placement, resulting in a > catalog/partition.c with poorly defined boundaries a

Re: pgsql: Remove useless default clause in switch

2018-04-23 Thread Amit Langote
On 2018/04/24 10:20, Michael Paquier wrote: > On Tue, Apr 24, 2018 at 12:27:27PM +1200, David Rowley wrote: >> I always thought that when all options were covered that we generally >> kept a default just in case someone added another enum and forgot to >> update the code. >> >> I know generally tho

Re: pgsql: Clarify use of temporary tables within partition trees

2018-07-03 Thread Amit Langote
On 2018/07/03 18:05, David Rowley wrote: > (re-adding committers list) > > On 3 July 2018 at 20:31, Amit Langote wrote: >> 1. I still insist that it's better for the newly added code to be near the >> top of the function body than in the middle, which brings me to..

Re: pgsql: Clarify use of temporary tables within partition trees

2018-07-03 Thread Amit Langote
On 2018/07/03 21:15, Ashutosh Bapat wrote: > On Tue, Jul 3, 2018 at 3:20 PM, Amit Langote > wrote: >> >> Maybe because that's what's done for the root parent in a plain >> inheritance hierarchy, which is always a plain table. In that case, one >> RTE is f

Re: pgsql: Clarify use of temporary tables within partition trees

2018-07-03 Thread Amit Langote
On 2018/07/04 1:21, Tom Lane wrote: > Ashutosh Bapat writes: >> On Tue, Jul 3, 2018 at 3:20 PM, Amit Langote >> wrote: >>> Maybe because that's what's done for the root parent in a plain >>> inheritance hierarchy, which is always a plain table. In th

Re: pgsql: Add assertions that we hold some relevant lock during relation o

2018-10-01 Thread Amit Langote
hareLock. This > isn't a full solution, since we can't verify that the lock level is > semantically appropriate for the action --- but it's definitely of > some use, because it's already caught two bugs. > > We can also assert that callers of addRangeTableEntry

Re: pgsql: Set pg_class.relhassubclass for partitioned indexes

2018-10-21 Thread Amit Langote
On 2018/10/22 11:59, Tom Lane wrote: > Michael Paquier writes: >> Set pg_class.relhassubclass for partitioned indexes > > Seems like this commit should have touched the catalogs.sgml description > for that column, as well as the pg_class.h comment for it. Neither of > those are worded in a way t

Re: pgsql: Set pg_class.relhassubclass for partitioned indexes

2018-10-21 Thread Amit Langote
On 2018/10/22 13:35, Michael Paquier wrote: > Amit, Tom, what do you think about the attached? This merges all the > things proposed. Thanks, looks good to me. Regards, Amit

Re: pgsql: Fix typo in documentation of toast storage

2018-11-25 Thread Amit Langote
On 2018/11/26 16:16, Vik Fearing wrote: > On 26/11/2018 07:55, Michael Paquier wrote: >> Fix typo in documentation of toast storage >> >> Author: Nawaz Ahmed >> Discussion: >> https://postgr.es/m/154319327168.1315.1846953598601966...@wrigleys.postgresql.org >> >> Branch >> -- >> master >> >> D

Re: pgsql: Detach constraints when partitions are detached

2019-01-23 Thread Amit Langote
On 2019/01/24 13:58, Tom Lane wrote: > Alvaro Herrera writes: >> Detach constraints when partitions are detached > > Hm ... it looks like this fails under -DRELCACHE_FORCE_RELEASE: Oops, sorry. This is why: index_close(idx, NoLock); ... +if (!idx->rd_index->indisprimary && !id

Re: pgsql: Allow generalized expression syntax for partition bounds

2019-01-25 Thread Amit Langote
On Sat, Jan 26, 2019 at 11:05 Michael Paquier wrote: > On Fri, Jan 25, 2019 at 10:37:22AM +, Peter Eisentraut wrote: > > Allow generalized expression syntax for partition bounds > > > > Previously, only literals were allowed. This change allows general > > expressions, including functions ca

Re: [Suspect SPAM] Re: pgsql: Add pg_partition_root to display top-most parent of a partition

2019-03-21 Thread Amit Langote
Hi, On 2019/03/22 12:55, Michael Paquier wrote: > On Fri, Mar 22, 2019 at 12:26:12AM -0300, Alvaro Herrera wrote: >> I noticed days ago that if you call pg_partition_root on the topmost >> partitioned table, the server crashes :-) I thought we already fixed that last month, but that was pg_partit

Re: pgsql: Add pg_partition_root to display top-most parent of a partition

2019-03-21 Thread Amit Langote
Sorry about the messed up subject string of my previous reply. I failed to notice that our internal mailing software occasionally adds that to email headers before the emails get to my machine. I've been asked to be careful before, but I didn't notice it again today. :-( Thanks, Amit

Re: pgsql: Add pg_partition_root to display top-most parent of a partition

2019-03-21 Thread Amit Langote
On 2019/03/22 13:12, Michael Paquier wrote: > On Fri, Mar 22, 2019 at 01:09:23PM +0900, Amit Langote wrote: >> /* Fetch the top-most parent */ >> ancestors = get_partition_ancestors(relid); >> >> Maybe, the patch should update this comment to say &quo

Re: pgsql: Add pg_partition_root to display top-most parent of a partition

2019-03-22 Thread Amit Langote
On 2019/03/22 14:13, Michael Paquier wrote: > On Fri, Mar 22, 2019 at 01:28:19PM +0900, Amit Langote wrote: >> It looked fine before, but the new lines added by patch makes it look >> wrong/misplaced somehow. > > Okay, what do you think about the attached then? Thanks, looks fine. Regards, Amit

Re: pgsql: Fix plan created for inherited UPDATE/DELETE with all tables exc

2019-04-17 Thread Amit Langote
On 2019/02/23 2:23, Tom Lane wrote: > Fix plan created for inherited UPDATE/DELETE with all tables excluded. > > In the case where inheritance_planner() finds that every table has > been excluded by constraints, it thought it could get away with > making a plan consisting of just a dummy Result no

Re: pgsql: Fix plan created for inherited UPDATE/DELETE with all tables exc

2019-04-19 Thread Amit Langote
On 2019/04/19 4:41, Tom Lane wrote: > Amit Langote writes: >> On 2019/02/23 2:23, Tom Lane wrote: >>> Fix plan created for inherited UPDATE/DELETE with all tables excluded. > >> I noticed that we may have forgotten to fix one more thing in this commit >> -- nom

Re: pgsql: Allow insert and update tuple routing and COPY for foreign table

2019-04-21 Thread Amit Langote
Hi, On 2019/04/20 20:53, Laurenz Albe wrote: > On Fri, 2018-04-06 at 23:24 +, Robert Haas wrote: >> Allow insert and update tuple routing and COPY for foreign tables. >> >> Also enable this for postgres_fdw. >> >> Etsuro Fujita, based on an earlier patch by

Re: pgsql: Allow insert and update tuple routing and COPY for foreign table

2019-04-23 Thread Amit Langote
On 2019/04/22 21:45, Etsuro Fujita wrote: > (2019/04/20 20:53), Laurenz Albe wrote: >> I propose that PostgreSQL only allows COPY FROM on a foreign table if >> the FDW >> implements BeginForeignInsert.  The attached patch implements that. > > I don't think that is a good idea, because there might

Re: pgsql: Allow insert and update tuple routing and COPY for foreign table

2019-04-25 Thread Amit Langote
Fujita-san, On 2019/04/25 22:17, Etsuro Fujita wrote: > (2019/04/24 22:04), Laurenz Albe wrote: >>    Before PostgreSQL v11, a foreign data wrapper could be certain that >>    BeginForeignModify is always called before ExecForeignInsert. >>    This is no longer true. > > OK, how about something l

Re: pgsql: docs: fist draft version of the PG 12 release notes

2019-05-07 Thread Amit Langote
rmance of pruning many partitions (Amit Langote, David Rowley, Tom Lane, Álvaro Herrera) + + + +Now thousands of partitions can be pruned efficiently. + + I think there may be two (or more) distinct improvements here. * Performance of "pruning" itself which was bottle-necked in the

Re: pgsql: docs: fist draft version of the PG 12 release notes

2019-05-09 Thread Amit Langote
ere? So the current text, which is: + +Improve performance of pruning many partitions (Amit Langote, David Rowley, Tom Lane, Álvaro Herrera) + + + +Now thousands of partitions can be pruned efficiently. + + mentions improving "pruning" efficiency which applies only to SELECT/UPDATE/DEL

Re: pgsql: docs: fist draft version of the PG 12 release notes

2019-05-13 Thread Amit Langote
on partitioned tables (Amit > Langote, David Rowley, Tom Lane, Álvaro Herrera) > > Also, thousands of partitions can now be pruned efficiently. > > Committed. Thanks. > Does that work? That's better, but the second line still just mentions pruning eff

Re: pgsql: Fix partitioned index creation with foreign partitions

2019-06-26 Thread Amit Langote
On Thu, Jun 27, 2019 at 8:04 AM Alvaro Herrera wrote: > > On 2019-Jun-26, Alvaro Herrera wrote: > > > Fix partitioned index creation with foreign partitions > > Hmm, so this causes prion to fail, because -DFORCE_RELCACHE_RELEASE: it > reports the immediate parent of the would-be-partition rather t

Re: pgsql: Fix segfault during EvalPlanQual with mix of local and foreign p

2021-09-06 Thread Amit Langote
ignScan should never be called. +*/ The 2nd sentence seems to be missing a "be" between "can" and "ForeignScan". Also, does it mean the following? "There can be ForeignScan nodes in the EvalPlanQual plan subtree, but ExecForeignScan should never be call

Re: pgsql: Create foreign key triggers in partitioned tables too

2022-01-10 Thread Amit Langote
7 to update this to mention tgisinternal's relation to partitioning? -- Amit Langote EDB: http://www.enterprisedb.com

Re: pgsql: Split ExecUpdate and ExecDelete into reusable pieces

2022-03-18 Thread Amit Langote
that and an old typo in the same sentence. -- Amit Langote EDB: http://www.enterprisedb.com fix-obsolete-comment.patch Description: Binary data

Re: pgsql: Split ExecUpdate and ExecDelete into reusable pieces

2022-03-18 Thread Amit Langote
On Sat, Mar 19, 2022 at 12:59 PM Amit Langote wrote: > On Thu, Mar 17, 2022 at 7:47 PM Alvaro Herrera > wrote: > > > > Split ExecUpdate and ExecDelete into reusable pieces > > > > Create subroutines ExecUpdatePrologue / ExecUpdateAct / > > ExecUpdate

Re: pgsql: Add isolation tests for snapshot behavior in ri_triggers.c

2022-04-10 Thread Amit Langote
I wonder if it might be better to add this suite with the (yet unwritten) patch to fix the bug mentioned in the above commit message, which will likely be back-ported. -- Amit Langote EDB: http://www.enterprisedb.com

Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL

2019-09-17 Thread Amit Langote
Hi Alvaro, On Sat, Sep 14, 2019 at 2:59 AM Alvaro Herrera wrote: > > Fix progress reporting of CLUSTER / VACUUM FULL > > The progress state was being clobbered once the first index completed > being rebuilt, causing the final phases of the operation not show > anything in the progress view. This

Re: pgsql: Add backtrace support for error reporting

2019-11-08 Thread Amit Langote
On Sat, Nov 9, 2019 at 3:52 Alvaro Herrera wrote: > Add backtrace support for error reporting Yay, thanks! - Amit

Re: pgsql: Refactor attribute mappings used in logical tuple conversion

2019-12-18 Thread Amit Langote
On Wed, Dec 18, 2019 at 11:37 PM Tom Lane wrote: > TBH, though, I wonder if this doesn't indicate you've put this > function in the wrong header to begin with. Why does it belong > in rewriteManip? Assuming you are talking about map_variable_attnos(), it's always been in rewriteManip.c / rewrite

Re: pgsql: Allow publishing partition changes via ancestors

2020-04-09 Thread Amit Langote
s. It uses > -DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE, not sure if this > could affect the result. Patch to fix that has been posted on the -hackers thread: https://www.postgresql.org/message-id/04d78603-edae-9243-9dde-fe3037176a7d%402ndquadrant.com -- Amit Langote EnterpriseDB: http://www.enterprisedb.com

Re: pgsql: Fix relcache reference leak

2020-04-11 Thread Amit Langote
On Sat, Apr 11, 2020 at 4:54 PM Peter Eisentraut wrote: > > Fix relcache reference leak > > Introduced by 83fd4532a72179c370e318075a10e0e2aa832024 Thank you Peter. I had noticed that leak warning but forgot to do anything about it. -- Amit Langote EnterpriseDB: http://www.enterprisedb.com

Re: pgsql: New C function: bms_add_range

2017-11-29 Thread Amit Langote
On 2017/11/30 7:12, Robert Haas wrote: > New C function: bms_add_range > > This will be used by pending patches to improve partition pruning. > > Amit Langote and Kyotaro Horiguchi, per a suggestion from David > Rowley. Review and testing of the larger patch set of which t

Re: pgsql: Expand AclMode to 64 bits

2022-11-24 Thread Amit Langote
|| $t eq 'SubTransactionId') @@ -962,7 +961,8 @@ _read${n}(void) print $off "\tWRITE_UINT_FIELD($f);\n"; print $rff "\tREAD_UINT_FIELD($f);\n" unless $no_read; } - elsif ($t eq 'uint64') + elsif ($t eq

Re: pgsql: Improve handling of inherited GENERATED expressions.

2023-01-12 Thread Amit Langote
st_normal_child" ( > > "a" integer, > > "b" integer GENERATED ALWAYS AS (("a" * 2)) STORED > > ); > > -- For binary upgrade, set up inheritance this way. > > ALTER TABLE ONLY "public"."gtest_normal_child" INHERIT > "public"."gtest_normal"; IIUC, by deciding to not back-patch this, we're expecting the user to fix any child tables in the old cluster that have unsupported (in v16) properties before upgrading to v16, right? If that is indeed the case, maybe this is again a case where TestUpgradeXversion.pm needs tweaking? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: pgsql: Improve handling of inherited GENERATED expressions.

2023-01-12 Thread Amit Langote
gt; quasi-urgent BF fixes, maybe the thing to do is to roll up a release > > now and then work on the bigger idea at leisure. > > > > > > > Thanks, that's almost exactly what I did to turn crake green. > > I'll push out a release tomorrow. Thanks to both of you. > -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

pgsql: Retain relkind too in RTE_SUBQUERY entries for views.

2023-06-14 Thread Amit Langote
Retain relkind too in RTE_SUBQUERY entries for views. 47bb9db75 modified the ApplyRetrieveRule()'s conversion of a view's original RTE_RELATION entry into an RTE_SUBQUERY one to retain relid, rellockmode, and perminfoindex so that the executor can lock the view and check its permissions. It seems

pgsql: Remove outdated reference to a removed file

2023-06-15 Thread Amit Langote
Remove outdated reference to a removed file parse_jsontable.c was removed as part of 2f2b18bd3f55, though its mention in src/backend/parser/README was not. Fix that. Discussion: https://postgr.es/m/CA%2BHiwqHDzw8AP8p_dEkFr0xg458ZTf58zbivAHhK4UeNrx9Tdg%40mail.gmail.com Branch -- master Det

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/35470357ee4c6f05b78926d3e07a45d8

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/160c23b5fa0243d2f743cc70c96dac44d993264

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/3f157d085bd72a69fabd6e2621800204

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d5300bc79dff0ada2132d82d59dfe170

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/2f6e826f65798ccdb3860f346e9bef58

pgsql: Fix typo in comment.

2023-06-15 Thread Amit Langote
Fix typo in comment. Back-patch down to 11. Author: Sho Kato () Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b103d616caeb6a06e9391be1cb1e7483

pgsql: Add a test case for a316a3bc

2023-06-29 Thread Amit Langote
Add a test case for a316a3bc a316a3bc fixed the code in build_simpl_rel() that propagates RelOptInfo.userid from parent to child rels so that it works correctly for the child rels of a UNION ALL subquery rel, though no tests were added in that commit. So do so here. As noted in the discussion, c

pgsql: Add a test case for a316a3bc

2023-06-29 Thread Amit Langote
Add a test case for a316a3bc a316a3bc fixed the code in build_simpl_rel() that propagates RelOptInfo.userid from parent to child rels so that it works correctly for the child rels of a UNION ALL subquery rel, though no tests were added in that commit. So do so here. As noted in the discussion, c

pgsql: Pass constructName to transformJsonValueExpr()

2023-07-12 Thread Amit Langote
Pass constructName to transformJsonValueExpr() This allows it to pass to coerce_to_specific_type() the actual name corresponding to the specific JSON_* function expression being transformed, instead of the currently hardcoded string. Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/C

pgsql: Don't include CaseTestExpr in JsonValueExpr.formatted_expr

2023-07-12 Thread Amit Langote
Don't include CaseTestExpr in JsonValueExpr.formatted_expr A CaseTestExpr is currently being put into JsonValueExpr.formatted_expr as placeholder for the result of evaluating JsonValueExpr.raw_expr, which in turn is evaluated separately. Though, there's no need for this indirection if raw_expr it

pgsql: Fix code indentation violation in commit b6e1157e7d

2023-07-13 Thread Amit Langote
Fix code indentation violation in commit b6e1157e7d Per buildfarm member koel via Andrew Dunstan. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/328f492d2565cfbe383f13a69425d751fd79415f Modified Files -- src/backend/parser/parse_expr.c | 7 --- 1 fi

Re: pgsql: Don't include CaseTestExpr in JsonValueExpr.formatted_expr

2023-07-13 Thread Amit Langote
On Thu, Jul 13, 2023 at 5:12 PM Michael Paquier wrote: > > Hi Amit, > > On Thu, Jul 13, 2023 at 03:33:07AM +, Amit Langote wrote: > > Don't include CaseTestExpr in JsonValueExpr.formatted_expr > > > > A CaseTestExpr is currently being put into > > Js

pgsql: Add missing const qualifier

2023-07-13 Thread Amit Langote
Add missing const qualifier Missed in commit 785480c9533d9. Pointed out by Tom Lane. Discussion: https://postgr.es/m/2795364.1689221300%40sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/40b3af72a787e5c7c842651a2e04e3f856b9460c Modified Files ---

Re: pgsql: Pass constructName to transformJsonValueExpr()

2023-07-13 Thread Amit Langote
On Thu, Jul 13, 2023 at 1:08 PM Tom Lane wrote: > Amit Langote writes: > > Pass constructName to transformJsonValueExpr() > > Surely "char *constructName" should be "const char *constructName"? Right you are. Fixed. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

pgsql: Add missing initializations of p_perminfo

2023-07-13 Thread Amit Langote
Add missing initializations of p_perminfo In a61b1f74823, we failed to update transformFromClauseItem() and buildNSItemFromLists() to set ParseNamespaceItem.p_perminfo causing it to point to garbage. Pointed out by Tom Lane. Reported-by: Farias de Oliveira Discussion: https://postgr.es/m/317347

pgsql: Add missing initializations of p_perminfo

2023-07-13 Thread Amit Langote
Add missing initializations of p_perminfo In a61b1f74823, we failed to update transformFromClauseItem() and buildNSItemFromLists() to set ParseNamespaceItem.p_perminfo causing it to point to garbage. Pointed out by Tom Lane. Reported-by: Farias de Oliveira Discussion: https://postgr.es/m/317347

pgsql: Pass constructName to transformJsonValueExpr()

2023-07-20 Thread Amit Langote
Pass constructName to transformJsonValueExpr() This allows it to pass to coerce_to_specific_type() the actual name corresponding to the specific JSON_* function expression being transformed, instead of the currently hardcoded string. Backpatched to 16 from the development branch to keep the code

pgsql: Unify JSON categorize type API and export for external use

2023-07-20 Thread Amit Langote
Unify JSON categorize type API and export for external use This essentially removes the JsonbTypeCategory enum and jsonb_categorize_type() and integrates any jsonb-specific logic that was in jsonb_categorize_type() into json_categorize_type(), now moved to jsonfuncs.c. The remaining JsonTypeCateg

pgsql: Don't include CaseTestExpr in JsonValueExpr.formatted_expr

2023-07-21 Thread Amit Langote
Don't include CaseTestExpr in JsonValueExpr.formatted_expr A CaseTestExpr is currently being put into JsonValueExpr.formatted_expr as placeholder for the result of evaluating JsonValueExpr.raw_expr, which in turn is evaluated separately. Though, there's no need for this indirection if raw_expr it

pgsql: Code review for commit b6e1157e7d

2023-07-21 Thread Amit Langote
Code review for commit b6e1157e7d b6e1157e7d made some changes to enforce that JsonValueExpr.formatted_expr is always set and is the expression that gives a JsonValueExpr its runtime value, but that's not really apparent from the comments about and the code manipulating formatted_expr. This commi

pgsql: Rename a nonterminal used in SQL/JSON grammar

2023-07-26 Thread Amit Langote
Rename a nonterminal used in SQL/JSON grammar This renames json_output_clause_opt to json_returning_clause_opt, because the new name makes more sense given that the governing keyword is RETURNING. Per suggestion from Álvaro Herrera. Discussion: https://postgr.es/m/20230707122820.wy5zlmhn4tdzbojl

pgsql: Some refactoring to export json(b) conversion functions

2023-07-26 Thread Amit Langote
Some refactoring to export json(b) conversion functions This is to export datum_to_json(), datum_to_jsonb(), and jsonb_from_cstring(), though the last one is exported as jsonb_from_text(). A subsequent commit to add new SQL/JSON constructor functions will need them for calling from the executor.

pgsql: Add more SQL/JSON constructor functions

2023-07-26 Thread Amit Langote
dling. Catversion bumped as this changes ruleutils.c. Author: Nikita Glukhov Author: Teodor Sigaev Author: Oleg Bartunov Author: Alexander Korotkov Author: Andrew Dunstan Author: Amit Langote Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, A

pgsql: doc: add missing and whitespace

2023-07-28 Thread Amit Langote
doc: add missing and whitespace Missed in commit 03734a7fed. Author: Shinoda, Noriyoshi Discussion: https://postgr.es/m/DM4PR84MB1734E58BB4DC0E1B6E2990EBEE01A%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e055b6be7ebb0

pgsql: Remove obsolete executor cleanup code

2023-09-27 Thread Amit Langote
Remove obsolete executor cleanup code This commit removes unnecessary ExecExprFreeContext() calls in ExecEnd* routines because the actual cleanup is managed by FreeExecutorState(). With no callers remaining for ExecExprFreeContext(), this commit also removes the function. This commit also drops r

Re: pgsql: Remove obsolete executor cleanup code

2023-09-27 Thread Amit Langote
On Thu, Sep 28, 2023 at 10:08 AM Tom Lane wrote: > Amit Langote writes: > > After these modifications, the ExecEnd*() routines for ValuesScan, > > NamedTuplestoreScan, and WorkTableScan became redundant. So, this > > commit removes them. > > This seems lik

pgsql: Add soft error handling to some expression nodes

2023-10-01 Thread Amit Langote
Add soft error handling to some expression nodes This adjusts the expression evaluation code for CoerceViaIO and CoerceToDomain to handle errors softly if needed. For CoerceViaIo, this means using InputFunctionCallSafe(), which provides the option to handle errors softly, instead of calling the t

pgsql: Revert "Add soft error handling to some expression nodes"

2023-10-01 Thread Amit Langote
Revert "Add soft error handling to some expression nodes" This reverts commit 7fbc75b26ed8ec70c729c5e7f8233896c54c900f. Looks like the LLVM additions may not be totally correct. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c8ec5e0543b90372c8e6d5cc2cd3d2ff89ca0e8

pgsql: Prevent duplicate RTEPermissionInfo for plain-inheritance parent

2023-10-25 Thread Amit Langote
Prevent duplicate RTEPermissionInfo for plain-inheritance parents Currently, expand_single_inheritance_child() doesn't reset perminfoindex in a plain-inheritance parent's child RTE, because prior to 387f9ed0a0, the executor would use the first child RTE to locate the parent's RTEPermissionInfo. T

pgsql: Prevent duplicate RTEPermissionInfo for plain-inheritance parent

2023-10-25 Thread Amit Langote
Prevent duplicate RTEPermissionInfo for plain-inheritance parents Currently, expand_single_inheritance_child() doesn't reset perminfoindex in a plain-inheritance parent's child RTE, because prior to 387f9ed0a0, the executor would use the first child RTE to locate the parent's RTEPermissionInfo. T

Re: pgsql: Prevent duplicate RTEPermissionInfo for plain-inheritance parent

2023-10-26 Thread Amit Langote
On Thu, Oct 26, 2023 at 3:08 PM David Rowley wrote: > On Thu, 26 Oct 2023 at 15:59, Amit Langote wrote: > > src/backend/optimizer/util/inherit.c | 9 ++--- > > Hi Amit, > > I'm getting an unused variable warning from this with non-assert builds: > > [697/1908]

Re: pgsql: Prevent duplicate RTEPermissionInfo for plain-inheritance parent

2023-10-26 Thread Amit Langote
On Thu, Oct 26, 2023 at 4:59 PM Amit Langote wrote: > On Thu, Oct 26, 2023 at 3:08 PM David Rowley wrote: > > On Thu, 26 Oct 2023 at 15:59, Amit Langote wrote: > > > src/backend/optimizer/util/inherit.c | 9 ++--- > > > > Hi Amit, > > > > I'm ge

pgsql: Avoid compiler warning in non-assert builds

2023-10-26 Thread Amit Langote
Avoid compiler warning in non-assert builds After 01575ad788e3, expand_single_inheritance_child()'s parentOID variable is read only in an Assert, provoking a compiler warning in non-assert builds. Fix that by marking the variable with PG_USED_FOR_ASSERTS_ONLY. Per report and suggestion from Davi

pgsql: Avoid compiler warning in non-assert builds

2023-10-26 Thread Amit Langote
Avoid compiler warning in non-assert builds After 01575ad788e3, expand_single_inheritance_child()'s parentOID variable is read only in an Assert, provoking a compiler warning in non-assert builds. Fix that by marking the variable with PG_USED_FOR_ASSERTS_ONLY. Per report and suggestion from Davi

pgsql: Add soft error handling to some expression nodes

2024-01-23 Thread Amit Langote
y functions. Author: Nikita Glukhov Author: Teodor Sigaev Author: Oleg Bartunov Author: Alexander Korotkov Author: Andrew Dunstan Author: Amit Langote Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu, Himans

pgsql: Adjust populate_record_field() to handle errors softly

2024-01-23 Thread Amit Langote
query functions. Author: Nikita Glukhov Author: Teodor Sigaev Author: Oleg Bartunov Author: Alexander Korotkov Author: Andrew Dunstan Author: Amit Langote Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu

pgsql: Refactor code used by jsonpath executor to fetch variables

2024-01-23 Thread Amit Langote
Author: Amit Langote Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby, Álvaro Herrera, Jian He, Peter Eisentraut Discussion: https://postgr.es/m/cd0bb935

pgsql: Silence compiler warning introduced in 1edb3b491b

2024-01-25 Thread Amit Langote
Silence compiler warning introduced in 1edb3b491b Reported-by: Richard Guo Discussion: https://postgr.es/m/cambws48qeoe9du5tuuxrkgq6vc9oy+tqoorq6jpob14-e1z...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fba2112b1569fd001a9e54dfdd73fd3cb8f16140

pgsql: Add SQL/JSON query functions

2024-03-21 Thread Amit Langote
evaluation, respectively. Author: Nikita Glukhov Author: Teodor Sigaev Author: Oleg Bartunov Author: Alexander Korotkov Author: Andrew Dunstan Author: Amit Langote Author: Peter Eisentraut Author: Jian He Reviewers have included (in no particular order): Andres Freund, Alexander Korotkov

pgsql: Avoid splitting errmsg string to span multiple lines

2024-03-21 Thread Amit Langote
Avoid splitting errmsg string to span multiple lines The error message being fixed was added in 6185c9737c. While at it, add an "a" to the sentence. Reported-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/20240322.095149.895185546948714852.horikyota.ntt%40gmail.com Branch -- master

pgsql: Do not translate dummy SpecialJoinInfos for child joins

2024-03-25 Thread Amit Langote
t end, this commit moves the code to initialize the dummy SpecialJoinInfos to a new function named init_dummy_sjinfo() and changes the few existing sites that have this code and build_child_join_sjinfo() to call this new function. Author: Ashutosh Bapat Reviewed-by: Richard Guo Reviewed-by:

pgsql: Reduce memory used by partitionwise joins

2024-03-25 Thread Amit Langote
s no handy function to free the memory of Node trees. Author: Ashutosh Bapat Reviewed-by: Richard Guo Reviewed-by: Amit Langote Reviewed-by: Andrey Lepikhov Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/caexhw5thqef3asvqvffcghygpfpy7o3xnvhhwbgbjfmrh8k...@mail.gmail.com Branch ---

Re: pgsql: Do not translate dummy SpecialJoinInfos for child joins

2024-03-25 Thread Amit Langote
On Mon, Mar 25, 2024 at 6:08 PM Amit Langote wrote: > Do not translate dummy SpecialJoinInfos for child joins > > This teaches build_child_join_sjinfo() to create the dummy > SpecialJoinInfos (those created for inner joins) directly for a given > child join, skipping the unnecess

pgsql: Code review for 6190d828cd2

2024-03-25 Thread Amit Langote
Code review for 6190d828cd2 * Fix the comment of init_dummy_sjinfo() to remove references to non-existing parameters 'rel1' and 'rel2'. * Adjust consider_new_or_clause() to call init_dummy_sjinfo() to make up a SpecialJoinInfo for inner joins like other code sites that were adjusted in 6190

pgsql: Add basic JSON_TABLE() functionality

2024-04-04 Thread Amit Langote
Author: Andrew Dunstan Author: Amit Langote Author: Jian He Reviewers have included (in no particular order): Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby, Álvaro Herrera, Jian He Discussion: htt

pgsql: Fix typo introduced in 6185c9737

2024-04-04 Thread Amit Langote
Fix typo introduced in 6185c9737 Reported-by: Jian He Discussion: https://postgr.es/m/cacjufxghiu0p0usjh5hnr0_byzn4tq1fc3ekatrqgjeku6w...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2f6e78b0619a0ee2ca170e0073659581847ee73d Modified Files --

pgsql: Add missing initialization in transformJsonFuncExpr()

2024-04-04 Thread Amit Langote
Add missing initialization in transformJsonFuncExpr() de3600452b added some code for the new JSON_TABLE_OP to that function but missed to initialize the default_format variable. Reported-by: Erik Rijkers Discussion: https://postgr.es/m/254b2fa2-2f6b-a30a-20ee-21f8a2c12...@xs4all.nl Branch -

Re: pgsql: Add basic JSON_TABLE() functionality

2024-04-04 Thread Amit Langote
Hi Erik On Thu, Apr 4, 2024 at 9:30 PM Erik Rijkers wrote: > Op 4/4/24 om 13:21 schreef Amit Langote: > > Add basic JSON_TABLE() functionality > > > > Great that it's now committed. Congrats! > > > There is one 'uninitialized' muttering

Re: pgsql: Add basic JSON_TABLE() functionality

2024-04-04 Thread Amit Langote
Hi Andrew, On Thu, Apr 4, 2024 at 10:06 PM Andrew Dunstan wrote: > On 2024-04-04 Th 07:21, Amit Langote wrote: > > Add basic JSON_TABLE() functionality > > > Excellent! > > But I am getting this: > > ../../../src/interfaces/ecpg/test/sql/sqljson_jsontable.pgc:23: W

Re: pgsql: Add basic JSON_TABLE() functionality

2024-04-04 Thread Amit Langote
entries as well. Just to make a correction to what I said upthread in reply to Andrew, it seems like I did get the WARNING but missed it. Wonder if, for consistency, I should change the coding so that the FEATURE_NOT_SUPPORTED is reported in transformJsonTable() or something? -- Thanks, Amit Langote

Re: pgsql: Add basic JSON_TABLE() functionality

2024-04-04 Thread Amit Langote
On Fri, Apr 5, 2024 at 11:56 AM Tom Lane wrote: > Amit Langote writes: > > Wonder if, for consistency, I should change the coding so that the > > FEATURE_NOT_SUPPORTED is reported in transformJsonTable() or > > something? > > Consistency with what? There are plenty

pgsql: JSON_TABLE: Add support for NESTED paths and columns

2024-04-08 Thread Amit Langote
eodor Sigaev Author: Oleg Bartunov Author: Alexander Korotkov Author: Andrew Dunstan Author: Amit Langote Author: Jian He Reviewers have included (in no particular order): Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gusta

pgsql: Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly

2024-04-08 Thread Amit Langote
Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly Currently, get_json_expr_options() does not emit the default values for QUOTES (KEEP QUOTES) and WRAPPER (WITHOUT WRAPPER). That causes the deparsed JSON_TABLE() columns, such as those contained in a a view's query, to behave differently

pgsql: Fix restriction on specifying KEEP QUOTES in JSON_QUERY()

2024-04-08 Thread Amit Langote
Fix restriction on specifying KEEP QUOTES in JSON_QUERY() Currently, transformJsonFuncExpr() enforces some restrictions on the combinations of QUOTES and WRAPPER clauses that can be specified in JSON_QUERY(). The intent was to only prevent the useless combination WITH WRAPPER OMIT QUOTES, but the

pgsql: SQL/JSON: Miscellaneous fixes and improvements

2024-04-17 Thread Amit Langote
SQL/JSON: Miscellaneous fixes and improvements This addresses some post-commit review comments for commits 6185c973, de3600452, and 9425c596a0, with the following changes: * Fix JSON_TABLE() syntax documentation to use the term "path_expression" for JSON path expressions instead of "json_path

  1   2   3   >