/ Check-in [f77609d4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge the word-fuzzer branch into trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f77609d44194ee8871b3fb281ea6b90a9182f69f
User & Date: drh 2011-04-01 20:47:27
Context
2011-04-01
20:54
Fix up the Makefile.in so that the configuration script works for "make test". check-in: 2e03830c user: drh tags: trunk
20:47
Merge the word-fuzzer branch into trunk. check-in: f77609d4 user: drh tags: trunk
20:28
Add additional test data and documentation to the fuzzer virtual table. Closed-Leaf check-in: a6a81d4f user: drh tags: word-fuzzer
19:14
Changes to wal tests so that they work with DEFAULT_AUTOVACUUM defined. check-in: b477852f user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

352
353
354
355
356
357
358

359
360
361
362
363
364
365
  $(TOP)/src/test_async.c \
  $(TOP)/src/test_backup.c \
  $(TOP)/src/test_btree.c \
  $(TOP)/src/test_config.c \
  $(TOP)/src/test_demovfs.c \
  $(TOP)/src/test_devsym.c \
  $(TOP)/src/test_func.c \

  $(TOP)/src/test_hexio.c \
  $(TOP)/src/test_init.c \
  $(TOP)/src/test_intarray.c \
  $(TOP)/src/test_journal.c \
  $(TOP)/src/test_malloc.c \
  $(TOP)/src/test_multiplex.c \
  $(TOP)/src/test_mutex.c \







>







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
  $(TOP)/src/test_async.c \
  $(TOP)/src/test_backup.c \
  $(TOP)/src/test_btree.c \
  $(TOP)/src/test_config.c \
  $(TOP)/src/test_demovfs.c \
  $(TOP)/src/test_devsym.c \
  $(TOP)/src/test_func.c \
  $(TOP)/src/test_fuzzer.c \
  $(TOP)/src/test_hexio.c \
  $(TOP)/src/test_init.c \
  $(TOP)/src/test_intarray.c \
  $(TOP)/src/test_journal.c \
  $(TOP)/src/test_malloc.c \
  $(TOP)/src/test_multiplex.c \
  $(TOP)/src/test_mutex.c \

Changes to main.mk.

233
234
235
236
237
238
239

240
241
242
243
244
245
246
  $(TOP)/src/test_async.c \
  $(TOP)/src/test_backup.c \
  $(TOP)/src/test_btree.c \
  $(TOP)/src/test_config.c \
  $(TOP)/src/test_demovfs.c \
  $(TOP)/src/test_devsym.c \
  $(TOP)/src/test_func.c \

  $(TOP)/src/test_hexio.c \
  $(TOP)/src/test_init.c \
  $(TOP)/src/test_intarray.c \
  $(TOP)/src/test_journal.c \
  $(TOP)/src/test_malloc.c \
  $(TOP)/src/test_multiplex.c \
  $(TOP)/src/test_mutex.c \







>







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
  $(TOP)/src/test_async.c \
  $(TOP)/src/test_backup.c \
  $(TOP)/src/test_btree.c \
  $(TOP)/src/test_config.c \
  $(TOP)/src/test_demovfs.c \
  $(TOP)/src/test_devsym.c \
  $(TOP)/src/test_func.c \
  $(TOP)/src/test_fuzzer.c \
  $(TOP)/src/test_hexio.c \
  $(TOP)/src/test_init.c \
  $(TOP)/src/test_intarray.c \
  $(TOP)/src/test_journal.c \
  $(TOP)/src/test_malloc.c \
  $(TOP)/src/test_multiplex.c \
  $(TOP)/src/test_mutex.c \

Changes to src/tclsqlite.c.

3578
3579
3580
3581
3582
3583
3584

3585
3586
3587
3588
3589
3590
3591
....
3616
3617
3618
3619
3620
3621
3622

3623
3624
3625
3626
3627
3628
3629
    extern int Sqlitetestvfs_Init(Tcl_Interp *);
    extern int SqlitetestStat_Init(Tcl_Interp*);
    extern int Sqlitetestrtree_Init(Tcl_Interp*);
    extern int Sqlitequota_Init(Tcl_Interp*);
    extern int Sqlitemultiplex_Init(Tcl_Interp*);
    extern int SqliteSuperlock_Init(Tcl_Interp*);
    extern int SqlitetestSyscall_Init(Tcl_Interp*);


#ifdef SQLITE_ENABLE_ZIPVFS
    extern int Zipvfs_Init(Tcl_Interp*);
    Zipvfs_Init(interp);
#endif

    Sqliteconfig_Init(interp);
................................................................................
    Sqlitetestvfs_Init(interp);
    SqlitetestStat_Init(interp);
    Sqlitetestrtree_Init(interp);
    Sqlitequota_Init(interp);
    Sqlitemultiplex_Init(interp);
    SqliteSuperlock_Init(interp);
    SqlitetestSyscall_Init(interp);


    Tcl_CreateObjCommand(interp,"load_testfixture_extensions",init_all_cmd,0,0);

#ifdef SQLITE_SSE
    Sqlitetestsse_Init(interp);
#endif
  }







>







 







>







3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
....
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
    extern int Sqlitetestvfs_Init(Tcl_Interp *);
    extern int SqlitetestStat_Init(Tcl_Interp*);
    extern int Sqlitetestrtree_Init(Tcl_Interp*);
    extern int Sqlitequota_Init(Tcl_Interp*);
    extern int Sqlitemultiplex_Init(Tcl_Interp*);
    extern int SqliteSuperlock_Init(Tcl_Interp*);
    extern int SqlitetestSyscall_Init(Tcl_Interp*);
    extern int Sqlitetestfuzzer_Init(Tcl_Interp*);

#ifdef SQLITE_ENABLE_ZIPVFS
    extern int Zipvfs_Init(Tcl_Interp*);
    Zipvfs_Init(interp);
#endif

    Sqliteconfig_Init(interp);
................................................................................
    Sqlitetestvfs_Init(interp);
    SqlitetestStat_Init(interp);
    Sqlitetestrtree_Init(interp);
    Sqlitequota_Init(interp);
    Sqlitemultiplex_Init(interp);
    SqliteSuperlock_Init(interp);
    SqlitetestSyscall_Init(interp);
    Sqlitetestfuzzer_Init(interp);

    Tcl_CreateObjCommand(interp,"load_testfixture_extensions",init_all_cmd,0,0);

#ifdef SQLITE_SSE
    Sqlitetestsse_Init(interp);
#endif
  }

Added src/test_fuzzer.c.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
/*
** 2011 March 24
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** Code for demonstartion virtual table that generates variations
** on an input word at increasing edit distances from the original.
**
** A fuzzer virtual table is created like this:
**
**     CREATE VIRTUAL TABLE temp.f USING fuzzer;
**
** The name of the new virtual table in the example above is "f".
** Note that all fuzzer virtual tables must be TEMP tables.  The
** "temp." prefix in front of the table name is required when the
** table is being created.  The "temp." prefix can be omitted when
** using the table as long as the name is unambiguous.
**
** Before being used, the fuzzer needs to be programmed by giving it
** character transformations and a cost associated with each transformation.
** Examples:
**
**    INSERT INTO f(cFrom,cTo,Cost) VALUES('','a',100);
**
** The above statement says that the cost of inserting a letter 'a' is
** 100.  (All costs are integers.  We recommend that costs be scaled so
** that the average cost is around 100.)
**
**    INSERT INTO f(cFrom,cTo,Cost) VALUES('b','',87);
**
** The above statement says that the cost of deleting a single letter
** 'b' is 87.
**
**    INSERT INTO f(cFrom,cTo,Cost) VALUES('o','oe',38);
**    INSERT INTO f(cFrom,cTo,Cost) VALUES('oe','o',40);
**
** This third example says that the cost of transforming the single
** letter "o" into the two-letter sequence "oe" is 38 and that the
** cost of transforming "oe" back into "o" is 40.
**
** After all the transformation costs have been set, the fuzzer table
** can be queried as follows:
**
**    SELECT word, distance FROM f
**     WHERE word MATCH 'abcdefg'
**       AND distance<200;
**
** This first query outputs the string "abcdefg" and all strings that
** can be derived from that string by appling the specified transformations.
** The strings are output together with their total transformation cost
** (called "distance") and appear in order of increasing cost.  No string
** is output more than once.  If there are multiple ways to transform the
** target string into the output string then the lowest cost transform is
** the one that is returned.  In the example, the search is limited to 
** strings with a total distance of less than 200.
**
** It is important to put some kind of a limit on the fuzzer output.  This
** can be either in the form of a LIMIT clause at the end of the query,
** or better, a "distance<NNN" constraint where NNN is some number.  The
** running time and memory requirement is exponential in the value of NNN 
** so you want to make sure that NNN is not too big.  A value of NNN that
** is about twice the average transformation cost seems to give good results.
**
** The fuzzer table can be useful for tasks such as spelling correction.
** Suppose there is a second table vocabulary(w) where the w column contains
** all correctly spelled words.   Let $word be a word you want to look up.
**
**   SELECT vocabulary.w FROM f, vocabulary
**    WHERE f.word MATCH $word
**      AND f.distance<=200
**      AND f.word=vocabulary.w
**    LIMIT 20
**
** The query above gives the 20 closest words to the $word being tested.
** (Note that for good performance, the vocubulary.w column should be
** indexed.)
**
** A similar query can be used to find all words in the dictionary that
** begin with some prefix $prefix:
**
**   SELECT vocabulary.w FROM f, vocabulary
**    WHERE f.word MATCH $prefix
**      AND f.distance<=200
**      AND vocabulary.w BETWEEN f.word AND (f.word || x'F7BFBFBF')
**    LIMIT 50
**
** This last query will show up to 50 words out of the vocabulary that
** match or nearly match the $prefix.
*/
#include "sqlite3.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>

#ifndef SQLITE_OMIT_VIRTUALTABLE

/*
** Forward declaration of objects used by this implementation
*/
typedef struct fuzzer_vtab fuzzer_vtab;
typedef struct fuzzer_cursor fuzzer_cursor;
typedef struct fuzzer_rule fuzzer_rule;
typedef struct fuzzer_seen fuzzer_seen;
typedef struct fuzzer_stem fuzzer_stem;

/*
** Type of the "cost" of an edit operation.  Might be changed to
** "float" or "double" or "sqlite3_int64" in the future.
*/
typedef int fuzzer_cost;


/*
** Each transformation rule is stored as an instance of this object.
** All rules are kept on a linked list sorted by rCost.
*/
struct fuzzer_rule {
  fuzzer_rule *pNext;        /* Next rule in order of increasing rCost */
  fuzzer_cost rCost;         /* Cost of this transformation */
  int nFrom, nTo;            /* Length of the zFrom and zTo strings */
  char *zFrom;               /* Transform from */
  char zTo[4];               /* Transform to (extra space appended) */
};

/*
** A stem object is used to generate variants.  It is also used to record
** previously generated outputs.
**
** Every stem is added to a hash table as it is output.  Generation of
** duplicate stems is suppressed.
**
** Active stems (those that might generate new outputs) are kepts on a linked
** list sorted by increasing cost.  The cost is the sum of rBaseCost and
** pRule->rCost.
*/
struct fuzzer_stem {
  char *zBasis;              /* Word being fuzzed */
  int nBasis;                /* Length of the zBasis string */
  const fuzzer_rule *pRule;  /* Current rule to apply */
  int n;                     /* Apply pRule at this character offset */
  fuzzer_cost rBaseCost;     /* Base cost of getting to zBasis */
  fuzzer_cost rCostX;        /* Precomputed rBaseCost + pRule->rCost */
  fuzzer_stem *pNext;        /* Next stem in rCost order */
  fuzzer_stem *pHash;        /* Next stem with same hash on zBasis */
};

/* 
** A fuzzer virtual-table object 
*/
struct fuzzer_vtab {
  sqlite3_vtab base;         /* Base class - must be first */
  char *zClassName;          /* Name of this class.  Default: "fuzzer" */
  fuzzer_rule *pRule;        /* All active rules in this fuzzer */
  fuzzer_rule *pNewRule;     /* New rules to add when last cursor expires */
  int nCursor;               /* Number of active cursors */
};

#define FUZZER_HASH  4001    /* Hash table size */
#define FUZZER_NQUEUE  20    /* Number of slots on the stem queue */

/* A fuzzer cursor object */
struct fuzzer_cursor {
  sqlite3_vtab_cursor base;  /* Base class - must be first */
  sqlite3_int64 iRowid;      /* The rowid of the current word */
  fuzzer_vtab *pVtab;        /* The virtual table this cursor belongs to */
  fuzzer_cost rLimit;        /* Maximum cost of any term */
  fuzzer_stem *pStem;        /* Stem with smallest rCostX */
  fuzzer_stem *pDone;        /* Stems already processed to completion */
  fuzzer_stem *aQueue[FUZZER_NQUEUE];  /* Queue of stems with higher rCostX */
  int mxQueue;               /* Largest used index in aQueue[] */
  char *zBuf;                /* Temporary use buffer */
  int nBuf;                  /* Bytes allocated for zBuf */
  int nStem;                 /* Number of stems allocated */
  fuzzer_rule nullRule;      /* Null rule used first */
  fuzzer_stem *apHash[FUZZER_HASH]; /* Hash of previously generated terms */
};

/* Methods for the fuzzer module */
static int fuzzerConnect(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVtab,
  char **pzErr
){
  fuzzer_vtab *pNew;
  int n;
  if( strcmp(argv[1],"temp")!=0 ){
    *pzErr = sqlite3_mprintf("%s virtual tables must be TEMP", argv[0]);
    return SQLITE_ERROR;
  }
  n = strlen(argv[0]) + 1;
  pNew = sqlite3_malloc( sizeof(*pNew) + n );
  if( pNew==0 ) return SQLITE_NOMEM;
  pNew->zClassName = (char*)&pNew[1];
  memcpy(pNew->zClassName, argv[0], n);
  sqlite3_declare_vtab(db, "CREATE TABLE x(word,distance,cFrom,cTo,cost)");
  memset(pNew, 0, sizeof(*pNew));
  *ppVtab = &pNew->base;
  return SQLITE_OK;
}
/* Note that for this virtual table, the xCreate and xConnect
** methods are identical. */

static int fuzzerDisconnect(sqlite3_vtab *pVtab){
  fuzzer_vtab *p = (fuzzer_vtab*)pVtab;
  assert( p->nCursor==0 );
  do{
    while( p->pRule ){
      fuzzer_rule *pRule = p->pRule;
      p->pRule = pRule->pNext;
      sqlite3_free(pRule);
    }
    p->pRule = p->pNewRule;
    p->pNewRule = 0;
  }while( p->pRule );
  sqlite3_free(p);
  return SQLITE_OK;
}
/* The xDisconnect and xDestroy methods are also the same */

/*
** The two input rule lists are both sorted in order of increasing
** cost.  Merge them together into a single list, sorted by cost, and
** return a pointer to the head of that list.
*/
static fuzzer_rule *fuzzerMergeRules(fuzzer_rule *pA, fuzzer_rule *pB){
  fuzzer_rule head;
  fuzzer_rule *pTail;

  pTail =  &head;
  while( pA && pB ){
    if( pA->rCost<=pB->rCost ){
      pTail->pNext = pA;
      pTail = pA;
      pA = pA->pNext;
    }else{
      pTail->pNext = pB;
      pTail = pB;
      pB = pB->pNext;
    }
  }
  if( pA==0 ){
    pTail->pNext = pB;
  }else{
    pTail->pNext = pA;
  }
  return head.pNext;
}


/*
** Open a new fuzzer cursor.
*/
static int fuzzerOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
  fuzzer_vtab *p = (fuzzer_vtab*)pVTab;
  fuzzer_cursor *pCur;
  pCur = sqlite3_malloc( sizeof(*pCur) );
  if( pCur==0 ) return SQLITE_NOMEM;
  memset(pCur, 0, sizeof(*pCur));
  pCur->pVtab = p;
  *ppCursor = &pCur->base;
  if( p->nCursor==0 && p->pNewRule ){
    unsigned int i;
    fuzzer_rule *pX;
    fuzzer_rule *a[15];
    for(i=0; i<sizeof(a)/sizeof(a[0]); i++) a[i] = 0;
    while( (pX = p->pNewRule)!=0 ){
      p->pNewRule = pX->pNext;
      pX->pNext = 0;
      for(i=0; a[i] && i<sizeof(a)/sizeof(a[0])-1; i++){
        pX = fuzzerMergeRules(a[i], pX);
        a[i] = 0;
      }
      a[i] = fuzzerMergeRules(a[i], pX);
    }
    for(pX=a[0], i=1; i<sizeof(a)/sizeof(a[0]); i++){
      pX = fuzzerMergeRules(a[i], pX);
    }
    p->pRule = fuzzerMergeRules(p->pRule, pX);
  }
  p->nCursor++;
  return SQLITE_OK;
}

/*
** Free all stems in a list.
*/
static void fuzzerClearStemList(fuzzer_stem *pStem){
  while( pStem ){
    fuzzer_stem *pNext = pStem->pNext;
    sqlite3_free(pStem);
    pStem = pNext;
  }
}

/*
** Free up all the memory allocated by a cursor.  Set it rLimit to 0
** to indicate that it is at EOF.
*/
static void fuzzerClearCursor(fuzzer_cursor *pCur, int clearHash){
  int i;
  fuzzerClearStemList(pCur->pStem);
  fuzzerClearStemList(pCur->pDone);
  for(i=0; i<FUZZER_NQUEUE; i++) fuzzerClearStemList(pCur->aQueue[i]);
  pCur->rLimit = (fuzzer_cost)0;
  if( clearHash && pCur->nStem ){
    pCur->mxQueue = 0;
    pCur->pStem = 0;
    pCur->pDone = 0;
    memset(pCur->aQueue, 0, sizeof(pCur->aQueue));
    memset(pCur->apHash, 0, sizeof(pCur->apHash));
  }
  pCur->nStem = 0;
}

/*
** Close a fuzzer cursor.
*/
static int fuzzerClose(sqlite3_vtab_cursor *cur){
  fuzzer_cursor *pCur = (fuzzer_cursor *)cur;
  fuzzerClearCursor(pCur, 0);
  sqlite3_free(pCur->zBuf);
  pCur->pVtab->nCursor--;
  sqlite3_free(pCur);
  return SQLITE_OK;
}

/*
** Compute the current output term for a fuzzer_stem.
*/
static int fuzzerRender(
  fuzzer_stem *pStem,   /* The stem to be rendered */
  char **pzBuf,         /* Write results into this buffer.  realloc if needed */
  int *pnBuf            /* Size of the buffer */
){
  const fuzzer_rule *pRule = pStem->pRule;
  int n;
  char *z;

  n = pStem->nBasis + pRule->nTo - pRule->nFrom;
  if( (*pnBuf)<n+1 ){
    (*pzBuf) = sqlite3_realloc((*pzBuf), n+100);
    if( (*pzBuf)==0 ) return SQLITE_NOMEM;
    (*pnBuf) = n+100;
  }
  n = pStem->n;
  z = *pzBuf;
  if( n<0 ){
    memcpy(z, pStem->zBasis, pStem->nBasis+1);
  }else{
    memcpy(z, pStem->zBasis, n);
    memcpy(&z[n], pRule->zTo, pRule->nTo);
    memcpy(&z[n+pRule->nTo], &pStem->zBasis[n+pRule->nFrom], 
           pStem->nBasis-n-pRule->nFrom+1);
  }
  return SQLITE_OK;
}

/*
** Compute a hash on zBasis.
*/
static unsigned int fuzzerHash(const char *z){
  unsigned int h = 0;
  while( *z ){ h = (h<<3) ^ (h>>29) ^ *(z++); }
  return h % FUZZER_HASH;
}

/*
** Current cost of a stem
*/
static fuzzer_cost fuzzerCost(fuzzer_stem *pStem){
  return pStem->rCostX = pStem->rBaseCost + pStem->pRule->rCost;
}

#if 0
/*
** Print a description of a fuzzer_stem on stderr.
*/
static void fuzzerStemPrint(
  const char *zPrefix,
  fuzzer_stem *pStem,
  const char *zSuffix
){
  if( pStem->n<0 ){
    fprintf(stderr, "%s[%s](%d)-->self%s",
       zPrefix,
       pStem->zBasis, pStem->rBaseCost,
       zSuffix
    );
  }else{
    char *zBuf = 0;
    int nBuf = 0;
    if( fuzzerRender(pStem, &zBuf, &nBuf)!=SQLITE_OK ) return;
    fprintf(stderr, "%s[%s](%d)-->{%s}(%d)%s",
      zPrefix,
      pStem->zBasis, pStem->rBaseCost, zBuf, pStem->,
      zSuffix
    );
    sqlite3_free(zBuf);
  }
}
#endif

/*
** Return 1 if the string to which the cursor is point has already
** been emitted.  Return 0 if not.  Return -1 on a memory allocation
** failures.
*/
static int fuzzerSeen(fuzzer_cursor *pCur, fuzzer_stem *pStem){
  unsigned int h;
  fuzzer_stem *pLookup;

  if( fuzzerRender(pStem, &pCur->zBuf, &pCur->nBuf)==SQLITE_NOMEM ){
    return -1;
  }
  h = fuzzerHash(pCur->zBuf);
  pLookup = pCur->apHash[h];
    while( pLookup && strcmp(pLookup->zBasis, pCur->zBuf)!=0 ){
    pLookup = pLookup->pHash;
  }
  return pLookup!=0;
}

/*
** Advance a fuzzer_stem to its next value.   Return 0 if there are
** no more values that can be generated by this fuzzer_stem.  Return
** -1 on a memory allocation failure.
*/
static int fuzzerAdvance(fuzzer_cursor *pCur, fuzzer_stem *pStem){
  const fuzzer_rule *pRule;
  while( (pRule = pStem->pRule)!=0 ){
    while( pStem->n < pStem->nBasis - pRule->nFrom ){
      pStem->n++;
      if( pRule->nFrom==0
       || memcmp(&pStem->zBasis[pStem->n], pRule->zFrom, pRule->nFrom)==0
      ){
        /* Found a rewrite case.  Make sure it is not a duplicate */
        int rc = fuzzerSeen(pCur, pStem);
        if( rc<0 ) return -1;
        if( rc==0 ){
          fuzzerCost(pStem);
          return 1;
        }
      }
    }
    pStem->n = -1;
    pStem->pRule = pRule->pNext;
    if( pStem->pRule && fuzzerCost(pStem)>pCur->rLimit ) pStem->pRule = 0;
  }
  return 0;
}

/*
** The two input stem lists are both sorted in order of increasing
** rCostX.  Merge them together into a single list, sorted by rCostX, and
** return a pointer to the head of that new list.
*/
static fuzzer_stem *fuzzerMergeStems(fuzzer_stem *pA, fuzzer_stem *pB){
  fuzzer_stem head;
  fuzzer_stem *pTail;

  pTail =  &head;
  while( pA && pB ){
    if( pA->rCostX<=pB->rCostX ){
      pTail->pNext = pA;
      pTail = pA;
      pA = pA->pNext;
    }else{
      pTail->pNext = pB;
      pTail = pB;
      pB = pB->pNext;
    }
  }
  if( pA==0 ){
    pTail->pNext = pB;
  }else{
    pTail->pNext = pA;
  }
  return head.pNext;
}

/*
** Load pCur->pStem with the lowest-cost stem.  Return a pointer
** to the lowest-cost stem.
*/
static fuzzer_stem *fuzzerLowestCostStem(fuzzer_cursor *pCur){
  fuzzer_stem *pBest, *pX;
  int iBest;
  int i;

  if( pCur->pStem==0 ){
    iBest = -1;
    pBest = 0;
    for(i=0; i<=pCur->mxQueue; i++){
      pX = pCur->aQueue[i];
      if( pX==0 ) continue;
      if( pBest==0 || pBest->rCostX>pX->rCostX ){
        pBest = pX;
        iBest = i;
      }
    } 
    if( pBest ){
      pCur->aQueue[iBest] = pBest->pNext;
      pBest->pNext = 0;
      pCur->pStem = pBest;
    }
  }
  return pCur->pStem;
}

/*
** Insert pNew into queue of pending stems.  Then find the stem
** with the lowest rCostX and move it into pCur->pStem.
** list.  The insert is done such the pNew is in the correct order
** according to fuzzer_stem.zBaseCost+fuzzer_stem.pRule->rCost.
*/
static fuzzer_stem *fuzzerInsert(fuzzer_cursor *pCur, fuzzer_stem *pNew){
  fuzzer_stem *pX;
  int i;

  /* If pCur->pStem exists and is greater than pNew, then make pNew
  ** the new pCur->pStem and insert the old pCur->pStem instead.
  */
  if( (pX = pCur->pStem)!=0 && pX->rCostX>pNew->rCostX ){
    pNew->pNext = 0;
    pCur->pStem = pNew;
    pNew = pX;
  }

  /* Insert the new value */
  pNew->pNext = 0;
  pX = pNew;
  for(i=0; i<=pCur->mxQueue; i++){
    if( pCur->aQueue[i] ){
      pX = fuzzerMergeStems(pX, pCur->aQueue[i]);
      pCur->aQueue[i] = 0;
    }else{
      pCur->aQueue[i] = pX;
      break;
    }
  }
  if( i>pCur->mxQueue ){
    if( i<FUZZER_NQUEUE ){
      pCur->mxQueue = i;
      pCur->aQueue[i] = pX;
    }else{
      assert( pCur->mxQueue==FUZZER_NQUEUE-1 );
      pX = fuzzerMergeStems(pX, pCur->aQueue[FUZZER_NQUEUE-1]);
      pCur->aQueue[FUZZER_NQUEUE-1] = pX;
    }
  }

  return fuzzerLowestCostStem(pCur);
}

/*
** Allocate a new fuzzer_stem.  Add it to the hash table but do not
** link it into either the pCur->pStem or pCur->pDone lists.
*/
static fuzzer_stem *fuzzerNewStem(
  fuzzer_cursor *pCur,
  const char *zWord,
  fuzzer_cost rBaseCost
){
  fuzzer_stem *pNew;
  unsigned int h;

  pNew = sqlite3_malloc( sizeof(*pNew) + strlen(zWord) + 1 );
  if( pNew==0 ) return 0;
  memset(pNew, 0, sizeof(*pNew));
  pNew->zBasis = (char*)&pNew[1];
  pNew->nBasis = strlen(zWord);
  memcpy(pNew->zBasis, zWord, pNew->nBasis+1);
  pNew->pRule = pCur->pVtab->pRule;
  pNew->n = -1;
  pNew->rBaseCost = pNew->rCostX = rBaseCost;
  h = fuzzerHash(pNew->zBasis);
  pNew->pHash = pCur->apHash[h];
  pCur->apHash[h] = pNew;
  pCur->nStem++;
  return pNew;
}


/*
** Advance a cursor to its next row of output
*/
static int fuzzerNext(sqlite3_vtab_cursor *cur){
  fuzzer_cursor *pCur = (fuzzer_cursor*)cur;
  int rc;
  fuzzer_stem *pStem, *pNew;

  pCur->iRowid++;

  /* Use the element the cursor is currently point to to create
  ** a new stem and insert the new stem into the priority queue.
  */
  pStem = pCur->pStem;
  if( pStem->rCostX>0 ){
    rc = fuzzerRender(pStem, &pCur->zBuf, &pCur->nBuf);
    if( rc==SQLITE_NOMEM ) return SQLITE_NOMEM;
    pNew = fuzzerNewStem(pCur, pCur->zBuf, pStem->rCostX);
    if( pNew ){
      if( fuzzerAdvance(pCur, pNew)==0 ){
        pNew->pNext = pCur->pDone;
        pCur->pDone = pNew;
      }else{
        if( fuzzerInsert(pCur, pNew)==pNew ){
          return SQLITE_OK;
        }
      }
    }else{
      return SQLITE_NOMEM;
    }
  }

  /* Adjust the priority queue so that the first element of the
  ** stem list is the next lowest cost word.
  */
  while( (pStem = pCur->pStem)!=0 ){
    if( fuzzerAdvance(pCur, pStem) ){
      pCur->pStem = 0;
      pStem = fuzzerInsert(pCur, pStem);
      if( (rc = fuzzerSeen(pCur, pStem))!=0 ){
        if( rc<0 ) return SQLITE_NOMEM;
        continue;
      }
      return SQLITE_OK;  /* New word found */
    }
    pCur->pStem = 0;
    pStem->pNext = pCur->pDone;
    pCur->pDone = pStem;
    if( fuzzerLowestCostStem(pCur) ){
      rc = fuzzerSeen(pCur, pCur->pStem);
      if( rc<0 ) return SQLITE_NOMEM;
      if( rc==0 ){
        return SQLITE_OK;
      }
    }
  }

  /* Reach this point only if queue has been exhausted and there is
  ** nothing left to be output. */
  pCur->rLimit = (fuzzer_cost)0;
  return SQLITE_OK;
}

/*
** Called to "rewind" a cursor back to the beginning so that
** it starts its output over again.  Always called at least once
** prior to any fuzzerColumn, fuzzerRowid, or fuzzerEof call.
*/
static int fuzzerFilter(
  sqlite3_vtab_cursor *pVtabCursor, 
  int idxNum, const char *idxStr,
  int argc, sqlite3_value **argv
){
  fuzzer_cursor *pCur = (fuzzer_cursor *)pVtabCursor;
  const char *zWord = 0;
  fuzzer_stem *pStem;

  fuzzerClearCursor(pCur, 1);
  pCur->rLimit = 2147483647;
  if( idxNum==1 ){
    zWord = (const char*)sqlite3_value_text(argv[0]);
  }else if( idxNum==2 ){
    pCur->rLimit = (fuzzer_cost)sqlite3_value_int(argv[0]);
  }else if( idxNum==3 ){
    zWord = (const char*)sqlite3_value_text(argv[0]);
    pCur->rLimit = (fuzzer_cost)sqlite3_value_int(argv[1]);
  }
  if( zWord==0 ) zWord = "";
  pCur->pStem = pStem = fuzzerNewStem(pCur, zWord, (fuzzer_cost)0);
  if( pStem==0 ) return SQLITE_NOMEM;
  pCur->nullRule.pNext = pCur->pVtab->pRule;
  pCur->nullRule.rCost = 0;
  pCur->nullRule.nFrom = 0;
  pCur->nullRule.nTo = 0;
  pCur->nullRule.zFrom = "";
  pStem->pRule = &pCur->nullRule;
  pStem->n = pStem->nBasis;
  pCur->iRowid = 1;
  return SQLITE_OK;
}

/*
** Only the word and distance columns have values.  All other columns
** return NULL
*/
static int fuzzerColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
  fuzzer_cursor *pCur = (fuzzer_cursor*)cur;
  if( i==0 ){
    /* the "word" column */
    if( fuzzerRender(pCur->pStem, &pCur->zBuf, &pCur->nBuf)==SQLITE_NOMEM ){
      return SQLITE_NOMEM;
    }
    sqlite3_result_text(ctx, pCur->zBuf, -1, SQLITE_TRANSIENT);
  }else if( i==1 ){
    /* the "distance" column */
    sqlite3_result_int(ctx, pCur->pStem->rCostX);
  }else{
    /* All other columns are NULL */
    sqlite3_result_null(ctx);
  }
  return SQLITE_OK;
}

/*
** The rowid.
*/
static int fuzzerRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
  fuzzer_cursor *pCur = (fuzzer_cursor*)cur;
  *pRowid = pCur->iRowid;
  return SQLITE_OK;
}

/*
** When the fuzzer_cursor.rLimit value is 0 or less, that is a signal
** that the cursor has nothing more to output.
*/
static int fuzzerEof(sqlite3_vtab_cursor *cur){
  fuzzer_cursor *pCur = (fuzzer_cursor*)cur;
  return pCur->rLimit<=(fuzzer_cost)0;
}

/*
** Search for terms of these forms:
**
**       word MATCH $str
**       distance < $value
**       distance <= $value
**
** The distance< and distance<= are both treated as distance<=.
** The query plan number is as follows:
**
**   0:    None of the terms above are found
**   1:    There is a "word MATCH" term with $str in filter.argv[0].
**   2:    There is a "distance<" term with $value in filter.argv[0].
**   3:    Both "word MATCH" and "distance<" with $str in argv[0] and
**         $value in argv[1].
*/
static int fuzzerBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
  int iPlan = 0;
  int iDistTerm = -1;
  int i;
  const struct sqlite3_index_constraint *pConstraint;
  pConstraint = pIdxInfo->aConstraint;
  for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
    if( pConstraint->usable==0 ) continue;
    if( (iPlan & 1)==0 
     && pConstraint->iColumn==0
     && pConstraint->op==SQLITE_INDEX_CONSTRAINT_MATCH
    ){
      iPlan |= 1;
      pIdxInfo->aConstraintUsage[i].argvIndex = 1;
      pIdxInfo->aConstraintUsage[i].omit = 1;
    }
    if( (iPlan & 2)==0
     && pConstraint->iColumn==1
     && (pConstraint->op==SQLITE_INDEX_CONSTRAINT_LT
           || pConstraint->op==SQLITE_INDEX_CONSTRAINT_LE)
    ){
      iPlan |= 2;
      iDistTerm = i;
    }
  }
  if( iPlan==2 ){
    pIdxInfo->aConstraintUsage[iDistTerm].argvIndex = 1;
  }else if( iPlan==3 ){
    pIdxInfo->aConstraintUsage[iDistTerm].argvIndex = 2;
  }
  pIdxInfo->idxNum = iPlan;
  if( pIdxInfo->nOrderBy==1
   && pIdxInfo->aOrderBy[0].iColumn==1
   && pIdxInfo->aOrderBy[0].desc==0
  ){
    pIdxInfo->orderByConsumed = 1;
  }
  pIdxInfo->estimatedCost = (double)10000;
   
  return SQLITE_OK;
}

/*
** Disallow all attempts to DELETE or UPDATE.  Only INSERTs are allowed.
**
** On an insert, the cFrom, cTo, and cost columns are used to construct
** a new rule.   All other columns are ignored.  The rule is ignored
** if cFrom and cTo are identical.  A NULL value for cFrom or cTo is
** interpreted as an empty string.  The cost must be positive.
*/
static int fuzzerUpdate(
  sqlite3_vtab *pVTab,
  int argc,
  sqlite3_value **argv,
  sqlite_int64 *pRowid
){
  fuzzer_vtab *p = (fuzzer_vtab*)pVTab;
  fuzzer_rule *pRule;
  const char *zFrom;
  int nFrom;
  const char *zTo;
  int nTo;
  fuzzer_cost rCost;
  if( argc!=7 ){
    sqlite3_free(pVTab->zErrMsg);
    pVTab->zErrMsg = sqlite3_mprintf("cannot delete from a %s virtual table",
                                     p->zClassName);
    return SQLITE_CONSTRAINT;
  }
  if( sqlite3_value_type(argv[0])!=SQLITE_NULL ){
    sqlite3_free(pVTab->zErrMsg);
    pVTab->zErrMsg = sqlite3_mprintf("cannot update a %s virtual table",
                                     p->zClassName);
    return SQLITE_CONSTRAINT;
  }
  zFrom = (char*)sqlite3_value_text(argv[4]);
  if( zFrom==0 ) zFrom = "";
  zTo = (char*)sqlite3_value_text(argv[5]);
  if( zTo==0 ) zTo = "";
  if( strcmp(zFrom,zTo)==0 ){
    /* Silently ignore null transformations */
    return SQLITE_OK;
  }
  rCost = sqlite3_value_int(argv[6]);
  if( rCost<=0 ){
    sqlite3_free(pVTab->zErrMsg);
    pVTab->zErrMsg = sqlite3_mprintf("cost must be positive");
    return SQLITE_CONSTRAINT;    
  }
  nFrom = strlen(zFrom);
  nTo = strlen(zTo);
  pRule = sqlite3_malloc( sizeof(*pRule) + nFrom + nTo );
  if( pRule==0 ){
    return SQLITE_NOMEM;
  }
  pRule->zFrom = &pRule->zTo[nTo+1];
  pRule->nFrom = nFrom;
  memcpy(pRule->zFrom, zFrom, nFrom+1);
  memcpy(pRule->zTo, zTo, nTo+1);
  pRule->nTo = nTo;
  pRule->rCost = rCost;
  pRule->pNext = p->pNewRule;
  p->pNewRule = pRule;
  return SQLITE_OK;
}

/*
** A virtual table module that provides read-only access to a
** Tcl global variable namespace.
*/
static sqlite3_module fuzzerModule = {
  0,                           /* iVersion */
  fuzzerConnect,
  fuzzerConnect,
  fuzzerBestIndex,
  fuzzerDisconnect, 
  fuzzerDisconnect,
  fuzzerOpen,                  /* xOpen - open a cursor */
  fuzzerClose,                 /* xClose - close a cursor */
  fuzzerFilter,                /* xFilter - configure scan constraints */
  fuzzerNext,                  /* xNext - advance a cursor */
  fuzzerEof,                   /* xEof - check for end of scan */
  fuzzerColumn,                /* xColumn - read data */
  fuzzerRowid,                 /* xRowid - read data */
  fuzzerUpdate,                /* xUpdate - INSERT */
  0,                           /* xBegin */
  0,                           /* xSync */
  0,                           /* xCommit */
  0,                           /* xRollback */
  0,                           /* xFindMethod */
  0,                           /* xRename */
};

#endif /* SQLITE_OMIT_VIRTUALTABLE */


/*
** Register the fuzzer virtual table
*/
int fuzzer_register(sqlite3 *db){
  int rc = SQLITE_OK;
#ifndef SQLITE_OMIT_VIRTUALTABLE
  rc = sqlite3_create_module(db, "fuzzer", &fuzzerModule, 0);
#endif
  return rc;
}

#ifdef SQLITE_TEST
#include <tcl.h>
/*
** Decode a pointer to an sqlite3 object.
*/
extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);

/*
** Register the echo virtual table module.
*/
static int register_fuzzer_module(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  sqlite3 *db;
  if( objc!=2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "DB");
    return TCL_ERROR;
  }
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  fuzzer_register(db);
  return TCL_OK;
}


/*
** Register commands with the TCL interpreter.
*/
int Sqlitetestfuzzer_Init(Tcl_Interp *interp){
  static struct {
     char *zName;
     Tcl_ObjCmdProc *xProc;
     void *clientData;
  } aObjCmd[] = {
     { "register_fuzzer_module",   register_fuzzer_module, 0 },
  };
  int i;
  for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
    Tcl_CreateObjCommand(interp, aObjCmd[i].zName, 
        aObjCmd[i].xProc, aObjCmd[i].clientData, 0);
  }
  return TCL_OK;
}

#endif /* SQLITE_TEST */

Added test/fuzzer1.test.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
# 2011 March 25
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for TCL interface to the
# SQLite library. 
#
# The focus of the tests is the word-fuzzer virtual table.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !vtab {
  finish_test
  return
}

register_fuzzer_module db
do_test fuzzer1-1.0 {
  catchsql {CREATE VIRTUAL TABLE fault1 USING fuzzer;}
} {1 {fuzzer virtual tables must be TEMP}}
do_test fuzzer1-1.1 {
  db eval {CREATE VIRTUAL TABLE temp.f1 USING fuzzer;}
} {}
do_test fuzzer1-1.2 {
  db eval {
    INSERT INTO f1(cfrom, cto, cost) VALUES('e','a',1);
    INSERT INTO f1(cfrom, cto, cost) VALUES('a','e',10);
    INSERT INTO f1(cfrom, cto, cost) VALUES('e','o',100);
  }
} {}

do_test fuzzer1-1.3 {
  db eval {
    SELECT word, distance FROM f1 WHERE word MATCH 'abcde'
  }
} {abcde 0 abcda 1 ebcde 10 ebcda 11 abcdo 100 ebcdo 110 obcde 110 obcda 111 obcdo 210}

