This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 62307f34ff86f31c9eee86e1f8ebec129beba425
Author: Huansong Fu <fuhuans...@gmail.com>
AuthorDate: Mon Aug 7 10:52:13 2023 -0700

    Refine error message for EXCHANGE PARTITION ... WITH|WITHOU VALIDATION
    
    The error(NOTICE) meessage is too long. Move the details into errdetail().
    
    fix partition
---
 src/backend/parser/gram.y                         |  8 ++++----
 src/test/regress/expected/partition.out           |  5 +++--
 src/test/regress/expected/partition1.out          | 10 ++++++----
 src/test/regress/expected/partition_optimizer.out |  3 ++-
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index b27e137517..a93685bbbb 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -4174,8 +4174,8 @@ opt_table_partition_exchange_validate:
                        {
                                $$ = +1;
                                ereport(NOTICE,
-                                               (errmsg("specifying \"WITH 
VALIDATION\" acts as no operation. "
-                                                               "If the new 
partition is a regular table, validation is performed "
+                                               (errmsg("specifying \"WITH 
VALIDATION\" acts as no operation"),
+                                                errdetail("If the new 
partition is a regular table, validation is performed "
                                                                "to make sure 
all the rows obey partition constraint. "
                                                                "If the new 
partition is external or foreign table, no validation is performed.")));
                        }
@@ -4183,8 +4183,8 @@ opt_table_partition_exchange_validate:
                        {
                                $$ = +0;
                                ereport(NOTICE,
-                                               (errmsg("specifying \"WITHOUT 
VALIDATION\" acts as no operation. "
-                                                               "If the new 
partition is a regular table, validation is performed "
+                                               (errmsg("specifying \"WITHOUT 
VALIDATION\" acts as no operation"),
+                                                errdetail("If the new 
partition is a regular table, validation is performed "
                                                                "to make sure 
all the rows obey partition constraint. "
                                                                "If the new 
partition is external or foreign table, no validation is performed.")));
                        }
diff --git a/src/test/regress/expected/partition.out 
b/src/test/regress/expected/partition.out
index 5fc25d0e0c..87dd44fe9e 100755
--- a/src/test/regress/expected/partition.out
+++ b/src/test/regress/expected/partition.out
@@ -390,8 +390,9 @@ alter table foo_p exchange partition for(6) with table 
bar_p;
 ERROR:  partition constraint of relation "bar_p" is violated by some row  
(seg2 127.0.1.1:7004 pid=1927394)
 alter table foo_p exchange partition for(6) with table bar_p without
 validation;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new 
partition is a regular table, validation is performed to make sure all the rows 
obey partition constraint. If the new partition is external or foreign table, 
no validation is performed.
-ERROR:  partition constraint of relation "bar_p" is violated by some row  
(seg2 127.0.1.1:7004 pid=1927394)
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to 
make sure all the rows obey partition constraint. If the new partition is 
external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "bar_p" is violated by some row  
(seg2 127.0.0.1:7004 pid=4189072)
 analyze foo_p;
 select * from foo_p;
  i 
diff --git a/src/test/regress/expected/partition1.out 
b/src/test/regress/expected/partition1.out
index 9460b73c41..d3b3cac65d 100644
--- a/src/test/regress/expected/partition1.out
+++ b/src/test/regress/expected/partition1.out
@@ -2816,11 +2816,13 @@ NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- 
Using column named 'a' as
 HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make 
sure column(s) chosen are the optimal data distribution key to minimize skew.
 INSERT INTO exchange_tbl VALUES (100);
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE 
exchange_tbl WITH VALIDATION;
-NOTICE:  specifying "WITH VALIDATION" acts as no operation. If the new 
partition is a regular table, validation is performed to make sure all the rows 
obey partition constraint. If the new partition is external or foreign table, 
no validation is performed.
-ERROR:  partition constraint of relation "exchange_tbl" is violated by some 
row  (seg2 127.0.1.1:7004 pid=1927274)
+NOTICE:  specifying "WITH VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to 
make sure all the rows obey partition constraint. If the new partition is 
external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "exchange_tbl" is violated by some 
row  (seg2 127.0.0.1:7004 pid=4188949)
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE 
exchange_tbl WITHOUT VALIDATION;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new 
partition is a regular table, validation is performed to make sure all the rows 
obey partition constraint. If the new partition is external or foreign table, 
no validation is performed.
-ERROR:  partition constraint of relation "exchange_tbl" is violated by some 
row  (seg2 127.0.1.1:7004 pid=1927274)
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to 
make sure all the rows obey partition constraint. If the new partition is 
external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "exchange_tbl" is violated by some 
row  (seg2 127.0.0.1:7004 pid=4188949)
 DROP TABLE exchange_tbl;
 DROP TABLE validation_syntax_tbl;
 --
diff --git a/src/test/regress/expected/partition_optimizer.out 
b/src/test/regress/expected/partition_optimizer.out
index 8ff25b93d9..4e6270642d 100755
--- a/src/test/regress/expected/partition_optimizer.out
+++ b/src/test/regress/expected/partition_optimizer.out
@@ -390,7 +390,8 @@ alter table foo_p exchange partition for(6) with table 
bar_p;
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 alter table foo_p exchange partition for(6) with table bar_p without
 validation;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new 
partition is a regular table, validation is performed to make sure all the rows 
obey partition constraint. If the new partition is external or foreign table, 
no validation is performed.
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to 
make sure all the rows obey partition constraint. If the new partition is 
external or foreign table, no validation is performed.
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 analyze foo_p;
 select * from foo_p;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: commits-h...@cloudberry.apache.org

Reply via email to