Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit61ef6a1

Browse files
author
Thomas G. Lockhart
committed
Clean up syntax to use SQL92-ish type coersion
rather than the Postgres "::" notation.All of these tests have been completely inspected and give correct results.
1 parentf54668d commit61ef6a1

File tree

11 files changed

+124
-99
lines changed

11 files changed

+124
-99
lines changed

‎src/test/regress/sql/boolean.sql

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--
2-
-- boolean.source
3-
--
4-
-- $Header: /cvsroot/pgsql/src/test/regress/sql/boolean.sql,v 1.5 1997/12/01 02:45:59 thomas Exp $
2+
-- BOOLEAN
53
--
64

75
--
@@ -14,28 +12,28 @@ SELECT 1 AS one;
1412

1513
-- check bool type-casting as well as and, or, not in qualifications--
1614

17-
SELECT't'::boolAS true;
15+
SELECTbool't'AS true;
1816

19-
SELECT'f'::boolAS false;
17+
SELECTbool'f'AS false;
2018

21-
SELECT't'::boolor'f'::boolAS true;
19+
SELECTbool't'orbool'f'AS true;
2220

23-
SELECT't'::booland'f'::boolAS false;
21+
SELECTbool't'andbool'f'AS false;
2422

25-
SELECT not'f'::boolAS true;
23+
SELECT notbool'f'AS true;
2624

27-
SELECT't'::bool='f'::boolAS false;
25+
SELECTbool't'=bool'f'AS false;
2826

29-
SELECT't'::bool<>'f'::boolAS true;
27+
SELECTbool't'<>bool'f'AS true;
3028

3129

3230
CREATETABLEBOOLTBL1 (f1 bool);
3331

34-
INSERT INTO BOOLTBL1 (f1)VALUES ('t'::bool);
32+
INSERT INTO BOOLTBL1 (f1)VALUES (bool't');
3533

36-
INSERT INTO BOOLTBL1 (f1)VALUES ('True'::bool);
34+
INSERT INTO BOOLTBL1 (f1)VALUES (bool'True');
3735

38-
INSERT INTO BOOLTBL1 (f1)VALUES ('true'::bool);
36+
INSERT INTO BOOLTBL1 (f1)VALUES (bool'true');
3937

4038

4139
-- BOOLTBL1 should be full of true's at this point
@@ -44,38 +42,38 @@ SELECT '' AS t_3, BOOLTBL1.*;
4442

4543
SELECT''AS t_3, BOOLTBL1.*
4644
FROM BOOLTBL1
47-
WHERE f1='true'::bool;
45+
WHERE f1=bool'true';
4846

4947

5048
SELECT''AS t_3, BOOLTBL1.*
5149
FROM BOOLTBL1
52-
WHERE f1<>'false'::bool;
50+
WHERE f1<>bool'false';
5351

5452
SELECT''AS zero, BOOLTBL1.*
5553
FROM BOOLTBL1
56-
WHERE booleq('false'::bool, f1);
54+
WHERE booleq(bool'false', f1);
5755

58-
INSERT INTO BOOLTBL1 (f1)VALUES ('f'::bool);
56+
INSERT INTO BOOLTBL1 (f1)VALUES (bool'f');
5957

6058
SELECT''AS f_1, BOOLTBL1.*
6159
FROM BOOLTBL1
62-
WHERE f1='false'::bool;
60+
WHERE f1=bool'false';
6361

6462

6563
CREATETABLEBOOLTBL2 (f1 bool);
6664

67-
INSERT INTO BOOLTBL2 (f1)VALUES ('f'::bool);
65+
INSERT INTO BOOLTBL2 (f1)VALUES (bool'f');
6866

69-
INSERT INTO BOOLTBL2 (f1)VALUES ('false'::bool);
67+
INSERT INTO BOOLTBL2 (f1)VALUES (bool'false');
7068

71-
INSERT INTO BOOLTBL2 (f1)VALUES ('False'::bool);
69+
INSERT INTO BOOLTBL2 (f1)VALUES (bool'False');
7270

73-
INSERT INTO BOOLTBL2 (f1)VALUES ('FALSE'::bool);
71+
INSERT INTO BOOLTBL2 (f1)VALUES (bool'FALSE');
7472

7573
-- This is now an invalid expression
7674
-- For pre-v6.3 this evaluated to false - thomas 1997-10-23
7775
INSERT INTO BOOLTBL2 (f1)
78-
VALUES ('XXX'::bool);
76+
VALUES (bool'XXX');
7977

8078
-- BOOLTBL2 should be full of false's at this point
8179
SELECT''AS f_4, BOOLTBL2.*;
@@ -90,33 +88,51 @@ SELECT '' AS tf_12, BOOLTBL1.*, BOOLTBL2.*
9088

