Skip to content

Commit bbe6bc6

Browse files
craig[bot]yuzefovich
andcommitted
Merge #147195
147195: eval: remove wrapping from builtin errors r=yuzefovich a=yuzefovich **roachtest/pg_regress: accept recent diff** Fixes: #147252. **eval: remove wrapping from builtin errors** This PR removes the code to perform error wrapping around the errors produced by the builtin function which provides a bit more context (like the function name). This wrapping dates all the way back to a commit from 2015 716837e. Over the years it was expanded to also provide some more context to the sentry reports (7b703de). I don't think either of these provide much value since it's usually clear which builtin the error corresponds to and having just the builtin name in the sentry report doesn't make it any more actionable. Removing of this logic allows us to match errors as they are produced by Postgres. **builins: unify an error message in substring with PG** Epic: None Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
2 parents dc81a93 + 93bd46c commit bbe6bc6

File tree

89 files changed

+915
-1361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+915
-1361
lines changed

pkg/backup/testdata/backup-restore/multiregion-mismatch-table-locality

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ SELECT count(*) FROM d.t;
8080
exec-sql
8181
INSERT INTO d.t VALUES (4)
8282
----
83-
pq: default_to_database_primary_region(): current database defaultdb is not multi-region enabled
83+
pq: current database defaultdb is not multi-region enabled
8484

8585
exec-sql
8686
USE d;

pkg/ccl/logictestccl/testdata/logic_test/crdb_internal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ subtest replication-builtins
172172
user root
173173

174174

175-
query error pq: crdb_internal\.stream_ingestion_stats_json\(\): unimplemented
175+
query error pq: unimplemented
176176
SELECT crdb_internal.stream_ingestion_stats_json(1);
177177

178-
query error pq: crdb_internal\.stream_ingestion_stats_pb\(\): unimplemented
178+
query error pq: unimplemented
179179
SELECT crdb_internal.stream_ingestion_stats_pb(1);
180180

181181
subtest node_tenant_capabilities_cache

pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ select crdb_internal.force_retry(interval '0s')
278278
----
279279
0
280280

281-
query error pq: crdb_internal.set_vmodule\(\): syntax error: expect comma-separated list of filename=N
281+
query error pq: syntax error: expect comma-separated list of filename=N
282282
select crdb_internal.set_vmodule('not anything reasonable')
283283

284284
query I

pkg/ccl/logictestccl/testdata/logic_test/fips_ready

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ _
1010

1111
user testuser
1212

13-
statement error pq: crdb_internal\.fips_ready\(\): user testuser does not have VIEWCLUSTERSETTING system privilege
13+
statement error pq: user testuser does not have VIEWCLUSTERSETTING system privilege
1414
SELECT crdb_internal.fips_ready()

pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ TABLE tbl11 ALTER TABLE tbl11 CONFIGURE ZONE USING
19501950
constraints = '[]',
19511951
lease_preferences = '[]'
19521952

1953-
query error pq: crdb_internal\.reset_multi_region_zone_configs_for_table\(\): error resolving referenced table ID 1: relation "\[1\]" does not exist
1953+
query error pq: error resolving referenced table ID 1: relation "\[1\]" does not exist
19541954
SELECT crdb_internal.reset_multi_region_zone_configs_for_table(1)
19551955

19561956
subtest reset_multi_region_zone_configs_database
@@ -2062,7 +2062,7 @@ let $descriptor_table_id
20622062
SELECT table_id FROM crdb_internal.tables WHERE schema_name = 'public' AND name = 'descriptor'
20632063

20642064
# Validate that builtin errors if called on a table id
2065-
query error pq: crdb_internal\.reset_multi_region_zone_configs_for_database\(\): database "\[3\]" does not exist
2065+
query error pq: database "\[3\]" does not exist
20662066
SELECT crdb_internal.reset_multi_region_zone_configs_for_database($descriptor_table_id)
20672067

20682068
user testuser

pkg/ccl/logictestccl/testdata/logic_test/tenant_usage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ SELECT crdb_internal.update_tenant_resource_limits('apptenant', 1000, 100, 0)
3636

3737
user testuser
3838

39-
statement error crdb_internal.update_tenant_resource_limits\(\): user testuser does not have REPAIRCLUSTER system privilege
39+
statement error user testuser does not have REPAIRCLUSTER system privilege
4040
SELECT crdb_internal.update_tenant_resource_limits(5, 1000, 100, 0, now(), 0)

pkg/ccl/testccl/authccl/testdata/ldap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,6 @@ ERROR: no rows in result set
377377
query_row
378378
SELECT pg_has_role('ldap_user', 'ldap-parent-unsynced', 'MEMBER')
379379
----
380-
ERROR: pg_has_role(): role 'ldap-parent-unsynced' does not exist (SQLSTATE 42704)
380+
ERROR: role 'ldap-parent-unsynced' does not exist (SQLSTATE 42704)
381381

382382
subtest end

