Re: real/float example for testlibpq3

2022-02-28 Thread Ashutosh Bapat
instead of char *. That will standardize the way to fetch real typed values in libpq. That leads to the next question. Do we need to introduce different PQget*value() for standard C/SQL data types. -- Best Wishes, Ashutosh Bapat On Fri, Feb 25, 2022 at 3:12 AM Mark Wong wrote: > > Hi every

Re: Handle infinite recursion in logical replication setup

2022-03-07 Thread Ashutosh Bapat
Hi Vignesh, I agree with Peter's comment that the changes to FilterRemoteOriginData() should be part of FilterByOrigin() Further, I wonder why "onlylocal_data" is a replication slot's property. A replication slot tracks the progress of replication and it may be used by different receivers with dif

unnecessary (same) restart_lsn handing in LogicalIncreaseRestartDecodingForSlot

2022-03-16 Thread Ashutosh Bapat
ndidate_restart_valid. Every installed candidate is updated in the slot by LogicalConfirmReceivedLocation() when the next confirmed flush arrives. Such an update also causes a disk write which looks unnecessary. I think the function should ignore a restart_lsn older than data.restart_lsn right away at the beginning of this function. -- Best Wishes, Ashutosh Bapat

Support isEmptyStringInfo

2022-03-23 Thread Ashutosh Bapat
t included those changes in this patch. I can do that if hackers like the idea. -- Best Wishes, Ashutosh Bapat From 0ff57f4b8f0094d581806f5553397c286736 Mon Sep 17 00:00:00 2001 From: Ashutosh Bapat Date: Wed, 23 Mar 2022 17:40:44 +0530 Subject: [PATCH] isEmptyStringInfo() to check whether Stri

Re: Cost overestimation of foreign JOIN

2020-12-01 Thread Ashutosh Bapat
large queries, you could set use_remote_estimate at table level to turn it off for the first set. Otherwise, we need a FDW level GUC which can be turned on/off for a given session or a query. Generally use_remote_estimate isn't scalable and there have been discussions about eliminating the need of it. But no concrete proposal has come yet. -- Best Wishes, Ashutosh Bapat

Re: Printing LSN made easy

2020-12-02 Thread Ashutosh Bapat
On Mon, Nov 30, 2020 at 7:38 PM Li Japin wrote: > Hi, > > On Nov 30, 2020, at 9:06 PM, Ashutosh Bapat > wrote: > > On Fri, Nov 27, 2020 at 9:51 PM Li Japin wrote: > > > Hi, > > Here, we cannot use sizeof(but) to get the buf size, because it is a > pointer, s

Re: Printing LSN made easy

2020-12-02 Thread Ashutosh Bapat
On Mon, Nov 30, 2020 at 8:07 PM Alvaro Herrera wrote: > On 2020-Nov-30, Ashutosh Bapat wrote: > > > Peter Eisentraut explained that the translation system can not handle > > strings broken by macros, e.g. errmsg("foo" MACRO "bar"), since it > doesn'

Re: Single transaction in the tablesync worker?

2020-12-03 Thread Ashutosh Bapat
log or not. I assume we will. Whereas if we apply all the changes in one go, other transactions either see the data before resync or after it without any intermediate states. That will not violate consistency, I think. That's all I can think of as the reason behind doing a whole resync as a single transaction. -- Best Wishes, Ashutosh Bapat

Re: Single transaction in the tablesync worker?

2020-12-04 Thread Ashutosh Bapat
On Thu, Dec 3, 2020 at 7:24 PM Amit Kapila wrote: > > On Thu, Dec 3, 2020 at 7:04 PM Ashutosh Bapat > wrote: > > > > On Thu, Dec 3, 2020 at 2:55 PM Amit Kapila wrote: > > > > > > The tablesync worker in logical replication performs the table data > &g

Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

2020-12-07 Thread Ashutosh Bapat
use Pathkeys with reduced strength. But that might affect a lot of places which depend upon stronger pathkeys. -- Best Wishes, Ashutosh Bapat

Re: Insert Documentation - Returning Clause and Order

2020-12-10 Thread Ashutosh Bapat
he order of output rows will match the order that rows are presented in the > values or query clause. Postgres's current implementation may be doing so, but I don't think that can be guaranteed in possible implementations. I don't think restricting choice of implementation to gu

Re: Insert Documentation - Returning Clause and Order

2020-12-11 Thread Ashutosh Bapat
On Thu, Dec 10, 2020 at 7:49 PM David G. Johnston wrote: > > On Thursday, December 10, 2020, Ashutosh Bapat > wrote: >> >> On Wed, Dec 9, 2020 at 9:10 PM David G. Johnston >> wrote: >> > >> > Hey, >> > >> > Would it be accurate

Misleading comment in prologue of ReorderBufferQueueMessage