9189

9290
SELECT''AS ff_4, BOOLTBL1.*, BOOLTBL2.*
93-
WHEREBOOLTBL2.f1=BOOLTBL1.f1andBOOLTBL1.f1='false'::bool;
91+
WHEREBOOLTBL2.f1=BOOLTBL1.f1andBOOLTBL1.f1=bool'false';
9492

9593

9694
SELECT''AS tf_12_ff_4, BOOLTBL1.*, BOOLTBL2.*
97-
WHEREBOOLTBL2.f1=BOOLTBL1.f1orBOOLTBL1.f1='true'::bool
95+
WHEREBOOLTBL2.f1=BOOLTBL1.f1orBOOLTBL1.f1=bool'true'
9896
ORDER BYBOOLTBL1.f1,BOOLTBL2.f1;
9997

10098
--
101-
-- SQL92 syntax - thomas 1997-11-30
99+
-- SQL92 syntax
100+
-- Try all combinations to ensure that we get nothing when we expect nothing
101+
-- - thomas 2000-01-04
102102
--
103103

104-
SELECT''AS"True",BOOLTBL1.*
104+
SELECT''AS"True",f1
105105
FROM BOOLTBL1
106106
WHERE f1 IS TRUE;
107107

108-
SELECT''AS"Not False",BOOLTBL1.*
108+
SELECT''AS"Not False",f1
109109
FROM BOOLTBL1
110110
WHERE f1 IS NOT FALSE;
111111

112-
SELECT''AS"False",BOOLTBL1.*
112+
SELECT''AS"False",f1
113113
FROM BOOLTBL1
114114
WHERE f1 IS FALSE;
115115

116-
SELECT''AS"Not True",BOOLTBL1.*
116+
SELECT''AS"Not True",f1
117117
FROM BOOLTBL1
118118
WHERE f1 IS NOT TRUE;
119119

120+
SELECT''AS"True", f1
121+
FROM BOOLTBL2
122+
WHERE f1 IS TRUE;
123+
124+
SELECT''AS"Not False", f1
125+
FROM BOOLTBL2
126+
WHERE f1 IS NOT FALSE;
127+
128+
SELECT''AS"False", f1
129+
FROM BOOLTBL2
130+
WHERE f1 IS FALSE;
131+
132+
SELECT''AS"Not True", f1
133+
FROM BOOLTBL2
134+
WHERE f1 IS NOT TRUE;
135+
120136
--
121137
-- Clean up
122138
-- Many tables are retained by the regression test, but these do not seem

‎src/test/regress/sql/char.sql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
-- ****************** test built-in type char **************
21
--
2+
-- CHAR
33
-- all inputs are SILENTLY truncated at 1 character
44
--
55

66
-- fixed-length by value
77
-- internally passed by value if <= 4 bytes in storage
8-
-- Not sure why this is a really useful test,
9-
-- but this test has been here forever. - thomas 1997-11-30
108

11-
SELECT'c'::char='c'::charAS true;
9+
SELECTchar'c'=char'c'AS true;
1210

1311
--
1412
-- Build a table for testing

‎src/test/regress/sql/float4.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
-- *************testing built-in type float4 ****************
1+
--
2+
-- FLOAT4
3+
--
24

35
CREATETABLEFLOAT4_TBL (f1 float4);
46

‎src/test/regress/sql/float8.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
-- *************testing built-in type float8 ****************
1+
--
2+
-- FLOAT8
3+
--
24

35
CREATETABLEFLOAT8_TBL(f1 float8);
46

‎src/test/regress/sql/int2.sql

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- *************testing built-in type int2 ****************
21
--
2+
-- INT2
33
-- NOTE: int2 operators never check for over/underflow!
44
-- Some of these answers are consequently numerically incorrect.
55
--
@@ -27,49 +27,49 @@ INSERT INTO INT2_TBL(f1) VALUES ('asdf');
2727

2828
SELECT''AS five, INT2_TBL.*;
2929

30-
SELECT''AS four, i.*FROM INT2_TBL iWHEREi.f1<>'0'::int2;
30+
SELECT''AS four, i.*FROM INT2_TBL iWHEREi.f1<>int2'0';
3131

32-
SELECT''AS four, i.*FROM INT2_TBL iWHEREi.f1<>'0'::int4;
32+
SELECT''AS four, i.*FROM INT2_TBL iWHEREi.f1<>int4'0';
3333

34-
SELECT''AS one, i.*FROM INT2_TBL iWHEREi.f1='0'::int2;
34+
SELECT''AS one, i.*FROM INT2_TBL iWHEREi.f1=int2'0';
3535

