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
+60-60Lines changed: 60 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
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' and tablename = 'mytable'
9
+
and indrelid = tablename::regclass
10
+
and indexrelid = indexname::regclass
11
+
"""
12
+
3
13
Scenario: Indexes field in table definition must be an array
4
14
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
5
15
And the lua style
@@ -36,9 +46,9 @@ Feature: Index definitions in Lua file
36
46
})
37
47
"""
38
48
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 |
49
+
Then statement mytable_indexes returns
50
+
| indexdef@substr |
51
+
| USINGgist (geom) |
42
52
43
53
Scenario: Empty indexes field in table definition gets you no index
44
54
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -56,8 +66,8 @@ Feature: Index definitions in Lua file
56
66
})
57
67
"""
58
68
When running osm2pgsql flex
59
-
Then SELECT schemaname, tablename FROM pg_catalog.pg_indexes WHERE tablename = 'mytable'
60
-
| schemaname | tablename |
69
+
Then statement mytable_indexes returns exactly
70
+
| indexdef |
61
71
62
72
Scenario: Explicitly setting an index column works
63
73
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -77,9 +87,9 @@ Feature: Index definitions in Lua file
77
87
})
78
88
"""
79
89
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 |
90
+
Then statement mytable_indexes returns
91
+
| indexdef@substr |
92
+
| USINGbtree (name) |
83
93
84
94
Scenario: Explicitly setting multiple indexes
85
95
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -101,15 +111,11 @@ Feature: Index definitions in Lua file
101
111
})
102
112
"""
103
113
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 |
114
+
Then statement mytable_indexes returns exactly
115
+
| indexdef@substr |
116
+
| USINGbtree (name) |
117
+
| USINGgist (geom) |
118
+
| USINGbtree (name, tags) |
113
119
114
120
Scenario: Method can not be missing
115
121
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -244,9 +250,9 @@ Feature: Index definitions in Lua file
244
250
})
245
251
"""
246
252
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 |
253
+
Then statement mytable_indexes returns
254
+
| indexdef@substr |
255
+
| USINGbtree (lower(name)) |
250
256
251
257
@needs-pg-index-includes
252
258
Scenario: Include field must be a string or array
@@ -315,9 +321,9 @@ Feature: Index definitions in Lua file
315
321
})
316
322
"""
317
323
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 |
324
+
Then statement mytable_indexes returns
325
+
| indexdef@substr |
326
+
| USINGbtree (name) INCLUDE (tags) |
321
327
322
328
@needs-pg-index-includes
323
329
Scenario: Include field works with array
@@ -338,9 +344,9 @@ Feature: Index definitions in Lua file
338
344
})
339
345
"""
340
346
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 |
347
+
Then statement mytable_indexes returns
348
+
| indexdef@substr |
349
+
| USINGbtree (name) INCLUDE (tags) |
344
350
345
351
Scenario: Tablespace needs a string
346
352
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -383,9 +389,9 @@ Feature: Index definitions in Lua file
383
389
})
384
390
"""
385
391
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 |
392
+
Then statement mytable_indexes returns
393
+
| indexdef@substr |
394
+
| USINGbtree (name) |
389
395
390
396
Scenario: Unique needs a boolean
391
397
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -428,9 +434,9 @@ Feature: Index definitions in Lua file
428
434
})
429
435
"""
430
436
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 |
437
+
Then statement mytable_indexes returns
438
+
| indexdef@fullmatch |
439
+
| .*UNIQUE.*USINGbtree \(name\).* |
434
440
435
441
Scenario: Where condition needs a string
436
442
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -473,9 +479,9 @@ Feature: Index definitions in Lua file
473
479
})
474
480
"""
475
481
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\)\).* |
482
+
Then statement mytable_indexes returns
483
+
| indexdef@substr |
484
+
| USINGbtree (name) WHERE (name = lower(name)) |
479
485
480
486
481
487
Scenario: Don't create id index if the configuration doesn't mention it
@@ -493,9 +499,9 @@ Feature: Index definitions in Lua file
493
499
})
494
500
"""
495
501
When running osm2pgsql flex
496
-
Then table pg_catalog.pg_indexes doesn't contain
497
-
| schemaname | tablename | indexname@fullmatch |
498
-
| public | mytable | .*node_id.* |
502
+
Then statement mytable_indexes returns exactly
503
+
| indexdef@substr |
504
+
| USINGgist (geom) |
499
505
500
506
Scenario: Don't create id index if the configuration doesn't says so
501
507
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -512,9 +518,9 @@ Feature: Index definitions in Lua file
512
518
})
513
519
"""
514
520
When running osm2pgsql flex
515
-
Then table pg_catalog.pg_indexes doesn't contain
516
-
| schemaname | tablename | indexname@fullmatch |
517
-
| public | mytable | .*node_id.* |
521
+
Then statement mytable_indexes returns exactly
522
+
| indexdef@substr |
523
+
| USINGgist (geom) |
518
524
519
525
Scenario: Always create id index if the configuration says so
520
526
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -531,16 +537,16 @@ Feature: Index definitions in Lua file
531
537
})
532
538
"""
533
539
When running osm2pgsql flex
534
-
Then table pg_catalog.pg_indexes contains
535
-
| schemaname | tablename | indexname@fullmatch |
536
-
| public | mytable | .*node_id.* |
540
+
Then statement mytable_indexes returns
541
+
| indexdef@substr |
542
+
| USINGbtree (node_id) |
537
543
538
544
Scenario: Create a unique id index when requested
539
545
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
0 commit comments