Targetlist lost when CTE join

2023-06-28 Thread Zhang Mingli
oin t1 using(c1);  c1 | c2 | c1 | c2 +++ (0 rows) Table t1 and  t2 both has 2 columns: c1, c2, when CTE join select *, the result target list seems to lost one’s column c1. But it looks good when select cte1.* and t1.* explicitly . Is it a bug? Regards, Zhang Mingli

Re: Targetlist lost when CTE join

2023-06-28 Thread Zhang Mingli
ut: t1.c1, t1.c2  -> Hash (cost=0.02..0.02 rows=1 width=8)  Output: cte1.c1, cte1.c2  -> CTE Scan on cte1 (cost=0.00..0.02 rows=1 width=8)  Output: cte1.c1, cte1.c2 (14 rows) Regards, Zhang Mingli

Re: Targetlist lost when CTE join

2023-06-28 Thread Zhang Mingli
Hi Regards, Zhang Mingli On Jun 28, 2023, 17:17 +0800, Julien Rouhaud , wrote: > This is working as intended. When using a USING clause you "merge" both > columns so the final target list only contain one version of the merged > columns, which doesn't happen if you

Re: Targetlist lost when CTE join

2023-06-28 Thread Zhang Mingli
uces one output column for each of the listed column pairs (in > the listed order), followed by any remaining columns from T1, followed by any > remaining columns from T2. Thanks for your help. Regards, Zhang Mingli

Is it necessary to keep am routine finish_bulk_insert?

2024-07-25 Thread Zhang Mingli
also make it easy to cause unnecessary troubles. Shall we remove it before we provide an example for developers to avoid that? Zhang Mingli www.hashdata.xyz

COPY FROM crash

2024-07-29 Thread Zhang Mingli
NextFreeSlot() to avoid such issues. [0] https://github.com/cloudberrydb/cloudberrydb Zhang Mingli www.hashdata.xyz v0-0001-Fix-COPY-FROM-crash-due-to-buffer-flush.patch Description: Binary data

Re: COPY FROM crash

2024-07-30 Thread Zhang Mingli
Hi, Zhang Mingli www.hashdata.xyz On Jul 30, 2024 at 13:35 +0800, David Rowley , wrote: > > If you're only able > to get it to misbehave by setting MAX_PARTITION_BUFFERS to less than > 2, then my suggested fix would be to add a comment to say that values > less than to are

Re: COPY FROM crash

2024-07-30 Thread Zhang Mingli
Hi, Zhang Mingli www.hashdata.xyz On Jul 30, 2024 at 13:37 +0800, Kirill Reshke , wrote: > > Just to be clear, you are facing this on HEAD, on on REL_14_STABLE? Postgres HEAD.

Re: Use MAX_PARALLEL_WORKER_LIMIT consistently in guc_tables.c

2024-10-09 Thread Zhang Mingli
Hi, Zhang Mingli www.hashdata.xyz On Oct 9, 2024 at 20:35 +0800, Matthias van de Meent , wrote: > Hi, > > Whilst doing some digging in parallel code, I noticed that > max_parallel_maintenance_workers is registered as guc with a manual > value of 1024, while max_parallel_workers_

Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL

2024-10-11 Thread Zhang Mingli
Hi, Zhang Mingli www.hashdata.xyz On Oct 12, 2024 at 07:48 +0800, Joel Jacobson , wrote: > > Add missing checks for FORCE_NOT_NULL and FORCE_NULL when applied to > all columns via "*". These options now correctly require CSV mode and > are disallowed in COPY TO as a

Re: Remove useless GROUP BY columns considering unique index

2024-09-23 Thread Zhang Mingli
Hi, all I haven't paid attention to this topic in a long time, thanks all for the advices, I will study them then update. Thanks again. Zhang Mingli www.hashdata.xyz On Sep 18, 2024 at 15:50 +0800, David Rowley , wrote: > On Wed, 18 Sept 2024 at 19:28, Peter Eisentraut wrote: &g