36-
SELECT''AS one, i.*FROM INT2_TBL iWHEREi.f1='0'::int4;
36+
SELECT''AS one, i.*FROM INT2_TBL iWHEREi.f1=int4'0';
3737

38-
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1<'0'::int2;
38+
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1<int2'0';
3939

40-
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1<'0'::int4;
40+
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1<int4'0';
4141

42-
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1<='0'::int2;
42+
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1<=int2'0';
4343

44-
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1<='0'::int4;
44+
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1<=int4'0';
4545

46-
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1>'0'::int2;
46+
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1>int2'0';
4747

48-
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1>'0'::int4;
48+
SELECT''AS two, i.*FROM INT2_TBL iWHEREi.f1>int4'0';
4949

50-
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1>='0'::int2;
50+
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1>=int2'0';
5151

52-
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1>='0'::int4;
52+
SELECT''AS three, i.*FROM INT2_TBL iWHEREi.f1>=int4'0';
5353

5454
-- positive odds
55-
SELECT''AS one, i.*FROM INT2_TBL iWHERE (i.f1 %'2'::int2)='1'::int2;
55+
SELECT''AS one, i.*FROM INT2_TBL iWHERE (i.f1 %int2'2')=int2'1';
5656

5757
-- any evens
58-
SELECT''AS three, i.*FROM INT2_TBL iWHERE (i.f1 %'2'::int4)='0'::int2;
58+
SELECT''AS three, i.*FROM INT2_TBL iWHERE (i.f1 %int4'2')=int2'0';
5959

60-
SELECT''AS five,i.f1,i.f1*'2'::int2AS xFROM INT2_TBL i;
60+
SELECT''AS five,i.f1,i.f1*int2'2'AS xFROM INT2_TBL i;
6161

62-
SELECT''AS five,i.f1,i.f1*'2'::int4AS xFROM INT2_TBL i;
62+
SELECT''AS five,i.f1,i.f1*int4'2'AS xFROM INT2_TBL i;
6363

64-
SELECT''AS five,i.f1,i.f1+'2'::int2AS xFROM INT2_TBL i;
64+
SELECT''AS five,i.f1,i.f1+int2'2'AS xFROM INT2_TBL i;
6565

66-
SELECT''AS five,i.f1,i.f1+'2'::int4AS xFROM INT2_TBL i;
66+
SELECT''AS five,i.f1,i.f1+int4'2'AS xFROM INT2_TBL i;
6767

68-
SELECT''AS five,i.f1,i.f1-'2'::int2AS xFROM INT2_TBL i;
68+
SELECT''AS five,i.f1,i.f1-int2'2'AS xFROM INT2_TBL i;
6969

70-
SELECT''AS five,i.f1,i.f1-'2'::int4AS xFROM INT2_TBL i;
70+
SELECT''AS five,i.f1,i.f1-int4'2'AS xFROM INT2_TBL i;
7171

72-
SELECT''AS five,i.f1,i.f1/'2'::int2AS xFROM INT2_TBL i;
72+
SELECT''AS five,i.f1,i.f1/int2'2'AS xFROM INT2_TBL i;
7373

74-
SELECT''AS five,i.f1,i.f1/'2'::int4AS xFROM INT2_TBL i;
74+
SELECT''AS five,i.f1,i.f1/int4'2'AS xFROM INT2_TBL i;
7575

‎src/test/regress/sql/int4.sql

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- *************testing built-in type int4 ****************
21
--
2+
-- INT4
33
-- WARNING: int4 operators never check for over/underflow!
44
-- Some of these answers are consequently numerically incorrect.
55
--
@@ -27,51 +27,51 @@ INSERT INTO INT4_TBL(f1) VALUES ('asdf');
2727

2828
SELECT''AS five, INT4_TBL.*;
2929

30-
SELECT''AS four, i.*FROM INT4_TBL iWHEREi.f1<>'0'::int2;
30+
SELECT''AS four, i.*FROM INT4_TBL iWHEREi.f1<>int2'0';
3131

32-
SELECT''AS four, i.*FROM INT4_TBL iWHEREi.f1<>'0'::int4;
32+
SELECT''AS four, i.*FROM INT4_TBL iWHEREi.f1<>int4'0';
3333

34-
SELECT''AS one, i.*FROM INT4_TBL iWHEREi.f1='0'::int2;
34+
SELECT''AS one, i.*FROM INT4_TBL iWHEREi.f1=int2'0';
3535

36-
SELECT''AS one, i.*FROM INT4_TBL iWHEREi.f1='0'::int4;
36+
SELECT''AS one, i.*FROM INT4_TBL iWHEREi.f1=int4'0';
3737

38-
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1<'0'::int2;
38+
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1<int2'0';
3939