2020-12-14 Thread Ashutosh Bapat
The name of the function suggests that the given message will be queued in ReorderBuffer. The prologue of the function says so too 776 /* 777 * Queue message into a transaction so it can be processed upon commit. 778 */ It led me to think that a non-transactional message is processed along wit

Re: Insert Documentation - Returning Clause and Order

2020-12-14 Thread Ashutosh Bapat
on would restrict implementation. So at best we can say "no order is guaranteed". But we write what's guaranteed. Anything not written in the documents is not guaranteed. There are ways to get it working, but let's not go into those details in this thread. -- Best Wishes, Ashutosh Bapat

Re: Misleading comment in prologue of ReorderBufferQueueMessage

2020-12-14 Thread Ashutosh Bapat
On Mon, Dec 14, 2020 at 3:14 PM Amit Kapila wrote: > On Mon, Dec 14, 2020 at 2:45 PM Ashutosh Bapat > wrote: > > > > The name of the function suggests that the given message will be queued > in ReorderBuffer. The prologue of the function says so too > > 776 /* >

Re: Misleading comment in prologue of ReorderBufferQueueMessage

2020-12-18 Thread Ashutosh Bapat
On Wed, Dec 16, 2020 at 8:00 AM Amit Kapila wrote: > On Tue, Dec 15, 2020 at 11:25 AM Ashutosh Bapat > wrote: > > > > On Mon, Dec 14, 2020 at 3:14 PM Amit Kapila > wrote: > >> > >> On Mon, Dec 14, 2020 at 2:45 PM Ashutosh Bapat > >> wrote: >

Re: Feature request: Connection string parsing for postgres_fdw

2020-12-23 Thread Ashutosh Bapat
ttps://www.postgresql.org/docs/13/postgres-fdw.html#id-1.11.7.42.11. I haven't tried this myself. But this might help you. -- Best Wishes, Ashutosh Bapat

Re: Feature request: Connection string parsing for postgres_fdw

2020-12-24 Thread Ashutosh Bapat
On Wed, Dec 23, 2020 at 7:42 PM Eric Hanson wrote: > > > > On Wed, Dec 23, 2020 at 5:39 AM Ashutosh Bapat > wrote: >> >> https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-PARAMKEYWORDS >> lists the parameters that postgres_fdw accepts. "dbname

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

2021-02-11 Thread Ashutosh Bapat
On Thu, Feb 11, 2021 at 8:22 PM Tom Lane wrote: > > Ashutosh Bapat writes: > > Can this information be part of PathTarget structure and hence part of > > RelOptInfo::reltarget, so that it can be extended to join, group and > > other kinds of RelOptInfo in future? >

Re: Printing LSN made easy

2021-02-18 Thread Ashutosh Bapat
On Thu, Feb 18, 2021 at 6:19 PM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > Here is an updated patch that just introduces LSN_FORMAT_ARGS(). I > think the result is quite pleasant. > Thanks a lot Peter for producing this patch. I am fine with it. The way this is defined someone

Re: [PATCH] postgres-fdw: column option to override foreign types

2021-03-02 Thread Ashutosh Bapat
reign table alpha_items ( > id int, > type text > ) server alpha options (table_name 'items'); postgres_fdw assumes that the local type declared is semantically same as the remote type. Ideally the enum should also be declared locally and used to declare type's datatype. See how to handle UDTs in postgres_fdw at https://stackoverflow.com/questions/37734170/can-the-foreign-data-wrapper-fdw-postgres-handle-the-geometry-data-type-of-postg -- Best Wishes, Ashutosh Bapat

Re: Why OR-clauses not getting copied into baserestrictinfo of another table whose columns are in the same EquivalenceClass?

2021-03-03 Thread Ashutosh Bapat
should take care of eliminating the partitions in t2. Partition pruning will prune the partitions in t1. Partition-wise join will create joins between unpruned partitions of t1 with matching partitions of t2. Final plan will not have scans on partitions of t2 which do not match unpruned partitions of t1, effectively pruning t2 as well. You will need to set enable_partitionwise_join = true for that. -- Best Wishes, Ashutosh Bapat

Re: Enumize logical replication message actions

2020-10-30 Thread Ashutosh Bapat
would prefer return on separate line unless there's something more than style improvement. I have added rationale behind Enum in the commit message as you suggested in one of the later mails. PFA patch addressing your comments. -- Best Wishes, Ashutosh From f71a600d3fd49756926deec1b593472a9

Re: Enumize logical replication message actions

2020-10-30 Thread Ashutosh Bapat
On Fri, 30 Oct 2020 at 14:59, Amit Kapila wrote: > On Fri, Oct 30, 2020 at 11:50 AM Amit Kapila > wrote: > > > > On Fri, Oct 30, 2020 at 10:37 AM Peter Smith > wrote: > > > > > > IIUC getting rid of the default from the switch can make the missing > > > enum detection easier because then you ca

Re: Enumize logical replication message actions

2020-10-30 Thread Ashutosh Bapat
#x27;t it be 'message'. > Used "message type". But please feel free to use "message" if you think that's appropriate. > > Other than that the patch looks good to me. > > Patch with updated commit message and also the list of reviewers -- Best Wi

Re: Enumize logical replication message actions

2020-11-02 Thread Ashutosh Bapat
Thanks Amit. On Mon, 2 Nov 2020 at 14:15, Amit Kapila wrote: > On Fri, Oct 30, 2020 at 5:52 PM Ashutosh Bapat > wrote: > > > > On Fri, 30 Oct 2020 at 17:37, Amit Kapila > wrote: > >> > >> > >> > >> Other than that the patch looks good

Re: Any objections to implementing LogicalDecodeMessageCB for pgoutput?

2020-11-06 Thread Ashutosh Bapat
gs); Is 8 bits enough considering future improvements? What if we need to use more than 8 bit flags? @@ -1936,6 +1936,9 @@ apply_dispatch(StringInfo s) apply_handle_origin(s); return; + case LOGICAL_REP_MSG_MESSAGE: Should we add the logical message to the WAL downstream so that it flows further down to a cascaded logical replica. Should that be controlled by an option? -- Best Wishes, Ashutosh Bapat

Re: [PATCH] LWLock self-deadlock detection

2020-11-24 Thread Ashutosh Bapat
for --enable-cassert builds or when LOCK_DEBUG > is defined. -- Best Wishes, Ashutosh Bapat

Re: [PATCH] LWLock self-deadlock detection

2020-11-25 Thread Ashutosh Bapat
mmediate hint in LOG message. But it might just be better to kill -9 that process to get rid of it. That will cause the server to restart and not just shutdown. -- Best Wishes, Ashutosh Bapat

Re: Enumize logical replication message actions

2020-11-26 Thread Ashutosh Bapat
On Thu, Nov 26, 2020 at 10:15 AM Amit Kapila wrote: > On Wed, Nov 25, 2020 at 2:52 PM Amit Kapila > wrote: > > > > On Wed, Nov 25, 2020 at 2:26 PM Peter Smith > wrote: > > > > > > Hi Hackers. > > > > > > Last month there was a commit [1] for replacing logical replication > > > message type char

Printing LSN made easy

2020-11-27 Thread Ashutosh Bapat
xlogdefs.c would have been the best place but there's no such file. May be we add those functions in pg_lsn.c and add their declarations i xlogdefs.h. -- Best Wishes, Ashutosh Bapat From 698e481f5f55b967b5c60dba4bc577f8baa20ff4 Mon Sep 17 00:00:00 2001 From: Ashutosh Bapat Date: Fri, 16 Oct 20

Re: A problem about partitionwise join

2020-11-27 Thread Ashutosh Bapat
a huge improvement when there are many ECs. But I think if one of the partition key expression at a given position is member of an equivalence class all the other partition key expressions at that position should be part of that equivalence class since there should be an equi-join between those. So the loop in loop may not be required to start with. -- Best Wishes, Ashutosh Bapat

Re: Improper use about DatumGetInt32

2020-11-27 Thread Ashutosh Bapat
On Wed, Nov 25, 2020 at 8:13 PM Anastasia Lubennikova < a.lubennik...@postgrespro.ru> wrote: > On 02.11.2020 18:59, Peter Eisentraut wrote: > > I have committed 0003. > > > > For 0001, normal_rand(), I think you should reject negative arguments > > with an error. > > I've updated 0001. The change

Re: Improper use about DatumGetInt32

2020-11-27 Thread Ashutosh Bapat
On Thu, Nov 26, 2020 at 9:57 PM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 2020-11-26 14:27, Alvaro Herrera wrote: > > On 2020-Nov-26, Peter Eisentraut wrote: > > > >> The point of the patch is to have the range check somewhere. If you > just > >> cast it, then you won't no

Re: Printing LSN made easy

2020-11-30 Thread Ashutosh Bapat
On Fri, Nov 27, 2020 at 7:54 PM Alexey Kondratov wrote: > > Hi, > > On 2020-11-27 13:40, Ashutosh Bapat wrote: > > > > Off list Peter Eisentraut pointed out that we can not use these macros > > in elog/ereport since it creates problems for translations. He > &

Re: Printing LSN made easy

2020-11-30 Thread Ashutosh Bapat
array. See section "Application to arrays" at https://en.wikipedia.org/wiki/Sizeof. -- Best Wishes, Ashutosh Bapat

Re: Printing LSN made easy

2020-11-30 Thread Ashutosh Bapat
On Sun, Nov 29, 2020 at 1:23 PM Michael Paquier wrote: > On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote: > > LSN_FORMAT_ARG expands to two comma separated arguments and is kinda > > open at both ends but it's handy that way. > > Agreed that'

Re: Printing LSN made easy

2020-11-30 Thread Ashutosh Bapat
On Sun, Nov 29, 2020 at 10:40 PM Tom Lane wrote: > Michael Paquier writes: > > On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote: > >> Off list Craig Ringer suggested introducing a new format specifier > >> similar to %m for LSN but I did not get

Re: [Bug Fix] Logical replication on partition table is very slow and CPU is 99%

2021-01-11 Thread Ashutosh Bapat
he results of your experiment with the patch applied so as to know this bug's contribution to the slow down. -- Best Wishes, Ashutosh Bapat

Re: Alter timestamp without timezone to with timezone rewrites rows

2021-01-13 Thread Ashutosh Bapat
ne TO 'Asia/Manila'; SET postgres=# SELECT xmin, xmax, cmin, cmax, m from tt; xmin | xmax | cmin | cmax | m --+--+--+--+--- 510 |0 |4 |4 | 2021-01-13 21:53:25.647806+08 (1 row) See the difference in the output when the timezone setting is changed. -- Best Wishes, Ashutosh Bapat

Re: Fix typo about WalSndPrepareWrite

2021-01-13 Thread Ashutosh Bapat
g the code about logical replication, I found that > WalSndPrepareWrite function says it use XLogSendPhysical to fill out the > sendtime, however, it actually done by WalSndWriteData. It looks like a > typo, attaching a very small patch to correct it. > > -- > Regrads, > Japin Li. > ChengDu WenWu Information Technology Co.,Ltd. > -- Best Wishes, Ashutosh Bapat

Re: cost_sort vs cost_agg

2021-01-15 Thread Ashutosh Bapat
_hashagg = off, it takes 2s. This example actually shows that using Unique is better than HashAggregate + Sort. May be you want to try with some data which has very few distinct rows. -- Best Wishes, Ashutosh Bapat

Re: Determine parallel-safety of partition relations for Inserts

2021-01-15 Thread Ashutosh Bapat
se continue to use a common pool of parallel workers for insertion. This means the same thread performing select may not perform insert. So some complications will be involved. -- Best Wishes, Ashutosh Bapat

Re: search_plan_tree(): handling of non-leaf CustomScanState nodes causes segfault

2021-01-18 Thread Ashutosh Bapat
ecessarily in the same patch) and the in the later case CustomScan can handle it the same way. Said that, I didn't notice any field in ForeignScan which is parallel to custom_ps, so what you are proposing is still needed. -- Best Wishes, Ashutosh Bapat

Re: Printing LSN made easy

2021-01-19 Thread Ashutosh Bapat
On Wed, Jan 20, 2021 at 11:55 AM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 2020-11-27 11:40, Ashutosh Bapat wrote: > > The solution seems to be simple though. In the attached patch, I have > > added two macros > > #define LSN_FORMAT "%X/%X

Re: Printing LSN made easy

2021-01-21 Thread Ashutosh Bapat
On Thu, Jan 21, 2021 at 3:53 PM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 2021-01-20 08:50, Ashutosh Bapat wrote: > > Thanks for looking into this. I would like to keep both the LSN_FORMAT > > and LSN_FORMAT_ARGS but with a note that the first can no

Re: repeated decoding of prepared transactions

2021-02-08 Thread Ashutosh Bapat
nsaction as many times as the WAL sender is restarted between sending prepare and commit prepared is a waste of network bandwidth. The wastage is proportional to the amount of changes in the transaction and number of such transactions themselves. Also this will cause performance degradation. So if we can avoid resending prepared transactions twice that will help. -- Best Wishes, Ashutosh Bapat

Re: TRUNCATE on foreign table

2021-02-09 Thread Ashutosh Bapat
6c6ff85ff5c722b36c7a09b2dd7165 >>> >>> I have fixed the patch due to submit it to Commit Fest 2021-03. >>> >>> regards, >>> >>> -- >>> -- >>> Kazutaka Onishi >>> (oni...@heterodb.com) > > > > -- > -- > Kazutaka Onishi > (oni...@heterodb.com) > > > -- > -- > Kazutaka Onishi > (oni...@heterodb.com) -- Best Wishes, Ashutosh Bapat

Re: TRUNCATE on foreign table

2021-02-09 Thread Ashutosh Bapat
On Tue, Feb 9, 2021 at 5:49 PM Bharath Rupireddy wrote: > > On Tue, Feb 9, 2021 at 5:31 PM Ashutosh Bapat > wrote: > > Why would one want to truncate a foreign table instead of truncating > > actual table wherever it is? > > I think when the deletion on foreign tab

Re: repeated decoding of prepared transactions

2021-02-09 Thread Ashutosh Bapat
On Wed, Feb 10, 2021 at 8:02 AM Amit Kapila wrote: > On Wed, Feb 10, 2021 at 12:08 AM Robert Haas > wrote: > > > > On Tue, Feb 9, 2021 at 6:57 AM Amit Kapila > wrote: > > > I think similar happens without any of the work done in PG-14 as well > > > if we restart the apply worker before the comm

Re: TRUNCATE on foreign table

2021-02-09 Thread Ashutosh Bapat
with a local table and hence it can not be executed on > > a foreign server. That's not true with TRUNCATE. > > Yeah, As you say, Applications doesn't need TRUNCATE. > We're focusing for analytical use, namely operating huge data. > TRUNCATE can erase rows faster than DELETE. The question is why can't that truncate be run on the foreign server itself rather than local server? -- Best Wishes, Ashutosh Bapat

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

2021-02-11 Thread Ashutosh Bapat
resql.org/message-id/CAKU4AWr1BmbQB4F7j22G%2BNS4dNuem6dKaUf%2B1BK8me61uBgqqg%40mail.gmail.com >> -- >> Best Regards >> Andy Fan (https://www.aliyun.com/) > > > Add the missed patch.. > > -- > Best Regards > Andy Fan (https://www.aliyun.com/) -- Best Wishes, Ashutosh Bapat

Re: TRUNCATE on foreign table

2021-02-11 Thread Ashutosh Bapat
tensions which don't support SQL. mongo_fdw, > redis_fdw, etc... > These extensions have been used to provide SQL interfaces to the users. > It's hard for the user to run TRUNCATE after learning each database. this has some appeal. Thanks for sharing the usecases. -- Best Wishes, Ashutosh Bapat

Re: row filtering for logical replication

2021-12-07 Thread Ashutosh Bapat
;FOR ALL TABLE" publication(p2 in my case), table tbl should be > treated as no filter, and table tbl should have no filter in subscription > sub. Thoughts? > > But for now, the filter(a > 10) works both when copying initial data and > later changes. > > To fix it, I think we can check if the table is published in a 'FOR ALL > TABLES' > publication or published as part of schema in function > pgoutput_row_filter_init > (which was introduced in v44-0003 patch), also we need to make some changes in > tablesync.c. In order to check "FOR ALL_TABLES", we might need to fetch publication metdata. Instead of that can we add a "TRUE" filter on all the tables which are part of FOR ALL TABLES publication? -- Best Wishes, Ashutosh Bapat

Re: row filtering for logical replication

2021-12-08 Thread Ashutosh Bapat
er for row filtering. > > > Instead of that can we add a "TRUE" filter on all the tables > > which are part of FOR ALL TABLES publication? > > > > How? We won't have an entry for such tables in pg_publication_rel > where we store row_filter information. I mis

Re: Confused comment about drop replica identity index

2021-12-14 Thread Ashutosh Bapat
mment here not accurate enough? > Or we need to adjust the code according to the comments? > Comment in code is one thing, but I think PG documentation is not covering the use case you tried. What happens when a replica identity index is dropped has not been covered either in ALTER TABLE https://www.postgresql.org/docs/13/sql-altertable.html or DROP INDEX https://www.postgresql.org/docs/14/sql-dropindex.html documentation. -- Best Wishes, Ashutosh Bapat

Re: more descriptive message for process termination due to max_slot_wal_keep_size

2021-12-14 Thread Ashutosh Bapat
ds max_slot_wal_keep_size. > > What do you think about this? Agree. I think we should also specify the restart_lsn value which would be within max_slot_wal_keep_size for better understanding. -- Best Wishes, Ashutosh Bapat

Re: more descriptive message for process termination due to max_slot_wal_keep_size

2021-12-23 Thread Ashutosh Bapat
On Wed, Dec 15, 2021 at 9:42 AM Kyotaro Horiguchi wrote: > > At Tue, 14 Dec 2021 19:31:21 +0530, Ashutosh Bapat > wrote in > > On Tue, Dec 14, 2021 at 9:35 AM Kyotaro Horiguchi > > wrote: > > > > [17605] LOG: terminating process 17614 to release replication

Re: Throttling WAL inserts when the standby falls behind more than the configured replica_lag_in_bytes

2021-12-23 Thread Ashutosh Bapat
It's a common point for all kinds of logging including VACUUM. We could accidently stall a critical VACUUM operation because of that. As Bharath described, it better be handled at the application level monitoring. -- Best Wishes, Ashutosh Bapat

Re: Add new function to convert 32-bit XID to 64-bit

2021-12-24 Thread Ashutosh Bapat
he datatype anyway, better to create a new type LongTransactionId or something like to represent 64bit transaction id and then change these functions to use that. -- Best Wishes, Ashutosh Bapat

Re: Add Boolean node

2021-12-27 Thread Ashutosh Bapat
d by Integer nodes. This takes the place of both of these > uses, making the intent clearer and having some amount of type safety. -- Best Wishes, Ashutosh Bapat

Re: generic plans and "initial" pruning

2021-12-28 Thread Ashutosh Bapat
h cases, we will have "pre-execution" pruning instructions that can be used to skip locking partitions? Can you please give a few examples where this approach will be useful? The benchmark is showing good results, indeed. -- Best Wishes, Ashutosh Bapat

Decoding speculative insert with toast leaks memory

2021-03-24 Thread Ashutosh Bapat
toast_hash if it exists. [1] https://www.postgresql-archive.org/Diagnose-memory-leak-in-logical-replication-td6161318.html -- Best Wishes, Ashutosh Bapat diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c index 318a281d7f..2fd01b53f5 100644 ---

Re: UniqueKey on Partitioned table.

2021-03-29 Thread Ashutosh Bapat
e PlannerInfo->eq_classes longer) if we don't have > one , then I just used one Expr instead for this case. > However during the > test, I found some EquivalenceClass with only 1 EquivalenceMember > unexpectedly. > Pathkeys may induce single member ECs. Why UniqueKeys are an exception? -- Best Wishes, Ashutosh Bapat

Re: cursor already in use, UPDATE RETURNING bug?

2021-03-31 Thread Ashutosh Bapat
expecting it to be closed automatically when the function finishes. But that's not what is documented at https://www.postgresql.org/docs/13/plpgsql-cursors.html. -- Best Wishes, Ashutosh Bapat

Re: UniqueKey on Partitioned table.

2021-03-31 Thread Ashutosh Bapat
ugh a key will start as a singleton it might EC partners later and thus thus unique key will transition to all the members. With that logic UniqueKey should use just ECs instead of bare expressions. -- Best Wishes, Ashutosh Bapat

Re: CREATE SEQUENCE with RESTART option

2021-04-07 Thread Ashutosh Bapat
quence.html and https://www.postgresql.org/docs/13/sql-altersequence.html together. At best CREATE SEQUENCE START ... RESTART ... can be a shorthand for CREATE SEQUENCE ... START; ALTER SEQUENCE ... RESTART run back to back. So it looks useful but in rare cases. Said all that I agree that if we are supporting CREATE SEQUENCE ... RESTART then we should document it, correctly. If that's not the intention, we should disallow RESTART with CREATE SEQUENCE. -- Best Wishes, Ashutosh Bapat

Re: [PATCH] Remove useless distinct clauses

2020-07-31 Thread Ashutosh Bapat
ugh the DISTINCT clause > fields. If it is possible to optimize, we then iterate through the JOINs. We are already discussing this feature at https://www.postgresql.org/message-id/flat/CAKJS1f-wH83Fi2coEVNUWFxOGQ4BJRRTGqDMvidCoiR9WEwxsw%40mail.gmail.com#56a08b441cc61afaf85c6232c5d40a3f. You are welcome to contribute your ideas/code/review on that thread. -- Best Wishes, Ashutosh Bapat

Re: walsender waiting_for_ping spuriously set

2020-08-07 Thread Ashutosh Bapat
The patch looks good to me. Thanks for improving comments around that code. I like the change to set waiting_for_ping_response in WalSndKeepalive. Thanks. On Fri, 7 Aug 2020 at 04:26, Alvaro Herrera wrote: > Ashutosh Bapat noticed that WalSndWaitForWal() is setting > waiting_for_ping_re

Re: Can I test Extended Query in core test framework

2020-08-11 Thread Ashutosh Bapat
ystem, I tried grep '\->prepare' and '\->execute' > and get nothing. > am I miss something? > > > -- > Best Regards > Andy Fan -- Best Wishes, Ashutosh Bapat

Print logical WAL message content

2020-08-17 Thread Ashutosh Bapat
70658: invalid record length at 0/1570690: wanted 24, got 0 I didn't find any tests for pg_waldump to test its output, so haven't added one in the patch. -- Best Wishes, Ashutosh Bapat From 1547277944f7aceb1d5b0a3ae46ec2acf02f3b06 Mon Sep 17 00:00:00 2001 From: Ashutosh Bapat Date: Tue,

Re: jsonb, collection & postgres_fdw

2020-08-18 Thread Ashutosh Bapat
ertain server/s but not all). Going further a local function may map to a function with a different name on the remote server/fdw, so that same catalog may maintain the function mapping. An FDW may decide to cache relevant information, update the catalog using IMPORT FOREIGN SCHEMA(or ROUTINE), or add some defaults when installing the extension. More details are required to be worked out but here my initial thoughts on this. -- Best Wishes, Ashutosh Bapat

Re: Print logical WAL message content

2020-08-19 Thread Ashutosh Bapat
0/01570608, prev 0/015705D0, desc: MESSAGE nontransactional message > > size 12 bytes, prefix some_prefix; mesage: 73 6F 6D 65 20 6D 65 73 73 61 67 > > 65 > > I would reduce it to > > > lsn: 0/01570608, prev 0/015705D0, desc: MESSAGE nontransactional, prefix > > &q

Re: Small doubt on update a partition when some rows need to move among partition

2020-08-20 Thread Ashutosh Bapat
her BEFORE INSERT TRIGGER on t1 make i + 1. If the first trigger > causes a partition > move, then the insert query will be interrupted. However, it will not change > partition after > all triggers are called. This was discussed at https://www.postgresql.org/message-id/20200318210213.GA9781@alvherre.pgsql. -- Best Wishes, Ashutosh Bapat

Re: [POC]Enable tuple change partition caused by BEFORE TRIGGER

2020-08-21 Thread Ashutosh Bapat
so on. If we don't execute before row trigger on the partition where the row gets moved, all this expected work won't happen. This also needs some background about the usecase which requires this change. -- Best Wishes, Ashutosh Bapat

Re: jsonb, collection & postgres_fdw

2020-08-24 Thread Ashutosh Bapat
On Tue, 18 Aug 2020 at 17:36, Ashutosh Bapat wrote: > On Mon, Aug 17, 2020 at 7:32 PM Bharath Rupireddy > wrote: > > > > On Fri, Aug 14, 2020 at 12:46 PM Konstantin Knizhnik < > k.knizh...@postgrespro.ru> wrote: > > > > > > Right now postgres_fdw

Re: [POC]Enable tuple change partition caused by BEFORE TRIGGER

2020-08-26 Thread Ashutosh Bapat
On Wed, 26 Aug 2020 at 22:47, Alvaro Herrera wrote: > > What this is saying to me is that we'd need to make sure to run the > final target partition's AFTER triggers, not the original target > partition. Agreed. > But I'm not 100% about running the BEFORE triggers. Maybe > one way to addre

Re: Evaluate expression at planning time for two more cases

2020-08-27 Thread Ashutosh Bapat
sh Right Join + Hash Cond: (b.a_id = a.id) + -> Seq Scan on b + -> Hash + -> Bitmap Heap Scan on a + Recheck Cond: (id > 0) + -> Bitmap Index Scan on a_pkey + Index Cond: (id > 0) +(8 rows) Thanks for the tests. Please add the patch to the next commitfest https://commitfest.postgresql.org/. -- Best Wishes, Ashutosh Bapat

Re: Use T_IntList for uint32

2020-08-31 Thread Ashutosh Bapat
hat it helps us track code which deals with XID lists. -- Best Wishes, Ashutosh Bapat

Re: Ideas about a better API for postgres_fdw remote estimates

2020-08-31 Thread Ashutosh Bapat
hink those problems are kind of secondary. We have to agree on the design first. -- Best Wishes, Ashutosh Bapat

Re: Creating foreign key on partitioned table is too slow

2020-09-04 Thread Ashutosh Bapat
be partition key e.g in star schema, this will use partitionwise join to further improve query performance. Somewhere in future, we will be able to repartition the foreign key table by foreign key and perform partitionwise join. -- Best Wishes, Ashutosh Bapat

Re: Ideas about a better API for postgres_fdw remote estimates

2020-09-04 Thread Ashutosh Bapat
On Thu, 3 Sep 2020 at 10:44, Andrey V. Lepikhov wrote: > On 8/31/20 6:19 PM, Ashutosh Bapat wrote: > > On Mon, Aug 31, 2020 at 3:36 PM Andrey V. Lepikhov > > wrote: > >> > >> Thanks for this helpful feedback. > > I think the patch has some other prob

Re: Report error position in partition bound check

2020-09-04 Thread Ashutosh Bapat
On Fri, 10 Jul 2020 at 23:31, Alexandra Wang wrote: > > > Thank you Daniel. Here's the rebased patch. I also squashed the two > patches into one so it's easier to review. > > Thanks for rebasing patch. It applies cleanly still. Here are some comments @@ -3320,7 +3338,9 @@ make_one_partition_rboun

Re: Evaluate expression at planning time for two more cases

2020-09-08 Thread Ashutosh Bapat
On Tue, 8 Sep 2020 at 07:16, Tom Lane wrote: > > > I'm not sure what I think about Ashutosh's ideas about doing this > somewhere else than eval_const_expressions. I do not buy the argument > that it's interesting to do this separately for each child partition. > Child partitions that have attnot

Re: Ideas about a better API for postgres_fdw remote estimates

2020-09-08 Thread Ashutosh Bapat
On Fri, 4 Sep 2020 at 20:27, Tomas Vondra wrote > > > 4) I wonder if we actually want/need to simply output pg_statistic data > verbatim like this. Is postgres_fdw actually going to benefit from it? I > kinda doubt that, and my assumption was that we'd return only a small > subset of the data, ne

Re: Transactions involving multiple postgres foreign servers, take 2

2020-09-08 Thread Ashutosh Bapat
is was an idea that Tom had suggested at the very beginning of the first take. -- Best Wishes, Ashutosh Bapat

Re: Ideas about a better API for postgres_fdw remote estimates

2020-09-08 Thread Ashutosh Bapat
On Wed, 9 Sep 2020 at 02:35, Tomas Vondra wrote > > I think that was the topic of *this* thread as started by Tom, but I now > realize Andrey steered it in the direction to allow re-using remote > stats. Which seems useful too, but it confused me a bit. > I didn't realize that the nearby thread

Comment update in BuildTupleFromCStrings()

2018-03-23 Thread Ashutosh Bapat
the attribute whose in() function caused an error. May be we could pass an optional error context to the later and use it. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company From c8faf979d34a04099597bdbbe952ca7a936e5dbe Mon Sep 17 00:00:00 2001 From: Ashutosh Bap

Odd procedure resolution

2018-03-23 Thread Ashutosh Bapat
drop function foo(a int); DROP FUNCTION call foo(1); CALL Functions and Procedures are two different objects and we enforce different methods to invoke those, SELECT and CALL resp. So, we should be able to filter out one or the other and try to find best candidate of a given kind. -- Best Wi

Re: Odd procedure resolution

2018-03-23 Thread Ashutosh Bapat
;. But I haven't fixed the error messages in this patch. I need to first see if the changes are acceptable. On Fri, Mar 23, 2018 at 3:53 PM, Ashutosh Bapat wrote: > Hi, > Consider following scenario > > create function foo(a int) returns integer as $$begin return a; end; &g

Re: Odd procedure resolution

2018-03-23 Thread Ashutosh Bapat
On Fri, Mar 23, 2018 at 7:53 PM, Tom Lane wrote: > Ashutosh Bapat writes: >> Incidently the fix looks quite simple. See patch attached. > > ISTM this patch effectively proposes to make procedures have their own > namespace yet still live in pg_proc. That is the worst of all

Re: [HACKERS] Partition-wise aggregation/grouping

2018-03-26 Thread Ashutosh Bapat
ing scan, so + * use root's all_baserels. */ This is correct only for "other" grouping relations. We are yet to decide what to do for the other upper relations. -if (IS_UPPER_REL(rel)) +if (IS_UPPER_REL(rel) && !IS_OTHER_REL(rel)) I guess, this condition boi