Re: Prevent COPY FREEZE on Foreign tables

2025-02-03 Thread Zhang Mingli
Hi, Zhang Mingli www.hashdata.xyz On Feb 4, 2025 at 04:18 +0800, Sami Imseih , wrote: > > This really does not make sense as this > optimization cannot be applied to a remote table and it > can give a user a false impression that it was. +1, ``` + /* + * Raise an error on foreign ta

Inconsistency between Compression and Storage for Foreign Tables

2025-02-05 Thread Zhang Mingli
tgresql.org/docs/current/sql-alterforeigntable.html [2] https://www.postgresql.org/docs/current/sql-createforeigntable.html -- Zhang Mingli HashData

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-06 Thread Zhang Mingli
I believe that COMPRESSION should also be copied for foreign tables, similar to STORAGE. This might be beneficial for foreign data wrappers (FDWs) that take it into account. [0]  https://www.postgresql.org/message-id/6cecef0e-ee14-473c-bb0a-6aa61f539a66%40Spark -- Zhang Mingli HashData v

Re: Virtual generated columns

2025-02-09 Thread Zhang Mingli
they don't actually use storage. Virtual columns are computed when the table is read, and they should adhere to the same rules of join semantics. I agree with Richard, the result seems incorrect. The right outcome should be: gpadmin=# SELECT t2.a, t2.b FROM t t1 LEFT JOIN t t2 ON FALSE;  a | b --+--  NULL | NULL  NULL | NULL (2 rows) -- Zhang Mingli HashData

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-06 Thread Zhang Mingli
rigin of the option bits. -- Zhang Mingli HashData

Re: Improve documentation regarding custom settings, placeholders, and the administrative functions

2025-02-05 Thread Zhang Mingli
could return NULL actually. gpadmin=# \pset null NULL Null display is "NULL". gpadmin=# select current_setting('pg_xmen', true);  current_setting -  NULL (1 row) -- Zhang Mingli HashData

Re: Improve documentation regarding custom settings, placeholders, and the administrative functions

2025-02-06 Thread Zhang Mingli
W will never > produce NULL. Hi, OK, LGTM. -- Zhang Mingli HashData

Re: Prevent COPY FREEZE on Foreign tables

2025-02-06 Thread Zhang Mingli
we find any, the FREEZE operation won’t be applicable. However, that's a consideration for the future. LGTM. -- Zhang Mingli HashData

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-07 Thread Zhang Mingli
On Feb 6, 2025 at 18:09 +0800, Zhang Mingli , wrote: > On Feb 3, 2025 at 08:29 +0800, Michael Paquier , wrote: > > On Mon, Feb 03, 2025 at 06:22:13AM +0800, Mingli Zhang wrote: > > > Yes, I would like to provide a patch. > > > > > > Glad to see we have come t

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-07 Thread Zhang Mingli
On Feb 7, 2025 at 22:24 +0800, Zhang Mingli , wrote: > On Feb 6, 2025 at 18:09 +0800, Zhang Mingli , wrote: > > On Feb 3, 2025 at 08:29 +0800, Michael Paquier , wrote: > > > On Mon, Feb 03, 2025 at 06:22:13AM +0800, Mingli Zhang wrote: > > > > Yes, I

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-11 Thread Zhang Mingli
y is > enough. Hmm... I copied from the cases in the same file for each option. There's no harm in having more tests, how about we keep them? -- Zhang Mingli HashData v3-0001-CREATE-FOREIGN-TABLE-LIKE.patch Description: Binary data

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-01 Thread Zhang Mingli
Zhang Mingli www.hashdata.xyz On Feb 1, 2025 at 20:20 +0800, Álvaro Herrera , wrote: > > Sure. Did you consider IMPORT FOREIGN SCHEMA? Hi, Álvaro Thank you very much for your suggestion. I've looked into it, and it certainly can be beneficial, especially for  postgres_fdw. However

Proposal to CREATE FOREIGN TABLE LIKE

2025-01-31 Thread Zhang Mingli
E is not supported for creating foreign tables"))); } ``` with some test cases and Documents changes. Zhang Mingli www.hashdata.xyz