40-
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1<'0'::int4;
40+
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1<int4'0';
4141

42-
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1<='0'::int2;
42+
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1<=int2'0';
4343

44-
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1<='0'::int4;
44+
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1<=int4'0';
4545

46-
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1>'0'::int2;
46+
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1>int2'0';
4747

48-
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1>'0'::int4;
48+
SELECT''AS two, i.*FROM INT4_TBL iWHEREi.f1>int4'0';
4949

50-
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1>='0'::int2;
50+
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1>=int2'0';
5151

52-
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1>='0'::int4;
52+
SELECT''AS three, i.*FROM INT4_TBL iWHEREi.f1>=int4'0';
5353

5454
-- positive odds
55-
SELECT''AS one, i.*FROM INT4_TBL iWHERE (i.f1 %'2'::int2)='1'::int2;
55+
SELECT''AS one, i.*FROM INT4_TBL iWHERE (i.f1 %int2'2')=int2'1';
5656

5757
-- any evens
58-
SELECT''AS three, i.*FROM INT4_TBL iWHERE (i.f1 %'2'::int4)='0'::int2;
58+
SELECT''AS three, i.*FROM INT4_TBL iWHERE (i.f1 %int4'2')=int2'0';
5959

60-
SELECT''AS five,i.f1,i.f1*'2'::int2AS xFROM INT4_TBL i;
60+
SELECT''AS five,i.f1,i.f1*int2'2'AS xFROM INT4_TBL i;
6161

62-
SELECT''AS five,i.f1,i.f1*'2'::int4AS xFROM INT4_TBL i;
62+
SELECT''AS five,i.f1,i.f1*int4'2'AS xFROM INT4_TBL i;
6363

64-
SELECT''AS five,i.f1,i.f1+'2'::int2AS xFROM INT4_TBL i;
64+
SELECT''AS five,i.f1,i.f1+int2'2'AS xFROM INT4_TBL i;
6565

66-
SELECT''AS five,i.f1,i.f1+'2'::int4AS xFROM INT4_TBL i;
66+
SELECT''AS five,i.f1,i.f1+int4'2'AS xFROM INT4_TBL i;
6767

68-
SELECT''AS five,i.f1,i.f1-'2'::int2AS xFROM INT4_TBL i;
68+
SELECT''AS five,i.f1,i.f1-int2'2'AS xFROM INT4_TBL i;
6969

70-
SELECT''AS five,i.f1,i.f1-'2'::int4AS xFROM INT4_TBL i;
70+
SELECT''AS five,i.f1,i.f1-int4'2'AS xFROM INT4_TBL i;
7171

72-
SELECT''AS five,i.f1,i.f1/'2'::int2AS xFROM INT4_TBL i;
72+
SELECT''AS five,i.f1,i.f1/int2'2'AS xFROM INT4_TBL i;
7373

74-
SELECT''AS five,i.f1,i.f1/'2'::int4AS xFROM INT4_TBL i;
74+
SELECT''AS five,i.f1,i.f1/int4'2'AS xFROM INT4_TBL i;
7575

7676
--
7777
-- more complex expressions
@@ -86,13 +86,13 @@ SELECT 2- -1 AS three;
8686

8787
SELECT2--2AS four;
8888

89-
SELECT'2'::int2*'2'::int2='16'::int2/'4'::int2AS true;
89+
SELECTint2'2'*int2'2'=int2'16'/int2'4'AS true;
9090

91-
SELECT'2'::int4*'2'::int2='16'::int2/'4'::int4AS true;
91+
SELECTint4'2'*int2'2'=int2'16'/int4'4'AS true;
9292

93-
SELECT'2'::int2*'2'::int4='16'::int4/'4'::int2AS true;
93+
SELECTint2'2'*int4'2'=int4'16'/int2'4'AS true;
9494

95-
SELECT'1000'::int4<'999'::int4AS false;
95+
SELECTint4'1000'<int4'999'AS false;
9696

9797
SELECT4!AS twenty_four;
9898

@@ -104,9 +104,9 @@ SELECT 2 + 2 / 2 AS three;
104104

105105
SELECT (2+2)/2AS two;
106106

107-
SELECT dsqrt('64'::float8)AS eight;
107+
SELECT dsqrt(float8'64')AS eight;
108108

109-
SELECT |/'64'::float8AS eight;
109+
SELECT |/float8'64'AS eight;
110110

111-
SELECT||/'27'::float8AS three;
111+
SELECT||/float8'27'AS three;
112112

‎src/test/regress/sql/int8.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--
2+
-- INT8
23
-- Test int8 64-bit integers.
34
--
45
CREATETABLEINT8_TBL(q1 int8, q2 int8);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp