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-60Lines changed: 61 additions & 60 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,9 +251,9 @@ 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
258
@needs-pg-index-includes
252
259
Scenario: Include field must be a string or array
@@ -315,9 +322,9 @@ Feature: Index definitions in Lua file
315
322
})
316
323
"""
317
324
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 |
325
+
Then statement mytable_indexes returns
326
+
| indexdef@substr |
327
+
| USINGbtree (name) INCLUDE (tags) |
321
328
322
329
@needs-pg-index-includes
323
330
Scenario: Include field works with array
@@ -338,9 +345,9 @@ Feature: Index definitions in Lua file
338
345
})
339
346
"""
340
347
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 |
348
+
Then statement mytable_indexes returns
349
+
| indexdef@substr |
350
+
| USINGbtree (name) INCLUDE (tags) |
344
351
345
352
Scenario: Tablespace needs a string
346
353
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -383,9 +390,9 @@ Feature: Index definitions in Lua file
383
390
})
384
391
"""
385
392
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 |
393
+
Then statement mytable_indexes returns
394
+
| indexdef@substr |
395
+
| USINGbtree (name) |
389
396
390
397
Scenario: Unique needs a boolean
391
398
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -428,9 +435,9 @@ Feature: Index definitions in Lua file
428
435
})
429
436
"""
430
437
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 |
438
+
Then statement mytable_indexes returns
439
+
| indexdef@fullmatch |
440
+
| .*UNIQUE.*USINGbtree \(name\).* |
434
441
435
442
Scenario: Where condition needs a string
436
443
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -473,9 +480,9 @@ Feature: Index definitions in Lua file
473
480
})
474
481
"""
475
482
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\)\).* |
483
+
Then statement mytable_indexes returns
484
+
| indexdef@substr |
485
+
| USINGbtree (name) WHERE (name = lower(name)) |
479
486
480
487
481
488
Scenario: Don't create id index if the configuration doesn't mention it
@@ -493,9 +500,9 @@ Feature: Index definitions in Lua file
493
500
})
494
501
"""
495
502
When running osm2pgsql flex
496
-
Then table pg_catalog.pg_indexes doesn't contain
497
-
| schemaname | tablename | indexname@fullmatch |
498
-
| public | mytable | .*node_id.* |
503
+
Then statement mytable_indexes returns exactly
504
+
| indexdef@substr |
505
+
| USINGgist (geom) |
499
506
500
507
Scenario: Don't create id index if the configuration doesn't says so
501
508
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -512,9 +519,9 @@ Feature: Index definitions in Lua file
512
519
})
513
520
"""
514
521
When running osm2pgsql flex
515
-
Then table pg_catalog.pg_indexes doesn't contain
516
-
| schemaname | tablename | indexname@fullmatch |
517
-
| public | mytable | .*node_id.* |
522
+
Then statement mytable_indexes returns exactly
523
+
| indexdef@substr |
524
+
| USINGgist (geom) |
518
525
519
526
Scenario: Always create id index if the configuration says so
520
527
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
@@ -531,16 +538,16 @@ Feature: Index definitions in Lua file
531
538
})
532
539
"""
533
540
When running osm2pgsql flex
534
-
Then table pg_catalog.pg_indexes contains
535
-
| schemaname | tablename | indexname@fullmatch |
536
-
| public | mytable | .*node_id.* |
541
+
Then statement mytable_indexes returns
542
+
| indexdef@substr |
543
+
| USINGbtree (node_id) |
537
544
538
545
Scenario: Create a unique id index when requested
539
546
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
0 commit comments