Re: RFC: Packing the buffer lookup table

2025-01-31 Thread Zhang Mingli
Zhang Mingli www.hashdata.xyz On Jan 30, 2025 at 15:49 +0800, Matthias van de Meent , wrote: > > Some time ago I noticed that every buffer table entry is quite large at 40 > bytes (+8): 16 bytes of HASHELEMENT header (of which the last 4 bytes are > padding), 20 bytes of Buff

useless list_tail()?

2025-01-15 Thread Zhang Mingli
ve it? Zhang Mingli www.hashdata.xyz

Inquiry About Determining Parallel Plans for REFRESH MATERIALIZED VIEW

2025-01-15 Thread Zhang Mingli
execution of the REFRESH command. Any suggestions? Zhang Mingli www.hashdata.xyz

Re: Inquiry About Determining Parallel Plans for REFRESH MATERIALIZED VIEW

2025-01-15 Thread Zhang Mingli
Hi Zhang Mingli www.hashdata.xyz On Jan 16, 2025 at 14:04 +0800, Yugo Nagata , wrote: > > You will be able to log the plan during the REFRESH by using auto_explain and > setting > log_analyze and log_nested_statements to on. Hi Yugo, Thank you for your help! That’s certainly a via

Re: Virtual generated columns

2025-02-09 Thread Zhang Mingli
generation function during the rewrite stage does not account for the Var field settings, leading to the errors we are encountering. -- Zhang Mingli HashData

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-09 Thread Zhang Mingli
on the comments. > > > > instead of > > > > + Foreign tables have no real storage in PostgreSQL. > > > > Can it just be > > > > Foreign tables have no storage in PostgreSQL. > > > > the "real" is not needed. Done. Patch V2 addre

Fix outdated code comments in nodeAgg.c

2025-02-09 Thread Zhang Mingli
Hi, By reading the codes in nodeAgg.c, I found that some comments are outdated. The comments referred to the function lookup_hash_entry(), which has been removed in commit b563594. I've adjusted the comments to refer to the correct function to make it clear. -- Zhang Mingli HashData v0

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-18 Thread Zhang Mingli
E command, tweaked a bit the part > at the bottom where LIKE is not part of the standard. > > And applied. Thanks. -- Zhang Mingli HashData

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-18 Thread Zhang Mingli
On Feb 18, 2025 at 09:54 +0800, Zhang Mingli , wrote: > > Will address the comments later,  thanks for review! Done in patch v6. -- Zhang Mingli HashData v6-0001-CREATE-FOREIGN-TABLE-LIKE.patch Description: Binary data

Re: Fix outdated code comments in nodeAgg.c

2025-02-18 Thread Zhang Mingli
On Feb 10, 2025 at 16:45 +0800, Richard Guo , wrote: > On Sun, Feb 9, 2025 at 11:15 PM Zhang Mingli wrote: > > By reading the codes in nodeAgg.c, I found that some comments are outdated. > > The comments referred to the function lookup_hash_entry(), which has been > > remo

Re: Modify an incorrect regression test case in the group by key value elimination function

2025-02-18 Thread Zhang Mingli
, Good catch. > > Yeah, the primary key of t3 is deferred, so only the t3_c_uidx can be used. > The test case is inconsistent with comments. > > It seems that the t2 does not have a unique index on z, do you forget to > create it in the patch? While there isn't an unique index, an unique constraint with a NOT NULL on that column should serve the same purpose.   +alter table t2 alter column z set not null, add constraint t2_z_uidx unique (z); In patch v2, I made a slight adjustment: creating a unique index on t3 will handle multiple choice scenarios. Thanks for the patch. -- Zhang Mingli HashData v2-0001-Modify-an-incorrect-regression-test-case-in-the-grou.patch Description: Binary data

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-18 Thread Zhang Mingli
On Feb 18, 2025 at 09:54 +0800, Zhang Mingli , wrote: > > Will address the comments later,  thanks for review! Done in patch v6. -- Zhang Mingli HashData v6-0001-CREATE-FOREIGN-TABLE-LIKE.patch Description: Binary data

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-17 Thread Zhang Mingli
On Feb 18, 2025 at 08:49 +0800, Michael Paquier , wrote: > On Mon, Feb 17, 2025 at 07:14:59PM +0800, Zhang Mingli wrote: > > On Feb 17, 2025 at 15:24 +0800, Michael Paquier , > > wrote: > > > + * For foreign tables, they have no storage in Postgres. > > > + *