Re: Oddity in COPY FROM handling of check constraints on partition tables

2018-03-28 Thread Ashutosh Bapat
ost. We can not add this to v11 open items since it isn't a v11 bug exactly. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company

Re: [HACKERS] Partition-wise aggregation/grouping

2018-03-28 Thread Ashutosh Bapat
sense. So better to have > a separate member in PgFdwRelationInfo. Ah sorry, I was wrong about remote_conds. remote_conds and local_conds are basically the conditions on the relation being pushed down. havingQuals are conditions on a grouped relation so treating them like baserestrictinfo or join

Re: [HACKERS] Partition-wise aggregation/grouping

2018-03-29 Thread Ashutosh Bapat
On Wed, Mar 28, 2018 at 7:21 PM, Ashutosh Bapat wrote: > > Ah sorry, I was wrong about remote_conds. remote_conds and local_conds > are basically the conditions on the relation being pushed down. > havingQuals are conditions on a grouped relation so treating them like > baserestr

Re: Additional Statistics Hooks

2018-03-30 Thread Ashutosh Bapat
On Thu, Mar 15, 2018 at 7:59 PM, Tomas Vondra wrote: > > > On 03/15/2018 06:00 AM, Ashutosh Bapat wrote: >> On Tue, Mar 13, 2018 at 8:55 PM, Mat Arye wrote: >>>> >>>> Like cost associated with a function, we may associate mapping >>>> cardinalit