pkg/cmd/roachtest/testdata/pg_regress/arrays.diffs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/arrays.out --labe
23042304
+HINT: No function matches the given name and argument types. You might need to add explicit type casts.
23052305
+-- error cases
23062306
+SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]);
2307-
+ERROR: width_bucket(): operand and thresholds must be of the same type
2307+
+ERROR: operand and thresholds must be of the same type
23082308
+SELECT width_bucket(5, ARRAY[3, 4, NULL]);
23092309
width_bucket
23102310
--------------
@@ -2322,7 +2322,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/arrays.out --labe
23222322
-ERROR: thresholds array must not contain NULLs
23232323
SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]);
23242324
-ERROR: thresholds must be one-dimensional array
2325-
+ERROR: width_bucket(): operand and thresholds must be of the same type
2325+
+ERROR: operand and thresholds must be of the same type
23262326
-- trim_array
23272327
SELECT arr, trim_array(arr, 2)
23282328
FROM

pkg/cmd/roachtest/testdata/pg_regress/bit.diffs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/bit.out --label=/
2525
--INSERT INTO VARBIT_TABLE VALUES ('X554');
2626
--INSERT INTO VARBIT_TABLE VALUES ('X555');
2727
SELECT * FROM VARBIT_TABLE;
28-
@@ -120,7 +120,7 @@
29-
(1 row)
30-
31-
SELECT SUBSTRING('01010101'::bit(8) FROM -10 FOR -2147483646) AS "error";
32-
-ERROR: negative substring length not allowed
33-
+ERROR: substring(): negative bit subarray length -2147483646 not allowed
34-
SELECT SUBSTRING('01010101'::varbit FROM 2 FOR 2147483646) AS "1010101";
35-
1010101
36-
---------
37-
@@ -134,7 +134,7 @@
38-
(1 row)
39-
40-
SELECT SUBSTRING('01010101'::varbit FROM -10 FOR -2147483646) AS "error";
41-
-ERROR: negative substring length not allowed
42-
+ERROR: substring(): negative bit subarray length -2147483646 not allowed
43-
--- Bit operations
44-
DROP TABLE varbit_table;
45-
CREATE TABLE varbit_table (a BIT VARYING(16), b BIT VARYING(16));
4628
@@ -248,231 +248,231 @@
4729
ERROR: cannot XOR bit strings of different sizes
4830
-- More position tests, checking all the boundary cases
@@ -475,12 +457,8 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/bit.out --label=/
475457
(16 rows)
476458

477459
SELECT v, v >> 1 AS vsr, v << 1 AS vsl
478-
@@ -684,32 +684,20 @@
479-
(1 row)
480-
481-
SELECT set_bit(B'0101011000100100', 16, 1); -- fail
482-
-ERROR: bit index 16 out of valid range (0..15)
483-
+ERROR: set_bit(): bit index 16 out of valid range (0..15)
460+
@@ -687,29 +687,17 @@
461+
ERROR: bit index 16 out of valid range (0..15)
484462
-- Overlay
485463
SELECT overlay(B'0101011100' placing '001' from 2 for 3);
486464
- overlay

pkg/cmd/roachtest/testdata/pg_regress/date.diffs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,13 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/date.out --label=
688688

