This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new d896be71dbc Fix time type cast
d896be71dbc is described below
commit d896be71dbc9c9bf9a9cba169addcc8ff8d7d17b
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Nov 1 20:58:47 2025 +0800
Fix time type cast
---
src/backend/utils/adt/numeric.c | 4 ---
src/test/regress/expected/date.out | 33 ++++++++++-----------
src/test/regress/expected/numerology.out | 50 +++++++++++++++++---------------
src/test/regress/expected/point.out | 17 -----------
src/test/regress/serial_schedule | 25 ++++++++--------
src/test/regress/sql/date.sql | 16 +++++-----
src/test/regress/sql/point.sql | 27 -----------------
7 files changed, 61 insertions(+), 111 deletions(-)
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 0d9277a843d..c1f4ca54175 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -4398,10 +4398,6 @@ int64_div_fast_to_numeric(int64 val1, int log10val2)
w++;
}
- quick_init_var(&result);
-
- int64_to_numericvar(val1, &result);
-
result.weight -= w;
result.dscale = rscale;
diff --git a/src/test/regress/expected/date.out
b/src/test/regress/expected/date.out
index ea2090b3d2e..95628681e8d 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -870,23 +870,6 @@ SELECT date '5874898-01-01'; -- out of range
ERROR: date out of range: "5874898-01-01"
LINE 1: SELECT date '5874898-01-01';
^
-<<<<<<< HEAD
--- Test guc gp_allow_date_field_width_5digits
--- should error out
-SELECT date '2020516';
-ERROR: invalid input syntax for type date: "2020516"
-LINE 1: SELECT date '2020516';
- ^
-SET gp_allow_date_field_width_5digits=on;
--- should parsed to 0202-05-16 ( non-standard YYYMMDD )
-SELECT date '2020516';
- date
-------------
- 0202-05-16
-(1 row)
-
-RESET gp_allow_date_field_width_5digits;
-=======
-- Test non-error-throwing API
SELECT pg_input_is_valid('now', 'date');
pg_input_is_valid
@@ -918,7 +901,21 @@ SELECT * FROM pg_input_error_info('6874898-01-01', 'date');
date out of range: "6874898-01-01" | | | 22008
(1 row)
->>>>>>> REL_16_9
+-- Test guc gp_allow_date_field_width_5digits
+-- should error out
+SELECT date '2020516';
+ERROR: invalid input syntax for type date: "2020516"
+LINE 1: SELECT date '2020516';
+ ^
+SET gp_allow_date_field_width_5digits=on;
+-- should parsed to 0202-05-16 ( non-standard YYYMMDD )
+SELECT date '2020516';
+ date
+------------
+ 0202-05-16
+(1 row)
+
+RESET gp_allow_date_field_width_5digits;
RESET datestyle;
--
-- Simple math
diff --git a/src/test/regress/expected/numerology.out
b/src/test/regress/expected/numerology.out
index 1f5ebb92bcb..00552cf2fd0 100644
--- a/src/test/regress/expected/numerology.out
+++ b/src/test/regress/expected/numerology.out
@@ -3,28 +3,6 @@
-- Test various combinations of numeric types and functions.
--
--
-<<<<<<< HEAD
--- create required tables
---
-CREATE TABLE FLOAT8_NUMER_TBL(i INT DEFAULT 1, f1 float8);
-INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('0.0');
-INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-34.84');
-INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1004.30');
-INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1.2345678901234e+200');
-INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1.2345678901234e-200');
-CREATE TABLE INT2_NUMER_TBL(f1 int2);
-INSERT INTO INT2_NUMER_TBL(f1) VALUES ('0 ');
-INSERT INTO INT2_NUMER_TBL(f1) VALUES (' 1234 ');
-INSERT INTO INT2_NUMER_TBL(f1) VALUES (' -1234');
-INSERT INTO INT2_NUMER_TBL(f1) VALUES ('32767');
-INSERT INTO INT2_NUMER_TBL(f1) VALUES ('-32767');
-CREATE TABLE INT4_NUMER_TBL(f1 int4);
-INSERT INTO INT4_NUMER_TBL(f1) VALUES (' 0 ');
-INSERT INTO INT4_NUMER_TBL(f1) VALUES ('123456 ');
-INSERT INTO INT4_NUMER_TBL(f1) VALUES (' -123456');
-INSERT INTO INT4_NUMER_TBL(f1) VALUES ('2147483647');
-INSERT INTO INT4_NUMER_TBL(f1) VALUES ('-2147483647');
-=======
-- numeric literals
--
SELECT 0b100101;
@@ -367,7 +345,33 @@ PREPARE p1 AS SELECT $0_1;
ERROR: trailing junk after parameter at or near "$0_1"
LINE 1: PREPARE p1 AS SELECT $0_1;
^
->>>>>>> REL_16_9
+--
+-- create required tables
+--
+CREATE TABLE FLOAT8_NUMER_TBL(i INT DEFAULT 1, f1 float8);
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i'
as the Apache Cloudberry data distribution key for this table.
+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 FLOAT8_NUMER_TBL(f1) VALUES ('0.0');
+INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-34.84');
+INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1004.30');
+INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1.2345678901234e+200');
+INSERT INTO FLOAT8_NUMER_TBL(f1) VALUES ('-1.2345678901234e-200');
+CREATE TABLE INT2_NUMER_TBL(f1 int2);
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1'
as the Apache Cloudberry data distribution key for this table.
+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 INT2_NUMER_TBL(f1) VALUES ('0 ');
+INSERT INTO INT2_NUMER_TBL(f1) VALUES (' 1234 ');
+INSERT INTO INT2_NUMER_TBL(f1) VALUES (' -1234');
+INSERT INTO INT2_NUMER_TBL(f1) VALUES ('32767');
+INSERT INTO INT2_NUMER_TBL(f1) VALUES ('-32767');
+CREATE TABLE INT4_NUMER_TBL(f1 int4);
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1'
as the Apache Cloudberry data distribution key for this table.
+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 INT4_NUMER_TBL(f1) VALUES (' 0 ');
+INSERT INTO INT4_NUMER_TBL(f1) VALUES ('123456 ');
+INSERT INTO INT4_NUMER_TBL(f1) VALUES (' -123456');
+INSERT INTO INT4_NUMER_TBL(f1) VALUES ('2147483647');
+INSERT INTO INT4_NUMER_TBL(f1) VALUES ('-2147483647');
--
-- Test implicit type conversions
-- This fails for Postgres v6.1 (and earlier?)
diff --git a/src/test/regress/expected/point.out
b/src/test/regress/expected/point.out
index a5a4b989dea..5275416ee50 100644
--- a/src/test/regress/expected/point.out
+++ b/src/test/regress/expected/point.out
@@ -3,23 +3,6 @@
--
-- avoid bit-exact output here because operations may not be bit-exact.
SET extra_float_digits = 0;
-<<<<<<< HEAD
-CREATE TABLE POINT_TBL(f1 point);
-INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)');
-ANALYZE POINT_TBL;
-INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)');
-INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)');
-INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
-INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
-INSERT INTO POINT_TBL(f1) VALUES ('(1e-300,-1e-300)'); -- To underflow
-INSERT INTO POINT_TBL(f1) VALUES ('(1e+300,Inf)'); -- To overflow
-INSERT INTO POINT_TBL(f1) VALUES ('(Inf,1e+300)'); -- Transposed
-INSERT INTO POINT_TBL(f1) VALUES (' ( Nan , NaN ) ');
--- bad format points
-=======
--- point_tbl was already created and filled in test_setup.sql.
--- Here we just try to insert bad values.
->>>>>>> REL_16_9
INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
ERROR: invalid input syntax for type point: "asdfasdf"
LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 4a084b06710..67da347bd71 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -24,19 +24,18 @@ test: rangetypes
test: multirangetypes
test: pg_lsn
test: regproc
-# test: create_function_0
-# test: strings
-# test: numerology
-# test: point
-# test: lseg
-# test: line
-# test: box
-# test: path
-# test: polygon
-# test: circle
-# test: date
-# test: time
-# test: timetz
+test: strings
+test: numerology
+test: point
+test: lseg
+test: line
+test: box
+test: path
+test: polygon
+test: circle
+test: date
+test: time
+test: timetz
# test: timestamp
# test: timestamptz
# test: interval
diff --git a/src/test/regress/sql/date.sql b/src/test/regress/sql/date.sql
index 303ceb7e10d..8e253bd180c 100644
--- a/src/test/regress/sql/date.sql
+++ b/src/test/regress/sql/date.sql
@@ -215,7 +215,13 @@ SELECT date '4714-11-23 BC'; -- out of range
SELECT date '5874897-12-31';
SELECT date '5874898-01-01'; -- out of range
-<<<<<<< HEAD
+-- Test non-error-throwing API
+SELECT pg_input_is_valid('now', 'date');
+SELECT pg_input_is_valid('garbage', 'date');
+SELECT pg_input_is_valid('6874898-01-01', 'date');
+SELECT * FROM pg_input_error_info('garbage', 'date');
+SELECT * FROM pg_input_error_info('6874898-01-01', 'date');
+
-- Test guc gp_allow_date_field_width_5digits
-- should error out
SELECT date '2020516';
@@ -226,14 +232,6 @@ SET gp_allow_date_field_width_5digits=on;
SELECT date '2020516';
RESET gp_allow_date_field_width_5digits;
-=======
--- Test non-error-throwing API
-SELECT pg_input_is_valid('now', 'date');
-SELECT pg_input_is_valid('garbage', 'date');
-SELECT pg_input_is_valid('6874898-01-01', 'date');
-SELECT * FROM pg_input_error_info('garbage', 'date');
-SELECT * FROM pg_input_error_info('6874898-01-01', 'date');
->>>>>>> REL_16_9
RESET datestyle;
diff --git a/src/test/regress/sql/point.sql b/src/test/regress/sql/point.sql
index a883bdc0824..9e03826d2e8 100644
--- a/src/test/regress/sql/point.sql
+++ b/src/test/regress/sql/point.sql
@@ -5,33 +5,6 @@
-- avoid bit-exact output here because operations may not be bit-exact.
SET extra_float_digits = 0;
--- point_tbl was already created and filled in test_setup.sql.
--- Here we just try to insert bad values.
-
-<<<<<<< HEAD
-INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)');
-
-ANALYZE POINT_TBL;
-
-INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)');
-
-INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)');
-
-INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
-
-INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
-
-INSERT INTO POINT_TBL(f1) VALUES ('(1e-300,-1e-300)'); -- To underflow
-
-INSERT INTO POINT_TBL(f1) VALUES ('(1e+300,Inf)'); -- To overflow
-
-INSERT INTO POINT_TBL(f1) VALUES ('(Inf,1e+300)'); -- Transposed
-
-INSERT INTO POINT_TBL(f1) VALUES (' ( Nan , NaN ) ');
-
--- bad format points
-=======
->>>>>>> REL_16_9
INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]