Skip to content

Commit 449b637

Browse files
committed
index tests
1 parent 662214a commit 449b637

File tree

2 files changed

+196
-167
lines changed

2 files changed

+196
-167
lines changed
Lines changed: 191 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,205 @@
11
export const indexes = [
2-
{
3-
"RawStmt": {
4-
"stmt": {
5-
"IndexStmt": {
6-
"idxname": "idx_CaseSimple",
7-
"relation": {
8-
"relname": "Table_CaseSimple",
9-
"inh": true,
10-
"relpersistence": "p",
11-
"location": 33
12-
},
13-
"accessMethod": "btree",
14-
"indexParams": [
15-
{
16-
"IndexElem": {
17-
"name": "CaseSimple",
18-
"ordering": "SORTBY_DEFAULT",
19-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
2+
{
3+
RawStmt: {
4+
stmt: {
5+
IndexStmt: {
6+
idxname: 'idx_CaseSimple',
7+
relation: {
8+
relname: 'Table_CaseSimple',
9+
inh: true,
10+
relpersistence: 'p',
11+
location: 33
12+
},
13+
accessMethod: 'btree',
14+
indexParams: [
15+
{
16+
IndexElem: {
17+
name: 'CaseSimple',
18+
ordering: 'SORTBY_DEFAULT',
19+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
20+
}
2021
}
21-
}
22-
]
23-
}
24-
},
25-
"stmt_len": 66,
26-
"stmt_location": 0
27-
}
28-
},
29-
{
30-
"RawStmt": {
31-
"stmt": {
32-
"IndexStmt": {
33-
"idxname": "idx_CaseExpression",
34-
"relation": {
35-
"relname": "Table_CaseExperssion",
36-
"inh": true,
37-
"relpersistence": "p",
38-
"location": 106
39-
},
40-
"accessMethod": "btree",
41-
"indexParams": [
42-
{
43-
"IndexElem": {
44-
"expr": {
45-
"FuncCall": {
46-
"funcname": [
47-
{
48-
"String": {
49-
"str": "lower"
22+
]
23+
}
24+
},
25+
stmt_len: 66,
26+
stmt_location: 0
27+
}
28+
},
29+
{
30+
RawStmt: {
31+
stmt: {
32+
IndexStmt: {
33+
idxname: 'idx_simple',
34+
relation: {
35+
relname: 'table_simple',
36+
inh: true,
37+
relpersistence: 'p',
38+
location: 33
39+
},
40+
accessMethod: 'btree',
41+
indexParams: [
42+
{
43+
IndexElem: {
44+
name: 'CaseSimple',
45+
ordering: 'SORTBY_DEFAULT',
46+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
47+
}
48+
}
49+
]
50+
}
51+
},
52+
stmt_len: 66,
53+
stmt_location: 0
54+
}
55+
},
56+
{
57+
RawStmt: {
58+
stmt: {
59+
IndexStmt: {
60+
idxname: 'idx_CaseExpression',
61+
relation: {
62+
relname: 'Table_CaseExperssion',
63+
inh: true,
64+
relpersistence: 'p',
65+
location: 106
66+
},
67+
accessMethod: 'btree',
68+
indexParams: [
69+
{
70+
IndexElem: {
71+
expr: {
72+
FuncCall: {
73+
funcname: [
74+
{
75+
String: {
76+
str: 'lower'
77+
}
5078
}
51-
}
52-
],
53-
"args": [
54-
{
55-
"ColumnRef": {
56-
"fields": [
57-
{
58-
"String": {
59-
"str": "CaseSimple"
79+
],
80+
args: [
81+
{
82+
ColumnRef: {
83+
fields: [
84+
{
85+
String: {
86+
str: 'CaseSimple'
87+
}
6088
}
61-
}
62-
],
63-
"location": 136
89+
],
90+
location: 136
91+
}
6492
}
65-
}
66-
],
67-
"location": 130
68-
}
69-
},
70-
"ordering": "SORTBY_DEFAULT",
71-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
93+
],
94+
location: 130
95+
}
96+
},
97+
ordering: 'SORTBY_DEFAULT',
98+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
99+
}
72100
}
73-
}
74-
]
75-
}
76-
},
77-
"stmt_len": 83,
78-
"stmt_location": 67
79-
}
80-
},
81-
{
82-
"RawStmt": {
83-
"stmt": {
84-
"IndexStmt": {
85-
"idxname": "idx_CaseInclude",
86-
"relation": {
87-
"relname": "table_caseinclude",
88-
"inh": true,
89-
"relpersistence": "p",
90-
"location": 187
91-
},
92-
"accessMethod": "btree",
93-
"indexParams": [
94-
{
95-
"IndexElem": {
96-
"name": "simple",
97-
"ordering": "SORTBY_DEFAULT",
98-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
101+
]
102+
}
103+
},
104+
stmt_len: 83,
105+
stmt_location: 67
106+
}
107+
},
108+
{
109+
RawStmt: {
110+
stmt: {
111+
IndexStmt: {
112+
idxname: 'idx_CaseInclude',
113+
relation: {
114+
relname: 'table_caseinclude',
115+
inh: true,
116+
relpersistence: 'p',
117+
location: 187
118+
},
119+
accessMethod: 'btree',
120+
indexParams: [
121+
{
122+
IndexElem: {
123+
name: 'simple',
124+
ordering: 'SORTBY_DEFAULT',
125+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
126+
}
99127
}
100-
}
101-
],
102-
"indexIncludingParams": [
103-
{
104-
"IndexElem": {
105-
"name": "CaseInclude",
106-
"ordering": "SORTBY_DEFAULT",
107-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
128+
],
129+
indexIncludingParams: [
130+
{
131+
IndexElem: {
132+
name: 'CaseInclude',
133+
ordering: 'SORTBY_DEFAULT',
134+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
135+
}
108136
}
109-
}
110-
]
111-
}
112-
},
113-
"stmt_len": 86,
114-
"stmt_location": 151
115-
}
116-
},
117-
{
118-
"RawStmt": {
119-
"stmt": {
120-
"IndexStmt": {
121-
"idxname": "idx_CaseIncludeExpr",
122-
"relation": {
123-
"relname": "table_caseincludeexpr",
124-
"inh": true,
125-
"relpersistence": "p",
126-
"location": 277
127-
},
128-
"accessMethod": "btree",
129-
"indexParams": [
130-
{
131-
"IndexElem": {
132-
"name": "simple",
133-
"ordering": "SORTBY_DEFAULT",
134-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
137+
]
138+
}
139+
},
140+
stmt_len: 86,
141+
stmt_location: 151
142+
}
143+
},
144+
{
145+
RawStmt: {
146+
stmt: {
147+
IndexStmt: {
148+
idxname: 'idx_CaseIncludeExpr',
149+
relation: {
150+
relname: 'table_caseincludeexpr',
151+
inh: true,
152+
relpersistence: 'p',
153+
location: 277
154+
},
155+
accessMethod: 'btree',
156+
indexParams: [
157+
{
158+
IndexElem: {
159+
name: 'simple',
160+
ordering: 'SORTBY_DEFAULT',
161+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
162+
}
135163
}
136-
}
137-
],
138-
"indexIncludingParams": [
139-
{
140-
"IndexElem": {
141-
"expr": {
142-
"FuncCall": {
143-
"funcname": [
144-
{
145-
"String": {
146-
"str": "lower"
164+
],
165+
indexIncludingParams: [
166+
{
167+
IndexElem: {
168+
expr: {
169+
FuncCall: {
170+
funcname: [
171+
{
172+
String: {
173+
str: 'lower'
174+
}
147175
}
148-
}
149-
],
150-
"args": [
151-
{
152-
"ColumnRef": {
153-
"fields": [
154-
{
155-
"String": {
156-
"str": "CaseInclude"
176+
],
177+
args: [
178+
{
179+
ColumnRef: {
180+
fields: [
181+
{
182+
String: {
183+
str: 'CaseInclude'
184+
}
157185
}
158-
}
159-
],
160-
"location": 323
186+
],
187+
location: 323
188+
}
161189
}
162-
}
163-
],
164-
"location": 317
165-
}
166-
},
167-
"ordering": "SORTBY_DEFAULT",
168-
"nulls_ordering": "SORTBY_NULLS_DEFAULT"
190+
],
191+
location: 317
192+
}
193+
},
194+
ordering: 'SORTBY_DEFAULT',
195+
nulls_ordering: 'SORTBY_NULLS_DEFAULT'
196+
}
169197
}
170-
}
171-
]
172-
}
173-
},
174-
"stmt_len": 100,
175-
"stmt_location": 238
198+
]
199+
}
200+
},
201+
stmt_len: 100,
202+
stmt_location: 238
203+
}
176204
}
177-
}
178-
];
205+
];

packages/ast/test/__tests__/expressions/__snapshots__/indexes.test.js.snap

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
exports[`index_stmt 1`] = `"CREATE INDEX \\"idx_CaseSimple\\" ON \\"Table_CaseSimple\\" (\\"CaseSimple\\");"`;
44

5-
exports[`index_stmt 2`] = `"CREATE INDEX \\"idx_CaseExpression\\" ON \\"Table_CaseExperssion\\" (lower(\\"CaseSimple\\"));"`;
5+
exports[`index_stmt 2`] = `"CREATE INDEX idx_simple ON table_simple (\\"CaseSimple\\");"`;
66

7-
exports[`index_stmt 3`] = `"CREATE INDEX \\"idx_CaseInclude\\" ON table_caseinclude (simple) INCLUDE (\\"CaseInclude\\");"`;
7+
exports[`index_stmt 3`] = `"CREATE INDEX \\"idx_CaseExpression\\" ON \\"Table_CaseExperssion\\" (lower(\\"CaseSimple\\"));"`;
88

9-
exports[`index_stmt 4`] = `"CREATE INDEX \\"idx_CaseIncludeExpr\\" ON table_caseincludeexpr (simple) INCLUDE (lower(\\"CaseInclude\\"));"`;
9+
exports[`index_stmt 4`] = `"CREATE INDEX \\"idx_CaseInclude\\" ON table_caseinclude (simple) INCLUDE (\\"CaseInclude\\");"`;
10+
11+
exports[`index_stmt 5`] = `"CREATE INDEX \\"idx_CaseIncludeExpr\\" ON table_caseincludeexpr (simple) INCLUDE (lower(\\"CaseInclude\\"));"`;

0 commit comments

Comments
 (0)