You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/bdd/flex/lua-index-definitions.feature
+61-64Lines changed: 61 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,16 @@
1
1
Feature: Index definitions in Lua file
2
2
3
+
Background:
4
+
Given the SQL statement mytable_indexes
5
+
"""
6
+
SELECT indexdef, indisprimary as is_primary
7
+
FROM pg_catalog.pg_index, pg_catalog.pg_indexes
8
+
WHERE schemaname = 'public'
9
+
AND tablename = 'mytable'
10
+
AND indrelid = tablename::regclass
11
+
AND indexrelid = indexname::regclass
12
+
"""
13
+
3
14
Scenario: Indexes field in table definition must be an array
4
15
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
5
16
And the lua style
@@ -36,9 +47,9 @@ Feature: Index definitions in Lua file
36
47
})
37
48
"""
38
49
When running osm2pgsql flex
39
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING gist (geom)%'
40
-
| schemaname | tablename |
41
-
| public | mytable |
50
+
Then statement mytable_indexes returns
51
+
| indexdef@substr |
52
+
| USINGgist (geom) |
42
53
43
54
Scenario: Empty indexes field in table definition gets you no index
44
55
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -56,8 +67,8 @@ Feature: Index definitions in Lua file
56
67
})
57
68
"""
58
69
When running osm2pgsql flex
59
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable'
60
-
| schemaname | tablename |
70
+
Then statement mytable_indexes returns exactly
71
+
| indexdef |
61
72
62
73
Scenario: Explicitly setting an index column works
63
74
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -77,9 +88,9 @@ Feature: Index definitions in Lua file
77
88
})
78
89
"""
79
90
When running osm2pgsql flex
80
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%'
81
-
| schemaname | tablename |
82
-
| public | mytable |
91
+
Then statement mytable_indexes returns
92
+
| indexdef@substr |
93
+
| USINGbtree (name) |
83
94
84
95
Scenario: Explicitly setting multiple indexes
85
96
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -101,15 +112,11 @@ Feature: Index definitions in Lua file
101
112
})
102
113
"""
103
114
When running osm2pgsql flex
104
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%'
105
-
| schemaname | tablename |
106
-
| public | mytable |
107
-
And SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING gist (geom)%'
108
-
| schemaname | tablename |
109
-
| public | mytable |
110
-
And SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name, tags)%'
111
-
| schemaname | tablename |
112
-
| public | mytable |
115
+
Then statement mytable_indexes returns exactly
116
+
| indexdef@substr |
117
+
| USINGbtree (name) |
118
+
| USINGgist (geom) |
119
+
| USINGbtree (name, tags) |
113
120
114
121
Scenario: Method can not be missing
115
122
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -244,11 +251,10 @@ Feature: Index definitions in Lua file
244
251
})
245
252
"""
246
253
When running osm2pgsql flex
247
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (lower(name))%'
248
-
| schemaname | tablename |
249
-
| public | mytable |
254
+
Then statement mytable_indexes returns
255
+
| indexdef@substr |
256
+
| USINGbtree (lower(name)) |
250
257
251
-
@needs-pg-index-includes
252
258
Scenario: Include field must be a string or array
253
259
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
254
260
And the lua style
@@ -272,7 +278,6 @@ Feature: Index definitions in Lua file
272
278
The 'include' field in an index definition must contain a string or an array.
273
279
"""
274
280
275
-
@needs-pg-index-includes
276
281
Scenario: Include field must contain a valid column
277
282
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
278
283
And the lua style
@@ -296,7 +301,6 @@ Feature: Index definitions in Lua file
296
301
Unknown column 'foo' in table 'mytable'.
297
302
"""
298
303
299
-
@needs-pg-index-includes
300
304
Scenario: Include field works with string
301
305
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
302
306
And the lua style
@@ -315,11 +319,10 @@ Feature: Index definitions in Lua file
315
319
})
316
320
"""
317
321
When running osm2pgsql flex
318
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%' AND indexdef LIKE '%INCLUDE (tags)%'
319
-
| schemaname | tablename |
320
-
| public | mytable |
322
+
Then statement mytable_indexes returns
323
+
| indexdef@substr |
324
+
| USINGbtree (name) INCLUDE (tags) |
321
325
322
-
@needs-pg-index-includes
323
326
Scenario: Include field works with array
324
327
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
325
328
And the lua style
@@ -338,9 +341,9 @@ Feature: Index definitions in Lua file
338
341
})
339
342
"""
340
343
When running osm2pgsql flex
341
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%' AND indexdef LIKE '%INCLUDE (tags)%'
342
-
| schemaname | tablename |
343
-
| public | mytable |
344
+
Then statement mytable_indexes returns
345
+
| indexdef@substr |
346
+
| USINGbtree (name) INCLUDE (tags) |
344
347
345
348
Scenario: Tablespace needs a string
346
349
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -383,9 +386,9 @@ Feature: Index definitions in Lua file
383
386
})
384
387
"""
385
388
When running osm2pgsql flex
386
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%'
387
-
| schemaname | tablename |
388
-
| public | mytable |
389
+
Then statement mytable_indexes returns
390
+
| indexdef@substr |
391
+
| USINGbtree (name) |
389
392
390
393
Scenario: Unique needs a boolean
391
394
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -428,9 +431,9 @@ Feature: Index definitions in Lua file
428
431
})
429
432
"""
430
433
When running osm2pgsql flex
431
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable' AND indexdef LIKE '%USING btree (name)%' AND indexdef LIKE '%UNIQUE%'
432
-
| schemaname | tablename |
433
-
| public | mytable |
434
+
Then statement mytable_indexes returns
435
+
| indexdef@fullmatch |
436
+
| .*UNIQUE.*USINGbtree \(name\).* |
434
437
435
438
Scenario: Where condition needs a string
436
439
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -473,9 +476,9 @@ Feature: Index definitions in Lua file
473
476
})
474
477
"""
475
478
When running osm2pgsql flex
476
-
Then table pg_catalog.pg_indexes contains
477
-
| schemaname | tablename | indexdef@fullmatch |
478
-
| public | mytable | .*USINGbtree\(name\).*WHERE\(name = lower\(name\)\).* |
479
+
Then statement mytable_indexes returns
480
+
| indexdef@substr |
481
+
| USINGbtree (name) WHERE (name = lower(name)) |
479
482
480
483
481
484
Scenario: Don't create id index if the configuration doesn't mention it
@@ -493,9 +496,9 @@ Feature: Index definitions in Lua file
493
496
})
494
497
"""
495
498
When running osm2pgsql flex
496
-
Then table pg_catalog.pg_indexes doesn't contain
497
-
| schemaname | tablename | indexname@fullmatch |
498
-
| public | mytable | .*node_id.* |
499
+
Then statement mytable_indexes returns exactly
500
+
| indexdef@substr |
501
+
| USINGgist (geom) |
499
502
500
503
Scenario: Don't create id index if the configuration doesn't says so
501
504
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -512,9 +515,9 @@ Feature: Index definitions in Lua file
512
515
})
513
516
"""
514
517
When running osm2pgsql flex
515
-
Then table pg_catalog.pg_indexes doesn't contain
516
-
| schemaname | tablename | indexname@fullmatch |
517
-
| public | mytable | .*node_id.* |
518
+
Then statement mytable_indexes returns exactly
519
+
| indexdef@substr |
520
+
| USINGgist (geom) |
518
521
519
522
Scenario: Always create id index if the configuration says so
520
523
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -531,16 +534,16 @@ Feature: Index definitions in Lua file
531
534
})
532
535
"""
533
536
When running osm2pgsql flex
534
-
Then table pg_catalog.pg_indexes contains
535
-
| schemaname | tablename | indexname@fullmatch |
536
-
| public | mytable | .*node_id.* |
537
+
Then statement mytable_indexes returns
538
+
| indexdef@substr |
539
+
| USINGbtree (node_id) |
537
540
538
541
Scenario: Create a unique id index when requested
539
542
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
0 commit comments