689689
SELECT EXTRACT(TIMEZONE FROM DATE '2020-08-11');
690690
-ERROR: unit "timezone" not supported for type date
691-
+ERROR: extract(): unsupported timespan: timezone
691+
+ERROR: unsupported timespan: timezone
692692
SELECT EXTRACT(TIMEZONE_M FROM DATE '2020-08-11');
693693
-ERROR: unit "timezone_m" not supported for type date
694-
+ERROR: extract(): unsupported timespan: timezone_m
694+
+ERROR: unsupported timespan: timezone_m
695695
SELECT EXTRACT(TIMEZONE_H FROM DATE '2020-08-11');
696696
-ERROR: unit "timezone_h" not supported for type date
697-
+ERROR: extract(): unsupported timespan: timezone_h
697+
+ERROR: unsupported timespan: timezone_h
698698
SELECT EXTRACT(EPOCH FROM DATE '2020-08-11');
699699
- extract
700700
-------------
@@ -829,64 +829,64 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/date.out --label=
829829
-
830830
-(1 row)
831831
-
832-
+ERROR: extract(): infinity out of range for timestamp
832+
+ERROR: infinity out of range for timestamp
833833
SELECT EXTRACT(DAY FROM DATE '-infinity'); -- NULL
834834
- extract
835835
----------
836836
-
837837
-(1 row)
838838
-
839-
+ERROR: extract(): -infinity out of range for timestamp
839+
+ERROR: -infinity out of range for timestamp
840840
-- all supported fields
841841
SELECT EXTRACT(DAY FROM DATE 'infinity'); -- NULL
842842
- extract
843843
----------
844844
-
845845
-(1 row)
846846
-
847-
+ERROR: extract(): infinity out of range for timestamp
847+
+ERROR: infinity out of range for timestamp
848848
SELECT EXTRACT(MONTH FROM DATE 'infinity'); -- NULL
849849
- extract
850850
----------
851851
-
852852
-(1 row)
853853
-
854-
+ERROR: extract(): infinity out of range for timestamp
854+
+ERROR: infinity out of range for timestamp
855855
SELECT EXTRACT(QUARTER FROM DATE 'infinity'); -- NULL
856856
- extract
857857
----------
858858
-
859859
-(1 row)
860860
-
861-
+ERROR: extract(): infinity out of range for timestamp
861+
+ERROR: infinity out of range for timestamp
862862
SELECT EXTRACT(WEEK FROM DATE 'infinity'); -- NULL
863863
- extract
864864
----------
865865
-
866866
-(1 row)
867867
-
868-
+ERROR: extract(): infinity out of range for timestamp
868+
+ERROR: infinity out of range for timestamp
869869
SELECT EXTRACT(DOW FROM DATE 'infinity'); -- NULL
870870
- extract
871871
----------
872872
-
873873
-(1 row)
874874
-
875-
+ERROR: extract(): infinity out of range for timestamp
875+
+ERROR: infinity out of range for timestamp
876876
SELECT EXTRACT(ISODOW FROM DATE 'infinity'); -- NULL
877877
- extract
878878
----------
879879
-
880880
-(1 row)
881881
-
882-
+ERROR: extract(): infinity out of range for timestamp
882+
+ERROR: infinity out of range for timestamp
883883
SELECT EXTRACT(DOY FROM DATE 'infinity'); -- NULL
884884
- extract
885885
----------
886886
-
887887
-(1 row)
888888
-
889-
+ERROR: extract(): infinity out of range for timestamp
889+
+ERROR: infinity out of range for timestamp
890890
--
891891
-- monotonic fields from non-finite date:
892892
--
@@ -896,70 +896,70 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/date.out --label=
896896
- Infinity
897897
-(1 row)
898898
-
899-
+ERROR: extract(): infinity out of range for timestamp
899+
+ERROR: infinity out of range for timestamp
900900
SELECT EXTRACT(EPOCH FROM DATE '-infinity'); -- -Infinity
901901
- extract
902902
------------
903903
- -Infinity
904904
-(1 row)
905905
-
906-
+ERROR: extract(): -infinity out of range for timestamp
906+
+ERROR: -infinity out of range for timestamp
907907
-- all supported fields
908908
SELECT EXTRACT(YEAR FROM DATE 'infinity'); -- Infinity
909909
- extract
910910
-----------
911911
- Infinity
912912
-(1 row)
913913
-
914-
+ERROR: extract(): infinity out of range for timestamp
914+
+ERROR: infinity out of range for timestamp
915915
SELECT EXTRACT(DECADE FROM DATE 'infinity'); -- Infinity
916916
- extract
917917
-----------
918918
- Infinity
919919
-(1 row)
920920
-
921-
+ERROR: extract(): infinity out of range for timestamp
921+
+ERROR: infinity out of range for timestamp
922922
SELECT EXTRACT(CENTURY FROM DATE 'infinity'); -- Infinity
923923
- extract
924924
-----------
925925
- Infinity
926926
-(1 row)
927927
-
928-
+ERROR: extract(): infinity out of range for timestamp
928+
+ERROR: infinity out of range for timestamp
929929
SELECT EXTRACT(MILLENNIUM FROM DATE 'infinity'); -- Infinity
930930
- extract
931931
-----------
932932
- Infinity
933933
-(1 row)
934934
-
935-
+ERROR: extract(): infinity out of range for timestamp
935+
+ERROR: infinity out of range for timestamp
936936
SELECT EXTRACT(JULIAN FROM DATE 'infinity'); -- Infinity
937937
- extract
938938
-----------
939939
- Infinity
940940
-(1 row)
941941
-
942-
+ERROR: extract(): infinity out of range for timestamp
942+
+ERROR: infinity out of range for timestamp
943943
SELECT EXTRACT(ISOYEAR FROM DATE 'infinity'); -- Infinity
944944
- extract
945945
-----------
946946
- Infinity
947947
-(1 row)
948948
-
949-
+ERROR: extract(): infinity out of range for timestamp
949+
+ERROR: infinity out of range for timestamp
950950
SELECT EXTRACT(EPOCH FROM DATE 'infinity'); -- Infinity
951951
- extract
952952
-----------
953953
- Infinity
954954
-(1 row)
955955
-
956-
+ERROR: extract(): infinity out of range for timestamp
956+
+ERROR: infinity out of range for timestamp
957957
--
958958
-- wrong fields from non-finite date:
959959
--
960960
SELECT EXTRACT(MICROSEC FROM DATE 'infinity'); -- error
961961
-ERROR: unit "microsec" not recognized for type date
962-
+ERROR: extract(): infinity out of range for timestamp
962+
+ERROR: infinity out of range for timestamp
963963
-- test constructors
964964
select make_date(2013, 7, 15);
965965
make_date
@@ -985,7 +985,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/date.out --label=
985985
-- should fail
986986
select make_date(0, 7, 15);
987987
-ERROR: date field value out of range: 0-07-15
988-
+ERROR: make_date(): year value of 0 is not valid
988+
+ERROR: year value of 0 is not valid
989989
select make_date(2013, 2, 30);
990990
-ERROR: date field value out of range: 2013-02-30
991991
+ make_date

0 commit comments

Comments
 (0)