Re: [HACKERS] advanced partition matching algorithm for partition-wise join

2018-03-30 Thread Ashutosh Bapat
k those inside the comparison function e.g. partition_rbound_cmp(). We could argue that that will benefit intermediate functions like partition_range_bound_cmp(), which just pass those values down, but there is all the possibility that its future caller may not have that packing structure available readily. So, I am inclined not to add a new structure just for this. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company

Re: Diagonal storage model

2018-04-02 Thread Ashutosh Bapat
ability to add extra dimensions to provide additional views like double diagonal view. Alas! it all collapses since I was late to the party. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company

Re: Optimizing nested ConvertRowtypeExpr execution

2018-04-02 Thread Ashutosh Bapat
On Mon, Apr 2, 2018 at 1:40 AM, Andres Freund wrote: > Hi, > > On 2018-02-26 17:20:05 +0530, Ashutosh Bapat wrote: >> In a multi-level partitioned table, a parent whole-row reference gets >> translated into nested ConvertRowtypeExpr with child whole-row >> refere

Re: Comment update in BuildTupleFromCStrings()

2018-04-03 Thread Ashutosh Bapat
Thanks Bruce. On Tue, Apr 3, 2018 at 11:31 PM, Bruce Momjian wrote: > On Fri, Mar 23, 2018 at 03:00:37PM +0530, Ashutosh Bapat wrote: >> Hi, >> BuildTupleFromCStrings() has comment "/* Call the "in" function for >> each non-dropped attribute */". It the

  1   2   3   4   5   6   7   8   9   10   >