Re: Improve documentation regarding custom settings, placeholders, and the administrative functions

2025-02-27 Thread Zhang Mingli
On Feb 28, 2025 at 02:27 +0800, David G. Johnston , wrote: > On Thu, Feb 6, 2025 at 8:04 AM Zhang Mingli wrote: > > On Feb 6, 2025 at 10:49 +0800, David G. Johnston > > , wrote: > > > > > > Yes, and when it does it is doing so in lieu of an error, and thus it

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-17 Thread Zhang Mingli
rts related to > generated, default and constraints properties. This dependency > between both routines should be documented, I guess. Hmm.. Not sure > where. Comments are addressed except for this one, it might be worth considering another patch. -- Zhang Mingli HashData v5-0001-CREATE-FOREIGN-TABLE-LIKE.patch Description: Binary data

Re: Inconsistency between Compression and Storage for Foreign Tables

2025-02-21 Thread Zhang Mingli
d I think it could confuse others as well if they encounter something like that. > Maybe someone has a different opinion about this, and we should disallow > setting STORAGE on an fdw table in future versions. If that’s the case, why not today?  I’d be happy to take care of it. -- Zhang Mingli HashData

Re: Even when the data is already ordered, MergeAppend still adds a Sort node

2025-07-18 Thread Zhang Mingli
using t_a_b_idx on t (cost=0.29..316.27 rows= width=8)  Index Cond: ((a = 1) AND (b > 1)) (3 rows) -- Zhang Mingli HashData

Re: [Question] Window Function Results without ORDER BY Clause

2025-07-13 Thread Zhang Mingli
On Jul 11, 2025 at 23:57 +0800, Tom Lane , wrote: > "David G. Johnston" writes: > > On Friday, July 11, 2025, Zhang Mingli wrote: > > > So, are both result sets technically correct given the absence of an ORDER > > > BY clause? > > > The sys

[Question] Window Function Results without ORDER BY Clause

2025-07-11 Thread Zhang Mingli
fined. While using a window function without ORDER BY is valid, the resulting output seems unpredictable. So, are both result sets technically correct given the absence of an ORDER BY  clause? -- Zhang Mingli HashData

Re: Adding some error context for lock wait failures

2025-07-10 Thread Zhang Mingli
allback. May be confused if there were tables with same names under different schemas. -- Zhang Mingli HashData

Re: Adding some error context for lock wait failures

2025-07-10 Thread Zhang Mingli
Hi, On Jul 11, 2025 at 10:53 +0800, Tom Lane , wrote: > Zhang Mingli writes: > > Do we need to rollback error_context_stack to the previous state if we > > enter the branch for PG_CATCH()? > > No. The PG_TRY mechanism itself deals with that: the next outer > leve

Re: Adding some error context for lock wait failures

2025-07-10 Thread Zhang Mingli
set_ps_display_remove_suffix(); error_context_stack = waiterrcontext.previous; ``` Do we need to rollback error_context_stack to the  previous state if we enter the branch for PG_CATCH()? -- Zhang Mingli HashData

Re: Retail DDL

2025-07-25 Thread Zhang Mingli
ce. For other objects related to the table, we can clearly document them. Additionally, I have another suggestion - could we have a quick backslash command to display DDL? Something like \d+ t1, or perhaps \dddl? Looking at the code, it seems there aren't many available command slots remaining. -- Zhang Mingli HashData

<    1   2