do_test fuzzer1-2.0 {
  execsql {
    CREATE VIRTUAL TABLE temp.f2 USING fuzzer;
    -- costs based on English letter frequencies
    INSERT INTO f2(cFrom,cTo,cost) VALUES('a','e',24);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('a','o',47);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('a','u',50);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('e','a',23);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('e','i',33);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('e','o',37);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('i','e',33);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('i','y',33);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('o','a',41);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('o','e',46);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('o','u',57);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('u','o',58);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('y','i',33);

    INSERT INTO f2(cFrom,cTo,cost) VALUES('t','th',70);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('th','t',66);

 
    INSERT INTO f2(cFrom,cTo,cost) VALUES('a','',84);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','b',106);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('b','',106);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','c',94);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('c','',94);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','d',89);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('d','',89);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','e',83);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('e','',83);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','f',97);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('f','',97);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','g',99);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('g','',99);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','h',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('h','',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','i',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('i','',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','j',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('j','',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','k',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('k','',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','l',89);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('l','',89);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','m',96);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('m','',96);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','n',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('n','',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','o',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('o','',85);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','p',100);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('p','',100);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','q',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('q','',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','r',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('r','',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','s',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('s','',86);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','t',84);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('t','',84);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','u',94);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('u','',94);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','v',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('v','',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','w',96);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('w','',96);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','x',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('x','',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','y',100);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('y','',100);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('','z',120);
    INSERT INTO f2(cFrom,cTo,cost) VALUES('z','',120);

    -- Street names for the 28269 ZIPCODE.
    --
    CREATE TEMP TABLE streetname(n TEXT UNIQUE);
    INSERT INTO streetname VALUES('abbotsinch');
    INSERT INTO streetname VALUES('abbottsgate');
    INSERT INTO streetname VALUES('abbywood');
    INSERT INTO streetname VALUES('abner');
    INSERT INTO streetname VALUES('acacia ridge');
    INSERT INTO streetname VALUES('acorn creek');
    INSERT INTO streetname VALUES('acorn forest');
    INSERT INTO streetname VALUES('adel');
    INSERT INTO streetname VALUES('ainslie');
    INSERT INTO streetname VALUES('airways');
    INSERT INTO streetname VALUES('alabaster');
    INSERT INTO streetname VALUES('alba');
    INSERT INTO streetname VALUES('albertine');
    INSERT INTO streetname VALUES('alden glen');
    INSERT INTO streetname VALUES('alderson');
    INSERT INTO streetname VALUES('allen');
    INSERT INTO streetname VALUES('allen a brown');
    INSERT INTO streetname VALUES('allness glen');
    INSERT INTO streetname VALUES('aloysia');
    INSERT INTO streetname VALUES('alpine');
    INSERT INTO streetname VALUES('alwyn');
    INSERT INTO streetname VALUES('amaranthus');
    INSERT INTO streetname VALUES('amber glen');
    INSERT INTO streetname VALUES('amber leigh way');
    INSERT INTO streetname VALUES('amber meadows');
    INSERT INTO streetname VALUES('amberway');
    INSERT INTO streetname VALUES('ame');
    INSERT INTO streetname VALUES('amesbury hill');
    INSERT INTO streetname VALUES('anderson');
    INSERT INTO streetname VALUES('andrew thomas');
    INSERT INTO streetname VALUES('anduin falls');
    INSERT INTO streetname VALUES('ankeny');
    INSERT INTO streetname VALUES('annandale');
    INSERT INTO streetname VALUES('annbick');
    INSERT INTO streetname VALUES('antelope');
    INSERT INTO streetname VALUES('anzack');
    INSERT INTO streetname VALUES('apple glen');
    INSERT INTO streetname VALUES('applevalley');
    INSERT INTO streetname VALUES('appley mead');
    INSERT INTO streetname VALUES('aragorn');
    INSERT INTO streetname VALUES('arbor creek');
    INSERT INTO streetname VALUES('arbor day');
    INSERT INTO streetname VALUES('arbor meadows');
    INSERT INTO streetname VALUES('arbor spring');
    INSERT INTO streetname VALUES('arborview');
    INSERT INTO streetname VALUES('arklow');
    INSERT INTO streetname VALUES('armitage');
    INSERT INTO streetname VALUES('arvin');
    INSERT INTO streetname VALUES('ash cove');
    INSERT INTO streetname VALUES('ashford leigh');
    INSERT INTO streetname VALUES('ashmont');
    INSERT INTO streetname VALUES('atlas');
    INSERT INTO streetname VALUES('atwater');
    INSERT INTO streetname VALUES('auburn hill');
    INSERT INTO streetname VALUES('aulton link');
    INSERT INTO streetname VALUES('austin dekota');
    INSERT INTO streetname VALUES('austin knoll');
    INSERT INTO streetname VALUES('auten');
    INSERT INTO streetname VALUES('autumn harvest');
    INSERT INTO streetname VALUES('autumn oak');
    INSERT INTO streetname VALUES('autumn ridge');
    INSERT INTO streetname VALUES('avalon forest');
    INSERT INTO streetname VALUES('avalon loop');
    INSERT INTO streetname VALUES('avon farm');
    INSERT INTO streetname VALUES('avonhurst');
    INSERT INTO streetname VALUES('avonlea');
    INSERT INTO streetname VALUES('aynrand');
    INSERT INTO streetname VALUES('azure valley');
    INSERT INTO streetname VALUES('baberton');
    INSERT INTO streetname VALUES('baffin');
    INSERT INTO streetname VALUES('baggins');
    INSERT INTO streetname VALUES('balata');
    INSERT INTO streetname VALUES('ballantray');
    INSERT INTO streetname VALUES('ballston');
    INSERT INTO streetname VALUES('balsam tree');
    INSERT INTO streetname VALUES('bambi');
    INSERT INTO streetname VALUES('banwell');
    INSERT INTO streetname VALUES('barbee');
    INSERT INTO streetname VALUES('barefoot forest');
    INSERT INTO streetname VALUES('barnview');
    INSERT INTO streetname VALUES('baroda');
    INSERT INTO streetname VALUES('barson');
    INSERT INTO streetname VALUES('baskerville');
    INSERT INTO streetname VALUES('battle creek');
    INSERT INTO streetname VALUES('baucom');
    INSERT INTO streetname VALUES('bay pines');
    INSERT INTO streetname VALUES('beaker');
    INSERT INTO streetname VALUES('beard');
    INSERT INTO streetname VALUES('beardsley');
    INSERT INTO streetname VALUES('bearoak');
    INSERT INTO streetname VALUES('beauvista');
    INSERT INTO streetname VALUES('beaver creek');
    INSERT INTO streetname VALUES('beaver hollow');
    INSERT INTO streetname VALUES('bedlington');
    INSERT INTO streetname VALUES('beech cove');
    INSERT INTO streetname VALUES('beech crest');
    INSERT INTO streetname VALUES('beith');
    INSERT INTO streetname VALUES('bell glen');
    INSERT INTO streetname VALUES('bellmore');
    INSERT INTO streetname VALUES('bells mill');
    INSERT INTO streetname VALUES('bellville');
    INSERT INTO streetname VALUES('belmar place');
    INSERT INTO streetname VALUES('bembridge');
    INSERT INTO streetname VALUES('bennett neely');
    INSERT INTO streetname VALUES('bentgrass run');
    INSERT INTO streetname VALUES('benthaven');
    INSERT INTO streetname VALUES('bernardy');
    INSERT INTO streetname VALUES('bernbrook shadow');
    INSERT INTO streetname VALUES('berrybrook');
    INSERT INTO streetname VALUES('berrybush');
    INSERT INTO streetname VALUES('berwick');
    INSERT INTO streetname VALUES('betterton');
    INSERT INTO streetname VALUES('bickham');
    INSERT INTO streetname VALUES('billingham');
    INSERT INTO streetname VALUES('birchcroft');
    INSERT INTO streetname VALUES('birchstone');
    INSERT INTO streetname VALUES('birdwell');
    INSERT INTO streetname VALUES('bisaner');
    INSERT INTO streetname VALUES('bitterbush');
    INSERT INTO streetname VALUES('bitterroot');
    INSERT INTO streetname VALUES('black fox');
    INSERT INTO streetname VALUES('black maple');
    INSERT INTO streetname VALUES('black trail');
    INSERT INTO streetname VALUES('blackbird');
    INSERT INTO streetname VALUES('blake a dare');
    INSERT INTO streetname VALUES('blasdell');
    INSERT INTO streetname VALUES('blue aster');
    INSERT INTO streetname VALUES('blue finch');
    INSERT INTO streetname VALUES('blue lilac');
    INSERT INTO streetname VALUES('blue sky');
    INSERT INTO streetname VALUES('blue tick');
    INSERT INTO streetname VALUES('bob beatty');
    INSERT INTO streetname VALUES('bobcat');
    INSERT INTO streetname VALUES('bolton');
    INSERT INTO streetname VALUES('boomerang');
    INSERT INTO streetname VALUES('boulder');
    INSERT INTO streetname VALUES('boxer');
    INSERT INTO streetname VALUES('boxmeer');
    INSERT INTO streetname VALUES('brachnell view');
    INSERT INTO streetname VALUES('bradford lake');
    INSERT INTO streetname VALUES('bradwell');
    INSERT INTO streetname VALUES('brady');
    INSERT INTO streetname VALUES('braids bend');
    INSERT INTO streetname VALUES('bralers');
    INSERT INTO streetname VALUES('brandie glen');
    INSERT INTO streetname VALUES('brandy ridge');
    INSERT INTO streetname VALUES('brandybuck');
    INSERT INTO streetname VALUES('branthurst');
    INSERT INTO streetname VALUES('brassy creek');
    INSERT INTO streetname VALUES('brathay');
    INSERT INTO streetname VALUES('brawer farm');
    INSERT INTO streetname VALUES('breezy morn');
    INSERT INTO streetname VALUES('brenda');
    INSERT INTO streetname VALUES('brenly');
    INSERT INTO streetname VALUES('brenock');
    INSERT INTO streetname VALUES('brianwood');
    INSERT INTO streetname VALUES('briar rose');
    INSERT INTO streetname VALUES('briarcrest');
    INSERT INTO streetname VALUES('briarthorne');
    INSERT INTO streetname VALUES('brick dust');
    INSERT INTO streetname VALUES('bridgepath');
    INSERT INTO streetname VALUES('bridle ridge');
    INSERT INTO streetname VALUES('briggs');
    INSERT INTO streetname VALUES('brightleaf');
    INSERT INTO streetname VALUES('brigstock');
    INSERT INTO streetname VALUES('broad ridge');
    INSERT INTO streetname VALUES('brock');
    INSERT INTO streetname VALUES('brockhampton');
    INSERT INTO streetname VALUES('broken pine');
    INSERT INTO streetname VALUES('brompton');
    INSERT INTO streetname VALUES('brook falls');
    INSERT INTO streetname VALUES('brookings');
    INSERT INTO streetname VALUES('browne');
    INSERT INTO streetname VALUES('brownes creek');
    INSERT INTO streetname VALUES('brownes ferry');
    INSERT INTO streetname VALUES('brownestone view');
    INSERT INTO streetname VALUES('brumit');
    INSERT INTO streetname VALUES('bryn athyn');
    INSERT INTO streetname VALUES('buck');
    INSERT INTO streetname VALUES('bucklebury');
    INSERT INTO streetname VALUES('buckminister');
    INSERT INTO streetname VALUES('buckspring');
    INSERT INTO streetname VALUES('burch');
    INSERT INTO streetname VALUES('burch shire');
    INSERT INTO streetname VALUES('burkston');
    INSERT INTO streetname VALUES('burmith');
    INSERT INTO streetname VALUES('burnaby');
    INSERT INTO streetname VALUES('butterfly');
    INSERT INTO streetname VALUES('cabin creek');
    INSERT INTO streetname VALUES('cairns mill');
    INSERT INTO streetname VALUES('callender');
    INSERT INTO streetname VALUES('cambellton');
    INSERT INTO streetname VALUES('cambridge bay');
    INSERT INTO streetname VALUES('canary');
    INSERT INTO streetname VALUES('canbury');
    INSERT INTO streetname VALUES('candle leaf');
    INSERT INTO streetname VALUES('canipe');
    INSERT INTO streetname VALUES('canipe farm');
    INSERT INTO streetname VALUES('cannon');
    INSERT INTO streetname VALUES('canopy');
    INSERT INTO streetname VALUES('canso');
    INSERT INTO streetname VALUES('canterbrook');
    INSERT INTO streetname VALUES('cardinal glen');
    INSERT INTO streetname VALUES('cardinal point');
    INSERT INTO streetname VALUES('cardinals nest');
    INSERT INTO streetname VALUES('carlota');
    INSERT INTO streetname VALUES('carmathen');
    INSERT INTO streetname VALUES('carver');
    INSERT INTO streetname VALUES('carver pond');
    INSERT INTO streetname VALUES('casa loma');
    INSERT INTO streetname VALUES('caselton');
    INSERT INTO streetname VALUES('castello');
    INSERT INTO streetname VALUES('castle ridge');
    INSERT INTO streetname VALUES('castleglen');
    INSERT INTO streetname VALUES('castlemaine');
    INSERT INTO streetname VALUES('cavett');
    INSERT INTO streetname VALUES('caymus');
    INSERT INTO streetname VALUES('cedardale ridge');
    INSERT INTO streetname VALUES('cedarhurst');
    INSERT INTO streetname VALUES('cemkey way');
    INSERT INTO streetname VALUES('cerise');
    INSERT INTO streetname VALUES('chaceview');
    INSERT INTO streetname VALUES('chadsworth');
    INSERT INTO streetname VALUES('chadwell');
    INSERT INTO streetname VALUES('champions crest');
    INSERT INTO streetname VALUES('chandler haven');
    INSERT INTO streetname VALUES('chapel crossing');
    INSERT INTO streetname VALUES('chapel ridge');
    INSERT INTO streetname VALUES('charles crawford');
    INSERT INTO streetname VALUES('charminster');
    INSERT INTO streetname VALUES('chasewind');
    INSERT INTO streetname VALUES('chavel');
    INSERT INTO streetname VALUES('chelsea jade');
    INSERT INTO streetname VALUES('chestnut knoll');
    INSERT INTO streetname VALUES('cheviot');
    INSERT INTO streetname VALUES('chickadee');
    INSERT INTO streetname VALUES('chidley');
    INSERT INTO streetname VALUES('chimney ridge');
    INSERT INTO streetname VALUES('chimney springs');
    INSERT INTO streetname VALUES('chinaberry');
    INSERT INTO streetname VALUES('chinemist');
    INSERT INTO streetname VALUES('chinquapin');
    INSERT INTO streetname VALUES('chiswell');
    INSERT INTO streetname VALUES('christenbury');
    INSERT INTO streetname VALUES('christenbury hills');
    INSERT INTO streetname VALUES('churchill');
    INSERT INTO streetname VALUES('cindy');
    INSERT INTO streetname VALUES('cinnamon teal');
    INSERT INTO streetname VALUES('citadel');
    INSERT INTO streetname VALUES('clare olivia');
    INSERT INTO streetname VALUES('clarke creek');
    INSERT INTO streetname VALUES('clarke ridge');
    INSERT INTO streetname VALUES('clear day');
    INSERT INTO streetname VALUES('clear stream');
    INSERT INTO streetname VALUES('cleve brown');
    INSERT INTO streetname VALUES('cliff cameron');
    INSERT INTO streetname VALUES('cliffvale');
    INSERT INTO streetname VALUES('cloverside');
    INSERT INTO streetname VALUES('clymer');
    INSERT INTO streetname VALUES('coatbridge');
    INSERT INTO streetname VALUES('cobble glen');
    INSERT INTO streetname VALUES('cochran farm');
    INSERT INTO streetname VALUES('cochrane');
    INSERT INTO streetname VALUES('coleridge');
    INSERT INTO streetname VALUES('coleshire');
    INSERT INTO streetname VALUES('collins');
    INSERT INTO streetname VALUES('colvard');
    INSERT INTO streetname VALUES('colvard park');
    INSERT INTO streetname VALUES('condor');
    INSERT INTO streetname VALUES('conner ridge');
    INSERT INTO streetname VALUES('connery');
    INSERT INTO streetname VALUES('cooper run');
    INSERT INTO streetname VALUES('coopers ridge');
    INSERT INTO streetname VALUES('copper hill');
    INSERT INTO streetname VALUES('coppermine');
    INSERT INTO streetname VALUES('cornelia');
    INSERT INTO streetname VALUES('corner');
    INSERT INTO streetname VALUES('cornerstone');
    INSERT INTO streetname VALUES('cottage oaks');
    INSERT INTO streetname VALUES('cougar');
    INSERT INTO streetname VALUES('coves end');
    INSERT INTO streetname VALUES('cragland');
    INSERT INTO streetname VALUES('crail');
    INSERT INTO streetname VALUES('cranberry nook');
    INSERT INTO streetname VALUES('crawford brook');
    INSERT INTO streetname VALUES('crayton');
    INSERT INTO streetname VALUES('creek breeze');
    INSERT INTO streetname VALUES('crescent ridge');
    INSERT INTO streetname VALUES('crescent view');
    INSERT INTO streetname VALUES('cresta');
    INSERT INTO streetname VALUES('crestfield');
    INSERT INTO streetname VALUES('crestland');
    INSERT INTO streetname VALUES('crestwick');
    INSERT INTO streetname VALUES('crisfield');
    INSERT INTO streetname VALUES('crisp wood');
    INSERT INTO streetname VALUES('croft haven');
    INSERT INTO streetname VALUES('crofton springs');
    INSERT INTO streetname VALUES('cross');
    INSERT INTO streetname VALUES('crosspoint center');
    INSERT INTO streetname VALUES('crownvista');
    INSERT INTO streetname VALUES('crystal arms');
    INSERT INTO streetname VALUES('crystal crest');
    INSERT INTO streetname VALUES('crystal leaf');
    INSERT INTO streetname VALUES('cunningham park');
    INSERT INTO streetname VALUES('cypress pond');
    INSERT INTO streetname VALUES('daffodil');
    INSERT INTO streetname VALUES('daisyfield');
    INSERT INTO streetname VALUES('dalecrest');
    INSERT INTO streetname VALUES('dannelly park');
    INSERT INTO streetname VALUES('daphne');
    INSERT INTO streetname VALUES('daria');
    INSERT INTO streetname VALUES('dartmouth');
    INSERT INTO streetname VALUES('datha');
    INSERT INTO streetname VALUES('david cox');
    INSERT INTO streetname VALUES('davis');
    INSERT INTO streetname VALUES('davis crossing');
    INSERT INTO streetname VALUES('davis lake');
    INSERT INTO streetname VALUES('davis ridge');
    INSERT INTO streetname VALUES('dawnmist');
    INSERT INTO streetname VALUES('daybreak');
    INSERT INTO streetname VALUES('dearmon');
    INSERT INTO streetname VALUES('dearview');
    INSERT INTO streetname VALUES('deaton hill');
    INSERT INTO streetname VALUES('deer cross');
    INSERT INTO streetname VALUES('deerton');
    INSERT INTO streetname VALUES('degrasse');
    INSERT INTO streetname VALUES('delamere');
    INSERT INTO streetname VALUES('dellfield');
    INSERT INTO streetname VALUES('dellinger');
    INSERT INTO streetname VALUES('demington');
    INSERT INTO streetname VALUES('denmeade');
    INSERT INTO streetname VALUES('derita');
    INSERT INTO streetname VALUES('derita woods');
    INSERT INTO streetname VALUES('deruyter');
    INSERT INTO streetname VALUES('dervish');
    INSERT INTO streetname VALUES('devas');
    INSERT INTO streetname VALUES('devon croft');
    INSERT INTO streetname VALUES('devonbridge');
    INSERT INTO streetname VALUES('devongate');
    INSERT INTO streetname VALUES('devonhill');
    INSERT INTO streetname VALUES('dewmorn');
    INSERT INTO streetname VALUES('distribution center');
    INSERT INTO streetname VALUES('dominion crest');
    INSERT INTO streetname VALUES('dominion green');
    INSERT INTO streetname VALUES('dominion village');
    INSERT INTO streetname VALUES('dorshire');
    INSERT INTO streetname VALUES('double creek crossing');
    INSERT INTO streetname VALUES('dow');
    INSERT INTO streetname VALUES('downfield wood');
    INSERT INTO streetname VALUES('downing creek');
    INSERT INTO streetname VALUES('driscol');
    INSERT INTO streetname VALUES('driwood');
    INSERT INTO streetname VALUES('dry brook');
    INSERT INTO streetname VALUES('dumont');
    INSERT INTO streetname VALUES('dunblane');
    INSERT INTO streetname VALUES('dunfield');
    INSERT INTO streetname VALUES('dunoon');
    INSERT INTO streetname VALUES('dunslow');
    INSERT INTO streetname VALUES('dunstaff');
    INSERT INTO streetname VALUES('durham');
    INSERT INTO streetname VALUES('durston');
    INSERT INTO streetname VALUES('dusty cedar');
    INSERT INTO streetname VALUES('dusty trail');
    INSERT INTO streetname VALUES('dutchess');
    INSERT INTO streetname VALUES('duxford');
    INSERT INTO streetname VALUES('eagle creek');
    INSERT INTO streetname VALUES('eagles field');
    INSERT INTO streetname VALUES('eargle');
    INSERT INTO streetname VALUES('earlswood');
    INSERT INTO streetname VALUES('early mist');
    INSERT INTO streetname VALUES('earthenware');
    INSERT INTO streetname VALUES('eastfield park');
    INSERT INTO streetname VALUES('eastfield village');
    INSERT INTO streetname VALUES('easy');
    INSERT INTO streetname VALUES('eben');
    INSERT INTO streetname VALUES('edgepine');
    INSERT INTO streetname VALUES('edgewier');
    INSERT INTO streetname VALUES('edinburgh');
    INSERT INTO streetname VALUES('edinmeadow');
    INSERT INTO streetname VALUES('edmonton');
    INSERT INTO streetname VALUES('edwin jones');
    INSERT INTO streetname VALUES('elberon');
    INSERT INTO streetname VALUES('elderslie');
    INSERT INTO streetname VALUES('elementary view');
    INSERT INTO streetname VALUES('elendil');
    INSERT INTO streetname VALUES('elizabeth');
    INSERT INTO streetname VALUES('elm cove');
    INSERT INTO streetname VALUES('elrond');
    INSERT INTO streetname VALUES('elsenham');
    INSERT INTO streetname VALUES('elven');
    INSERT INTO streetname VALUES('emma lynn');
    INSERT INTO streetname VALUES('english setter');
    INSERT INTO streetname VALUES('enoch');
    INSERT INTO streetname VALUES('equipment');
    INSERT INTO streetname VALUES('ernest russell');
    INSERT INTO streetname VALUES('ernie');
    INSERT INTO streetname VALUES('esmeralda');
    INSERT INTO streetname VALUES('evergreen hollow');
    INSERT INTO streetname VALUES('eversfield');
    INSERT INTO streetname VALUES('ewen');
    INSERT INTO streetname VALUES('ewert cut');
    INSERT INTO streetname VALUES('exbury');
    INSERT INTO streetname VALUES('fair grounds park');
    INSERT INTO streetname VALUES('fairbourne');
    INSERT INTO streetname VALUES('fairchase');
    INSERT INTO streetname VALUES('faircreek');
    INSERT INTO streetname VALUES('fairglen');
    INSERT INTO streetname VALUES('fairlea');
    INSERT INTO streetname VALUES('fairmead');
    INSERT INTO streetname VALUES('fairmeadows');
    INSERT INTO streetname VALUES('fairstone');
    INSERT INTO streetname VALUES('fairvista');
    INSERT INTO streetname VALUES('fairway point');
    INSERT INTO streetname VALUES('falconcrest');
    INSERT INTO streetname VALUES('falls ridge');
    INSERT INTO streetname VALUES('falmouth');
    INSERT INTO streetname VALUES('far west');
    INSERT INTO streetname VALUES('farlow');
    INSERT INTO streetname VALUES('farris wheel');
    INSERT INTO streetname VALUES('fawndale');
    INSERT INTO streetname VALUES('feather bend');
    INSERT INTO streetname VALUES('fernledge');
    INSERT INTO streetname VALUES('fernmoss');
    INSERT INTO streetname VALUES('ferrell commons');
    INSERT INTO streetname VALUES('fieldstone');
    INSERT INTO streetname VALUES('fillian');
    INSERT INTO streetname VALUES('fincher');
    INSERT INTO streetname VALUES('foggy meadow');
    INSERT INTO streetname VALUES('fordyce');
    INSERT INTO streetname VALUES('forest grove');
    INSERT INTO streetname VALUES('forest path');
    INSERT INTO streetname VALUES('forestridge commons');
    INSERT INTO streetname VALUES('forestrock');
    INSERT INTO streetname VALUES('fortunes ridge');
    INSERT INTO streetname VALUES('founders club');
    INSERT INTO streetname VALUES('fountaingrass');
    INSERT INTO streetname VALUES('fox chase');
    INSERT INTO streetname VALUES('fox glen');
    INSERT INTO streetname VALUES('fox hill');
    INSERT INTO streetname VALUES('fox point');
    INSERT INTO streetname VALUES('fox trot');
    INSERT INTO streetname VALUES('foxbriar');
    INSERT INTO streetname VALUES('frank little');
    INSERT INTO streetname VALUES('franzia');
    INSERT INTO streetname VALUES('french woods');
    INSERT INTO streetname VALUES('frostmoor');
    INSERT INTO streetname VALUES('frye');
    INSERT INTO streetname VALUES('furlong');
    INSERT INTO streetname VALUES('galena view');
    INSERT INTO streetname VALUES('gallery pointe');
    INSERT INTO streetname VALUES('gammon');
    INSERT INTO streetname VALUES('garden grove');
    INSERT INTO streetname VALUES('gardendale');
    INSERT INTO streetname VALUES('garganey');
    INSERT INTO streetname VALUES('garnet field');
    INSERT INTO streetname VALUES('garrison');
    INSERT INTO streetname VALUES('garvin');
    INSERT INTO streetname VALUES('garvis');
    INSERT INTO streetname VALUES('gaskill');
    INSERT INTO streetname VALUES('gemstone');
    INSERT INTO streetname VALUES('gibbon');
    INSERT INTO streetname VALUES('gibbon terrace');
    INSERT INTO streetname VALUES('gibbons link');
    INSERT INTO streetname VALUES('gillman');
    INSERT INTO streetname VALUES('gladwood');
    INSERT INTO streetname VALUES('gladwyne');
    INSERT INTO streetname VALUES('glamorgan');
    INSERT INTO streetname VALUES('glaze');
    INSERT INTO streetname VALUES('glen brook');
    INSERT INTO streetname VALUES('glen cove');
    INSERT INTO streetname VALUES('glen hope');
    INSERT INTO streetname VALUES('glen manor');
    INSERT INTO streetname VALUES('glen olden');
    INSERT INTO streetname VALUES('glencairn');
    INSERT INTO streetname VALUES('glendock');
    INSERT INTO streetname VALUES('glenolden');
    INSERT INTO streetname VALUES('glenover');
    INSERT INTO streetname VALUES('glenshire');
    INSERT INTO streetname VALUES('glenstone');
    INSERT INTO streetname VALUES('gold dust');
    INSERT INTO streetname VALUES('golden pond');
    INSERT INTO streetname VALUES('goldenblush');
    INSERT INTO streetname VALUES('goldenfield');
    INSERT INTO streetname VALUES('goose landing');
    INSERT INTO streetname VALUES('gorham gate');
    INSERT INTO streetname VALUES('grabill');
    INSERT INTO streetname VALUES('graburns ford');
    INSERT INTO streetname VALUES('graham');
    INSERT INTO streetname VALUES('grahamson');
    INSERT INTO streetname VALUES('granard');
    INSERT INTO streetname VALUES('grand teton');
    INSERT INTO streetname VALUES('grande heights');
    INSERT INTO streetname VALUES('grandeur');
    INSERT INTO streetname VALUES('granite creek');
    INSERT INTO streetname VALUES('grasset');
    INSERT INTO streetname VALUES('graypark');
    INSERT INTO streetname VALUES('grays ridge');
    INSERT INTO streetname VALUES('great bear');
    INSERT INTO streetname VALUES('green clover');
    INSERT INTO streetname VALUES('green hedge');
    INSERT INTO streetname VALUES('green meadow');
    INSERT INTO streetname VALUES('green pasture');
    INSERT INTO streetname VALUES('greene');
    INSERT INTO streetname VALUES('greenloch');
    INSERT INTO streetname VALUES('greenock ridge');
    INSERT INTO streetname VALUES('greenware');
    INSERT INTO streetname VALUES('greenway village');
    INSERT INTO streetname VALUES('grenelefe village');
    INSERT INTO streetname VALUES('grey dogwood');
    INSERT INTO streetname VALUES('greyhound');
    INSERT INTO streetname VALUES('greylock ridge');
    INSERT INTO streetname VALUES('grosbeak');
    INSERT INTO streetname VALUES('grove');
    INSERT INTO streetname VALUES('groveton');
    INSERT INTO streetname VALUES('groveview');
    INSERT INTO streetname VALUES('hackberry creek');
    INSERT INTO streetname VALUES('hackberry grove');
    INSERT INTO streetname VALUES('hackett');
    INSERT INTO streetname VALUES('haddington');
    INSERT INTO streetname VALUES('hagler');
    INSERT INTO streetname VALUES('halcott');
    INSERT INTO streetname VALUES('half dome');
    INSERT INTO streetname VALUES('hallam');
    INSERT INTO streetname VALUES('hamilton russell');
    INSERT INTO streetname VALUES('hampton place');
    INSERT INTO streetname VALUES('hankins');
    INSERT INTO streetname VALUES('harburn forest');
    INSERT INTO streetname VALUES('harringham');
    INSERT INTO streetname VALUES('harrington woods');
    INSERT INTO streetname VALUES('harris corners');
    INSERT INTO streetname VALUES('harris cove');
    INSERT INTO streetname VALUES('harris glen');
    INSERT INTO streetname VALUES('harris hill');
    INSERT INTO streetname VALUES('harris oak');
    INSERT INTO streetname VALUES('harris pointe');
    INSERT INTO streetname VALUES('harris pond');
    INSERT INTO streetname VALUES('harris ridge');
    INSERT INTO streetname VALUES('harris technology');
    INSERT INTO streetname VALUES('harris woods');
    INSERT INTO streetname VALUES('hartfield downs');
    INSERT INTO streetname VALUES('hattie little');
    INSERT INTO streetname VALUES('hatwynn');
    INSERT INTO streetname VALUES('hawkins');
    INSERT INTO streetname VALUES('hawksnest');
    INSERT INTO streetname VALUES('haybridge');
    INSERT INTO streetname VALUES('hayden');
    INSERT INTO streetname VALUES('hazelcroft');
    INSERT INTO streetname VALUES('hazlitt');
    INSERT INTO streetname VALUES('hazy valley');
    INSERT INTO streetname VALUES('hearst');
    INSERT INTO streetname VALUES('heathcrest');
    INSERT INTO streetname VALUES('heathcroft');
    INSERT INTO streetname VALUES('hedge maple');
    INSERT INTO streetname VALUES('hedgecrest');
    INSERT INTO streetname VALUES('hedingham');
    INSERT INTO streetname VALUES('heman');
    INSERT INTO streetname VALUES('henderson');
    INSERT INTO streetname VALUES('henderson oaks');
    INSERT INTO streetname VALUES('henderson valley');
    INSERT INTO streetname VALUES('hendry');
    INSERT INTO streetname VALUES('heritage hills');
    INSERT INTO streetname VALUES('heritage woods');
    INSERT INTO streetname VALUES('heron cove');
    INSERT INTO streetname VALUES('heron glen');
    INSERT INTO streetname VALUES('hewitt');
    INSERT INTO streetname VALUES('hey rock');
    INSERT INTO streetname VALUES('heysham');
    INSERT INTO streetname VALUES('hickory cove');
    INSERT INTO streetname VALUES('hidden meadow');
    INSERT INTO streetname VALUES('high glen');
    INSERT INTO streetname VALUES('high laurel');
    INSERT INTO streetname VALUES('high valley');
    INSERT INTO streetname VALUES('highcroft');
    INSERT INTO streetname VALUES('highland');
    INSERT INTO streetname VALUES('highland commons');
    INSERT INTO streetname VALUES('highland creek');
    INSERT INTO streetname VALUES('highland glen');
    INSERT INTO streetname VALUES('highland park');
    INSERT INTO streetname VALUES('highlander');
    INSERT INTO streetname VALUES('highstream');
    INSERT INTO streetname VALUES('hilltop');
    INSERT INTO streetname VALUES('hobbitshire');
    INSERT INTO streetname VALUES('hoffman');
    INSERT INTO streetname VALUES('hogans way');
    INSERT INTO streetname VALUES('holbert');
    INSERT INTO streetname VALUES('hollow ridge');
    INSERT INTO streetname VALUES('holly vista');
    INSERT INTO streetname VALUES('hollywood');
    INSERT INTO streetname VALUES('hoover');
    INSERT INTO streetname VALUES('hopkins');
    INSERT INTO streetname VALUES('horace mann');
    INSERT INTO streetname VALUES('hornbeam');
    INSERT INTO streetname VALUES('horse pasture');
    INSERT INTO streetname VALUES('hosta');
    INSERT INTO streetname VALUES('howard');
    INSERT INTO streetname VALUES('hubbard');
    INSERT INTO streetname VALUES('hubbard falls');
    INSERT INTO streetname VALUES('hubbard woods');
    INSERT INTO streetname VALUES('hucks');
    INSERT INTO streetname VALUES('hunters creek');
    INSERT INTO streetname VALUES('hunters pointe');
    INSERT INTO streetname VALUES('hunters spring');
    INSERT INTO streetname VALUES('hunters whip');
    INSERT INTO streetname VALUES('huntmeadow');
    INSERT INTO streetname VALUES('hutchison mcdonald');
    INSERT INTO streetname VALUES('ingleton');
    INSERT INTO streetname VALUES('insdale');
    INSERT INTO streetname VALUES('interstate 85 service');
    INSERT INTO streetname VALUES('iola');
    INSERT INTO streetname VALUES('iredell');
    INSERT INTO streetname VALUES('iron brigade');
    INSERT INTO streetname VALUES('irwin valley');
    INSERT INTO streetname VALUES('irwin wood');
    INSERT INTO streetname VALUES('ivy brook');
    INSERT INTO streetname VALUES('ivy ridge');
    INSERT INTO streetname VALUES('jack russell');
    INSERT INTO streetname VALUES('jackson');
    INSERT INTO streetname VALUES('jacob martin');
    INSERT INTO streetname VALUES('jamison');
    INSERT INTO streetname VALUES('jane');
    INSERT INTO streetname VALUES('jaspar crest');
    INSERT INTO streetname VALUES('jessica');
    INSERT INTO streetname VALUES('jimmy oehler');
    INSERT INTO streetname VALUES('jocelyn');
    INSERT INTO streetname VALUES('johnston mill');
    INSERT INTO streetname VALUES('johnston oehler');
    INSERT INTO streetname VALUES('judal');
    INSERT INTO streetname VALUES('junipeous');
    INSERT INTO streetname VALUES('juniper');
    INSERT INTO streetname VALUES('juniperus');
    INSERT INTO streetname VALUES('kalispell');
    INSERT INTO streetname VALUES('karylsturn');
    INSERT INTO streetname VALUES('katelyn');
    INSERT INTO streetname VALUES('kayron');
    INSERT INTO streetname VALUES('keaton');
    INSERT INTO streetname VALUES('keble');
    INSERT INTO streetname VALUES('keels');
    INSERT INTO streetname VALUES('keith');
    INSERT INTO streetname VALUES('keithwood');
    INSERT INTO streetname VALUES('kelden walker');
    INSERT INTO streetname VALUES('kelsey emma');
    INSERT INTO streetname VALUES('kendrick');
    INSERT INTO streetname VALUES('kenmont');
    INSERT INTO streetname VALUES('kennerly cove');
    INSERT INTO streetname VALUES('kenninghall');
    INSERT INTO streetname VALUES('kent village');
    INSERT INTO streetname VALUES('kestral ridge');
    INSERT INTO streetname VALUES('kestrel');
    INSERT INTO streetname VALUES('kilmartin');
    INSERT INTO streetname VALUES('kilty');
    INSERT INTO streetname VALUES('kinglet');
    INSERT INTO streetname VALUES('kingsland');
    INSERT INTO streetname VALUES('kingsnorth');
    INSERT INTO streetname VALUES('kinsmore');
    INSERT INTO streetname VALUES('kirkgard');
    INSERT INTO streetname VALUES('kirkmont');
    INSERT INTO streetname VALUES('knightsgate');
    INSERT INTO streetname VALUES('kobuk');
    INSERT INTO streetname VALUES('kotlik');
    INSERT INTO streetname VALUES('kotz');
    INSERT INTO streetname VALUES('kyndall walk');
    INSERT INTO streetname VALUES('laborde');
    INSERT INTO streetname VALUES('lady bank');
    INSERT INTO streetname VALUES('lagrande');
    INSERT INTO streetname VALUES('lake');
    INSERT INTO streetname VALUES('lakeridge commons');
    INSERT INTO streetname VALUES('lakeview');
    INSERT INTO streetname VALUES('lakewood edge');
    INSERT INTO streetname VALUES('lakota');
    INSERT INTO streetname VALUES('lambrook');
    INSERT INTO streetname VALUES('lampkin');
    INSERT INTO streetname VALUES('lampkin park');
    INSERT INTO streetname VALUES('langham');
    INSERT INTO streetname VALUES('lanzerac manor');
    INSERT INTO streetname VALUES('larkmead forest');
    INSERT INTO streetname VALUES('lattice');
    INSERT INTO streetname VALUES('laurel crest');
    INSERT INTO streetname VALUES('laurel ridge');
    INSERT INTO streetname VALUES('laurel run');
    INSERT INTO streetname VALUES('laurenfield');
    INSERT INTO streetname VALUES('laveta');
    INSERT INTO streetname VALUES('lazy day');
    INSERT INTO streetname VALUES('leawood run');
    INSERT INTO streetname VALUES('lee marie');
    INSERT INTO streetname VALUES('legacy lake');
    INSERT INTO streetname VALUES('legacy park');
    INSERT INTO streetname VALUES('legato');
    INSERT INTO streetname VALUES('legolas');
    INSERT INTO streetname VALUES('leigh glen');
    INSERT INTO streetname VALUES('lence');
    INSERT INTO streetname VALUES('lenox hill');
    INSERT INTO streetname VALUES('leonine');
    INSERT INTO streetname VALUES('leslie');
    INSERT INTO streetname VALUES('lester hill');
    INSERT INTO streetname VALUES('levisey');
    INSERT INTO streetname VALUES('liberty bell');
    INSERT INTO streetname VALUES('linden berry');
    INSERT INTO streetname VALUES('lisbon');
    INSERT INTO streetname VALUES('little stoney');
    INSERT INTO streetname VALUES('livengood');
    INSERT INTO streetname VALUES('lochway');
    INSERT INTO streetname VALUES('lockman');
    INSERT INTO streetname VALUES('loganville');
    INSERT INTO streetname VALUES('lone tree');
    INSERT INTO streetname VALUES('long creek park');
    INSERT INTO streetname VALUES('long forest');
    INSERT INTO streetname VALUES('looking glass');
    INSERT INTO streetname VALUES('lookout point');
    INSERT INTO streetname VALUES('lowen');
    INSERT INTO streetname VALUES('lusby');
    INSERT INTO streetname VALUES('lyleton');
    INSERT INTO streetname VALUES('lynn lee');
    INSERT INTO streetname VALUES('lynnewood glen');
    INSERT INTO streetname VALUES('machrie');
    INSERT INTO streetname VALUES('mackinac');
    INSERT INTO streetname VALUES('maddox');
    INSERT INTO streetname VALUES('madison park');
    INSERT INTO streetname VALUES('mallard');
    INSERT INTO streetname VALUES('mallard cove');
    INSERT INTO streetname VALUES('mallard forest');
    INSERT INTO streetname VALUES('mallard grove');
    INSERT INTO streetname VALUES('mallard hill');
    INSERT INTO streetname VALUES('mallard park');
    INSERT INTO streetname VALUES('mallard ridge');
    INSERT INTO streetname VALUES('mallard view');
    INSERT INTO streetname VALUES('manbey');
    INSERT INTO streetname VALUES('manning');
    INSERT INTO streetname VALUES('mantario');
    INSERT INTO streetname VALUES('maple');
    INSERT INTO streetname VALUES('maple cove');
    INSERT INTO streetname VALUES('maple park');
    INSERT INTO streetname VALUES('marathon hill');
    INSERT INTO streetname VALUES('marbury');
    INSERT INTO streetname VALUES('marett');
    INSERT INTO streetname VALUES('marigold');
    INSERT INTO streetname VALUES('marionwood');
    INSERT INTO streetname VALUES('marshbank');
    INSERT INTO streetname VALUES('mason');
    INSERT INTO streetname VALUES('mayapple');
    INSERT INTO streetname VALUES('maylandia');
    INSERT INTO streetname VALUES('mayspring');
    INSERT INTO streetname VALUES('mcadam');
    INSERT INTO streetname VALUES('mcchesney');
    INSERT INTO streetname VALUES('mccurdy');
    INSERT INTO streetname VALUES('mcgrath');
    INSERT INTO streetname VALUES('mckendree');
    INSERT INTO streetname VALUES('mclaughlin');
    INSERT INTO streetname VALUES('mctaggart');
    INSERT INTO streetname VALUES('meadow green');
    INSERT INTO streetname VALUES('meadow knoll');
    INSERT INTO streetname VALUES('meadow post');
    INSERT INTO streetname VALUES('meadowmont');
    INSERT INTO streetname VALUES('meadowmont view');
    INSERT INTO streetname VALUES('meadowview hills');
    INSERT INTO streetname VALUES('melshire');
    INSERT INTO streetname VALUES('melstrand');
    INSERT INTO streetname VALUES('mentone');
    INSERT INTO streetname VALUES('meridale crossing');
    INSERT INTO streetname VALUES('merion hills');
    INSERT INTO streetname VALUES('merlot');
    INSERT INTO streetname VALUES('mersham');
    INSERT INTO streetname VALUES('metromont');
    INSERT INTO streetname VALUES('metromont industrial');
    INSERT INTO streetname VALUES('michaw');
    INSERT INTO streetname VALUES('milhaven');
    INSERT INTO streetname VALUES('milhof');
    INSERT INTO streetname VALUES('millstream ridge');
    INSERT INTO streetname VALUES('mineral ridge');
    INSERT INTO streetname VALUES('mint thistle');
    INSERT INTO streetname VALUES('mintleaf');
    INSERT INTO streetname VALUES('mintvale');
    INSERT INTO streetname VALUES('misty');
    INSERT INTO streetname VALUES('misty arbor');
    INSERT INTO streetname VALUES('misty creek');
    INSERT INTO streetname VALUES('misty oaks');
    INSERT INTO streetname VALUES('misty wood');
    INSERT INTO streetname VALUES('mitzi deborah');
    INSERT INTO streetname VALUES('mobile');
    INSERT INTO streetname VALUES('molly elizabeth');
    INSERT INTO streetname VALUES('monmouth');
    INSERT INTO streetname VALUES('montrose');
    INSERT INTO streetname VALUES('moonlight');
    INSERT INTO streetname VALUES('moose');
    INSERT INTO streetname VALUES('morning dew');
    INSERT INTO streetname VALUES('morningsong');
    INSERT INTO streetname VALUES('morningview');
    INSERT INTO streetname VALUES('morsey');
    INSERT INTO streetname VALUES('moss glen');
    INSERT INTO streetname VALUES('mossy bank');
    INSERT INTO streetname VALUES('motor sport');
    INSERT INTO streetname VALUES('mountain laurel');
    INSERT INTO streetname VALUES('mourning dove');
    INSERT INTO streetname VALUES('mozart');
    INSERT INTO streetname VALUES('munsing');
    INSERT INTO streetname VALUES('murray');
    INSERT INTO streetname VALUES('nathan');
    INSERT INTO streetname VALUES('netherhall');
    INSERT INTO streetname VALUES('netherton');
    INSERT INTO streetname VALUES('neuhoff');
    INSERT INTO streetname VALUES('nevin');
    INSERT INTO streetname VALUES('nevin brook');
    INSERT INTO streetname VALUES('nevin glen');
    INSERT INTO streetname VALUES('nevin place');
    INSERT INTO streetname VALUES('new england');
    INSERT INTO streetname VALUES('new house');
    INSERT INTO streetname VALUES('newbary');
    INSERT INTO streetname VALUES('newchurch');
    INSERT INTO streetname VALUES('newfane');
    INSERT INTO streetname VALUES('newgard');
    INSERT INTO streetname VALUES('nicholas');
    INSERT INTO streetname VALUES('nicole');
    INSERT INTO streetname VALUES('nobility');
    INSERT INTO streetname VALUES('norcroft');
    INSERT INTO streetname VALUES('northridge');
    INSERT INTO streetname VALUES('northside');
    INSERT INTO streetname VALUES('northwoods business');
    INSERT INTO streetname VALUES('norway');
    INSERT INTO streetname VALUES('nottinghill');
    INSERT INTO streetname VALUES('numenore');
    INSERT INTO streetname VALUES('nyewood');
    INSERT INTO streetname VALUES('oak');
    INSERT INTO streetname VALUES('oak cove');
    INSERT INTO streetname VALUES('oak pasture');
    INSERT INTO streetname VALUES('oakburn');
    INSERT INTO streetname VALUES('oakwinds');
    INSERT INTO streetname VALUES('oakwood');
    INSERT INTO streetname VALUES('obrien');
    INSERT INTO streetname VALUES('ocala');
    INSERT INTO streetname VALUES('old bridge');
    INSERT INTO streetname VALUES('old fox');
    INSERT INTO streetname VALUES('old potters');
    INSERT INTO streetname VALUES('old statesville');
    INSERT INTO streetname VALUES('old steine');
    INSERT INTO streetname VALUES('old stoney creek');
    INSERT INTO streetname VALUES('old sugar creek');
    INSERT INTO streetname VALUES('old timber');
    INSERT INTO streetname VALUES('old wagon');
    INSERT INTO streetname VALUES('old willow');
    INSERT INTO streetname VALUES('oldenway');
    INSERT INTO streetname VALUES('oneida');
    INSERT INTO streetname VALUES('ontario');
    INSERT INTO streetname VALUES('oriole');
    INSERT INTO streetname VALUES('orofino');
    INSERT INTO streetname VALUES('orr');
    INSERT INTO streetname VALUES('osage');
    INSERT INTO streetname VALUES('osceola');
    INSERT INTO streetname VALUES('osprey knoll');
    INSERT INTO streetname VALUES('oxford hill');
    INSERT INTO streetname VALUES('painted fern');
    INSERT INTO streetname VALUES('painted pony');
    INSERT INTO streetname VALUES('paisley');
    INSERT INTO streetname VALUES('pale moss');
    INSERT INTO streetname VALUES('palladium');
    INSERT INTO streetname VALUES('palmutum');
    INSERT INTO streetname VALUES('palustris');
    INSERT INTO streetname VALUES('panglemont');
    INSERT INTO streetname VALUES('panther');
    INSERT INTO streetname VALUES('panthersville');
    INSERT INTO streetname VALUES('paper whites');
    INSERT INTO streetname VALUES('park');
    INSERT INTO streetname VALUES('parker green');
    INSERT INTO streetname VALUES('parkhouse');
    INSERT INTO streetname VALUES('passour ridge');
    INSERT INTO streetname VALUES('pasture view');
    INSERT INTO streetname VALUES('patricia ann');
    INSERT INTO streetname VALUES('patton');
    INSERT INTO streetname VALUES('patton ridge');
    INSERT INTO streetname VALUES('pawpaw');
    INSERT INTO streetname VALUES('peach');
    INSERT INTO streetname VALUES('peakwood');
    INSERT INTO streetname VALUES('pebble creek');
    INSERT INTO streetname VALUES('pecan cove');
    INSERT INTO streetname VALUES('pedigree');
    INSERT INTO streetname VALUES('pelorus');
    INSERT INTO streetname VALUES('penmore');
    INSERT INTO streetname VALUES('pensfold');
    INSERT INTO streetname VALUES('pepperstone');
    INSERT INTO streetname VALUES('peregrine');
    INSERT INTO streetname VALUES('periwinkle');
    INSERT INTO streetname VALUES('perkins');
    INSERT INTO streetname VALUES('pete brown');
    INSERT INTO streetname VALUES('phillips');
    INSERT INTO streetname VALUES('pickway');
    INSERT INTO streetname VALUES('piercy woods');
    INSERT INTO streetname VALUES('pierpoint');
    INSERT INTO streetname VALUES('pine');
    INSERT INTO streetname VALUES('pine branch');
    INSERT INTO streetname VALUES('pine meadow');
    INSERT INTO streetname VALUES('pineleaf');
    INSERT INTO streetname VALUES('pinewood');
    INSERT INTO streetname VALUES('pintail');
    INSERT INTO streetname VALUES('pipestone');
    INSERT INTO streetname VALUES('placer maple');
    INSERT INTO streetname VALUES('plover');
    INSERT INTO streetname VALUES('plum');
    INSERT INTO streetname VALUES('po box');
    INSERT INTO streetname VALUES('pochard');
    INSERT INTO streetname VALUES('pointview');
    INSERT INTO streetname VALUES('polk and white');
    INSERT INTO streetname VALUES('pond valley');
    INSERT INTO streetname VALUES('pondridge');
    INSERT INTO streetname VALUES('pope farm');
    INSERT INTO streetname VALUES('poplar grove');
    INSERT INTO streetname VALUES('poplar springs');
    INSERT INTO streetname VALUES('portola');
    INSERT INTO streetname VALUES('potters glen');
    INSERT INTO streetname VALUES('powatan');
    INSERT INTO streetname VALUES('prairie valley');
    INSERT INTO streetname VALUES('prescott');
    INSERT INTO streetname VALUES('presmann');
    INSERT INTO streetname VALUES('prestigious');
    INSERT INTO streetname VALUES('princess');
    INSERT INTO streetname VALUES('prosperity');
    INSERT INTO streetname VALUES('prosperity church');
    INSERT INTO streetname VALUES('prosperity commons');
    INSERT INTO streetname VALUES('prosperity park');
    INSERT INTO streetname VALUES('prosperity point');
    INSERT INTO streetname VALUES('prosperity ridge');
    INSERT INTO streetname VALUES('prosperity view');
    INSERT INTO streetname VALUES('purple finch');
    INSERT INTO streetname VALUES('quail');
    INSERT INTO streetname VALUES('queensbury');
    INSERT INTO streetname VALUES('quinn');
    INSERT INTO streetname VALUES('racine');
    INSERT INTO streetname VALUES('radbourne');
    INSERT INTO streetname VALUES('raddington');
    INSERT INTO streetname VALUES('raku');
    INSERT INTO streetname VALUES('rancliffe');
    INSERT INTO streetname VALUES('ravencrest');
    INSERT INTO streetname VALUES('reames');
    INSERT INTO streetname VALUES('rebecca run');
    INSERT INTO streetname VALUES('red bluff');
    INSERT INTO streetname VALUES('red clay');
    INSERT INTO streetname VALUES('red clover');
    INSERT INTO streetname VALUES('red rose');
    INSERT INTO streetname VALUES('red shed');
    INSERT INTO streetname VALUES('red tail');
    INSERT INTO streetname VALUES('redbridge');
    INSERT INTO streetname VALUES('redstart');
    INSERT INTO streetname VALUES('redstone view');
    INSERT INTO streetname VALUES('reedmont');
    INSERT INTO streetname VALUES('reeves');
    INSERT INTO streetname VALUES('regal');
    INSERT INTO streetname VALUES('reinbeck');
    INSERT INTO streetname VALUES('retriever');
    INSERT INTO streetname VALUES('ribbonwalk');
    INSERT INTO streetname VALUES('richardson park');
    INSERT INTO streetname VALUES('richfield');
    INSERT INTO streetname VALUES('riddings');
    INSERT INTO streetname VALUES('ridge');
    INSERT INTO streetname VALUES('ridge cliff');
    INSERT INTO streetname VALUES('ridge path');
    INSERT INTO streetname VALUES('ridge peak');
    INSERT INTO streetname VALUES('ridgefield');
    INSERT INTO streetname VALUES('ridgeline');
    INSERT INTO streetname VALUES('ridgeview commons');
    INSERT INTO streetname VALUES('riley');
    INSERT INTO streetname VALUES('riley woods');
    INSERT INTO streetname VALUES('rillet');
    INSERT INTO streetname VALUES('rindle');
    INSERT INTO streetname VALUES('rivendell');
    INSERT INTO streetname VALUES('robin');
    INSERT INTO streetname VALUES('robins nest');
    INSERT INTO streetname VALUES('robur');
    INSERT INTO streetname VALUES('robyns glen');
    INSERT INTO streetname VALUES('rock stream');
    INSERT INTO streetname VALUES('rockwell');
    INSERT INTO streetname VALUES('rockwell church');
    INSERT INTO streetname VALUES('rocky brook');
    INSERT INTO streetname VALUES('rocky ford club');
    INSERT INTO streetname VALUES('rotary');
    INSERT INTO streetname VALUES('rouda');
    INSERT INTO streetname VALUES('royal bluff');
    INSERT INTO streetname VALUES('royal celadon');
    INSERT INTO streetname VALUES('rubin lura');
    INSERT INTO streetname VALUES('runswyck');
    INSERT INTO streetname VALUES('ruth ferrell');
    INSERT INTO streetname VALUES('ruth polk');
    INSERT INTO streetname VALUES('ryan jay');
    INSERT INTO streetname VALUES('sackett');
    INSERT INTO streetname VALUES('saddle pace');
    INSERT INTO streetname VALUES('saddle run');
    INSERT INTO streetname VALUES('saddle trail');
    INSERT INTO streetname VALUES('saguaro');
    INSERT INTO streetname VALUES('saint audrey');
    INSERT INTO streetname VALUES('saint bernard');
    INSERT INTO streetname VALUES('saint frances');
    INSERT INTO streetname VALUES('sam roper');
    INSERT INTO streetname VALUES('samara');
    INSERT INTO streetname VALUES('sanders creek');
    INSERT INTO streetname VALUES('saquache');
    INSERT INTO streetname VALUES('sarnia');
    INSERT INTO streetname VALUES('savannah springs');
    INSERT INTO streetname VALUES('sawgrass ridge');
    INSERT INTO streetname VALUES('saxonbury');
    INSERT INTO streetname VALUES('scotch moss');
    INSERT INTO streetname VALUES('seasons');
    INSERT INTO streetname VALUES('serenity');
    INSERT INTO streetname VALUES('seths');
    INSERT INTO streetname VALUES('shadow lawn');
    INSERT INTO streetname VALUES('shadow oaks');
    INSERT INTO streetname VALUES('shadow pine');
    INSERT INTO streetname VALUES('shadyside');
    INSERT INTO streetname VALUES('shallow oak');
    INSERT INTO streetname VALUES('shelley');
    INSERT INTO streetname VALUES('shining oak');
    INSERT INTO streetname VALUES('ship');
    INSERT INTO streetname VALUES('shore haven');
    INSERT INTO streetname VALUES('shuman');
    INSERT INTO streetname VALUES('sidney');
    INSERT INTO streetname VALUES('silver birch');
    INSERT INTO streetname VALUES('silvermere');
    INSERT INTO streetname VALUES('simonton');
    INSERT INTO streetname VALUES('singing hills');
    INSERT INTO streetname VALUES('singing oak');
    INSERT INTO streetname VALUES('sipes');
    INSERT INTO streetname VALUES('six point');
    INSERT INTO streetname VALUES('skycrest');
    INSERT INTO streetname VALUES('skyline');
    INSERT INTO streetname VALUES('small');
    INSERT INTO streetname VALUES('smith corners');
    INSERT INTO streetname VALUES('smithwood');
    INSERT INTO streetname VALUES('snow hill');
    INSERT INTO streetname VALUES('soapstone');
    INSERT INTO streetname VALUES('sobeck');
    INSERT INTO streetname VALUES('socata');
    INSERT INTO streetname VALUES('solace');
    INSERT INTO streetname VALUES('solway');
    INSERT INTO streetname VALUES('song sparrow');
    INSERT INTO streetname VALUES('sorrento');
    INSERT INTO streetname VALUES('spector');
    INSERT INTO streetname VALUES('spin drift');
    INSERT INTO streetname VALUES('spring crest');
    INSERT INTO streetname VALUES('spring lee');
    INSERT INTO streetname VALUES('spring park');
    INSERT INTO streetname VALUES('spring terrace');
    INSERT INTO streetname VALUES('spring trace');
    INSERT INTO streetname VALUES('springhaven');
    INSERT INTO streetname VALUES('squirrel trail');
    INSERT INTO streetname VALUES('stardust');
    INSERT INTO streetname VALUES('stargaze');
    INSERT INTO streetname VALUES('starita');
    INSERT INTO streetname VALUES('starmount');
    INSERT INTO streetname VALUES('statesville');
    INSERT INTO streetname VALUES('steed');
    INSERT INTO streetname VALUES('steelewood');
    INSERT INTO streetname VALUES('steepleglen');
    INSERT INTO streetname VALUES('stephens farm');
    INSERT INTO streetname VALUES('stewarton');
    INSERT INTO streetname VALUES('stone park');
    INSERT INTO streetname VALUES('stonebrook');
    INSERT INTO streetname VALUES('stonefield');
    INSERT INTO streetname VALUES('stoneglen');
    INSERT INTO streetname VALUES('stonemarsh');
    INSERT INTO streetname VALUES('stoney garden');
    INSERT INTO streetname VALUES('stoney run');
    INSERT INTO streetname VALUES('stoney valley');
    INSERT INTO streetname VALUES('stoneykirk');
    INSERT INTO streetname VALUES('stream bank');
    INSERT INTO streetname VALUES('stream ridge');
    INSERT INTO streetname VALUES('suburban');
    INSERT INTO streetname VALUES('suffield');
    INSERT INTO streetname VALUES('sugar creek');
    INSERT INTO streetname VALUES('sugarberry');
    INSERT INTO streetname VALUES('sugarstone');
    INSERT INTO streetname VALUES('summer creek');
    INSERT INTO streetname VALUES('summer valley');
    INSERT INTO streetname VALUES('summercrest');
    INSERT INTO streetname VALUES('summercroft');
    INSERT INTO streetname VALUES('summerford');
    INSERT INTO streetname VALUES('summergold');
    INSERT INTO streetname VALUES('sunbeam');
    INSERT INTO streetname VALUES('sunbridge');
    INSERT INTO streetname VALUES('sunpath');
    INSERT INTO streetname VALUES('sunset');
    INSERT INTO streetname VALUES('sunset ridge');
    INSERT INTO streetname VALUES('sunstone');
    INSERT INTO streetname VALUES('suntrace');
    INSERT INTO streetname VALUES('sunwalk');
    INSERT INTO streetname VALUES('sutters hill');
    INSERT INTO streetname VALUES('suttonview');
    INSERT INTO streetname VALUES('swallow tail');
    INSERT INTO streetname VALUES('swanston');
    INSERT INTO streetname VALUES('sweet grove');
    INSERT INTO streetname VALUES('sweet rose');
    INSERT INTO streetname VALUES('sweetbriar ridge');
    INSERT INTO streetname VALUES('sweetfield');
    INSERT INTO streetname VALUES('sydney overlook');
    INSERT INTO streetname VALUES('sylvan');
    INSERT INTO streetname VALUES('symphony woods');
    INSERT INTO streetname VALUES('tallia');
    INSERT INTO streetname VALUES('tallu');
    INSERT INTO streetname VALUES('talwyn');
    INSERT INTO streetname VALUES('tanager');
    INSERT INTO streetname VALUES('tanager park');
    INSERT INTO streetname VALUES('tangley');
    INSERT INTO streetname VALUES('taranasay');
    INSERT INTO streetname VALUES('tarby');
    INSERT INTO streetname VALUES('tarland');
    INSERT INTO streetname VALUES('tarpway');
    INSERT INTO streetname VALUES('tauten');
    INSERT INTO streetname VALUES('taymouth');
    INSERT INTO streetname VALUES('ten trees');
    INSERT INTO streetname VALUES('terrace view');
    INSERT INTO streetname VALUES('terrier');
    INSERT INTO streetname VALUES('tesh');
    INSERT INTO streetname VALUES('teton');
    INSERT INTO streetname VALUES('tewkesbury');
    INSERT INTO streetname VALUES('thelema');
    INSERT INTO streetname VALUES('thistle bloom');
    INSERT INTO streetname VALUES('thistledown');
    INSERT INTO streetname VALUES('thomas ridge');
    INSERT INTO streetname VALUES('thornbrook');
    INSERT INTO streetname VALUES('tifton grass');
    INSERT INTO streetname VALUES('tigerton');
    INSERT INTO streetname VALUES('tomsie efird');
    INSERT INTO streetname VALUES('tor');
    INSERT INTO streetname VALUES('torphin');
    INSERT INTO streetname VALUES('torrence');
    INSERT INTO streetname VALUES('towering pine');
    INSERT INTO streetname VALUES('towhee');
    INSERT INTO streetname VALUES('toxaway');
    INSERT INTO streetname VALUES('tracy glenn');
    INSERT INTO streetname VALUES('tradition view');
    INSERT INTO streetname VALUES('trailer');
    INSERT INTO streetname VALUES('transport');
    INSERT INTO streetname VALUES('trehurst');
    INSERT INTO streetname VALUES('trexler');
    INSERT INTO streetname VALUES('trillium fields');
    INSERT INTO streetname VALUES('trimbach');
    INSERT INTO streetname VALUES('tucker');
    INSERT INTO streetname VALUES('tullamore');
    INSERT INTO streetname VALUES('tullock creek');
    INSERT INTO streetname VALUES('tunston');
    INSERT INTO streetname VALUES('tupelo');
    INSERT INTO streetname VALUES('turnabout');
    INSERT INTO streetname VALUES('turney');
    INSERT INTO streetname VALUES('turtle cross');
    INSERT INTO streetname VALUES('turtleback');
    INSERT INTO streetname VALUES('twelvestone');
    INSERT INTO streetname VALUES('twin');
    INSERT INTO streetname VALUES('twin brook');
    INSERT INTO streetname VALUES('twin lakes');
    INSERT INTO streetname VALUES('twisted pine');
    INSERT INTO streetname VALUES('tyler finley');
    INSERT INTO streetname VALUES('university station');
    INSERT INTO streetname VALUES('uphill');
    INSERT INTO streetname VALUES('valeview');
    INSERT INTO streetname VALUES('valhalla');
    INSERT INTO streetname VALUES('van');
    INSERT INTO streetname VALUES('vance davis');
    INSERT INTO streetname VALUES('vanhoy');
    INSERT INTO streetname VALUES('veckman');
    INSERT INTO streetname VALUES('victoria');
    INSERT INTO streetname VALUES('victory');
    INSERT INTO streetname VALUES('village glen');
    INSERT INTO streetname VALUES('vireo');
    INSERT INTO streetname VALUES('viscount');
    INSERT INTO streetname VALUES('voeltz');
    INSERT INTO streetname VALUES('wade e morgan');
    INSERT INTO streetname VALUES('wake');
    INSERT INTO streetname VALUES('wales');
    INSERT INTO streetname VALUES('wallace ridge');
    INSERT INTO streetname VALUES('waltham');
    INSERT INTO streetname VALUES('wanamassa');
    INSERT INTO streetname VALUES('warbler wood');
    INSERT INTO streetname VALUES('washington');
    INSERT INTO streetname VALUES('water');
    INSERT INTO streetname VALUES('waterelm');
    INSERT INTO streetname VALUES('waterford hills');
    INSERT INTO streetname VALUES('waterford valley');
    INSERT INTO streetname VALUES('waterloo');
    INSERT INTO streetname VALUES('waterton leas');
    INSERT INTO streetname VALUES('waverly lynn');
    INSERT INTO streetname VALUES('waverlyglen');
    INSERT INTO streetname VALUES('wayside');
    INSERT INTO streetname VALUES('westbury lake');
    INSERT INTO streetname VALUES('westray');
    INSERT INTO streetname VALUES('whistlers chase');
    INSERT INTO streetname VALUES('whistley green');
    INSERT INTO streetname VALUES('whistling oak');
    INSERT INTO streetname VALUES('whitcomb');
    INSERT INTO streetname VALUES('white aspen');
    INSERT INTO streetname VALUES('white cascade');
    INSERT INTO streetname VALUES('white mist');
    INSERT INTO streetname VALUES('white rock');
    INSERT INTO streetname VALUES('white stag');
    INSERT INTO streetname VALUES('whitegate');
    INSERT INTO streetname VALUES('whitehill');
    INSERT INTO streetname VALUES('whitetail');
    INSERT INTO streetname VALUES('whitewood');
    INSERT INTO streetname VALUES('wilburn park');
    INSERT INTO streetname VALUES('wild garden');
    INSERT INTO streetname VALUES('wild rose');
    INSERT INTO streetname VALUES('wilkins terrace');
    INSERT INTO streetname VALUES('william ficklen');
    INSERT INTO streetname VALUES('wiltshire ridge');
    INSERT INTO streetname VALUES('windchase');
    INSERT INTO streetname VALUES('winding jordan');
    INSERT INTO streetname VALUES('windy meadow');
    INSERT INTO streetname VALUES('winghaven');
    INSERT INTO streetname VALUES('wingmont');
    INSERT INTO streetname VALUES('winslow');
    INSERT INTO streetname VALUES('winter pine');
    INSERT INTO streetname VALUES('winter view');
    INSERT INTO streetname VALUES('wolf creek');
    INSERT INTO streetname VALUES('wondering oak');
    INSERT INTO streetname VALUES('woodard');
    INSERT INTO streetname VALUES('woodfire');
    INSERT INTO streetname VALUES('woodland commons');
    INSERT INTO streetname VALUES('woodland hills');
    INSERT INTO streetname VALUES('woodnotch');
    INSERT INTO streetname VALUES('woodstone');
    INSERT INTO streetname VALUES('worsley');
    INSERT INTO streetname VALUES('wren creek');
    INSERT INTO streetname VALUES('wrens nest');
    INSERT INTO streetname VALUES('wrexham');
    INSERT INTO streetname VALUES('wt harris');
    INSERT INTO streetname VALUES('wylie meadow');
    INSERT INTO streetname VALUES('wynborough');
    INSERT INTO streetname VALUES('wynbrook');
    INSERT INTO streetname VALUES('wyndham hill');
    INSERT INTO streetname VALUES('yandem');
    INSERT INTO streetname VALUES('yellow rose');
    INSERT INTO streetname VALUES('yellow spaniel');
    INSERT INTO streetname VALUES('yorkford');
    INSERT INTO streetname VALUES('ziegler');
    INSERT INTO streetname VALUES('zion renaissance');

    SELECT count(*) FROM streetname;
  }
} {1228}

do_test fuzzer1-2.1 {
  execsql {
    SELECT n, distance FROM f2, streetname
     WHERE f2.word MATCH 'wersley'
       AND f2.distance<=150
       AND f2.word=streetname.n
  }
} {worsley 37}
do_test fuzzer1-2.2 {
  execsql {
    SELECT n, distance FROM f2, streetname
     WHERE f2.word MATCH 'testledown'
       AND f2.distance<=150
       AND f2.word=streetname.n
  }
} {thistledown 103}
do_test fuzzer1-2.3 {
  execsql {
    SELECT DISTINCT streetname.n FROM f2, streetname
     WHERE f2.word MATCH 'tayle'
       AND f2.distance<=200
       AND streetname.n>=f2.word AND streetname.n<=(f2.word || x'F7BFBFBF')
  }
} {steelewood tallia tallu talwyn taymouth thelema trailer {tyler finley}}


finish_test