Repository navigation
Expand file tree
/
Copy pathquery_test.go
More file actions
602 lines (566 loc) · 19.5 KB
/
Copy pathquery_test.go
File metadata and controls
602 lines (566 loc) · 19.5 KB
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
package dbmeta
import (
"context"
"database/sql"
"errors"
"strings"
"testing"
)
const testDialect Dialect = "testdb"
func init() {
RegisterDialect(quietDialect, &Info{Placeholder: func(int) string { return "?" }})
RegisterDialect(seqDialect, &Info{Placeholder: func(int) string { return "?" }})
repeatedQuery.Register(seqDialect, &Binding[Table]{
Stmt: Always(`SELECT 1 WHERE (@name = '' OR a LIKE @name)`),
Params: []Param{{Name: "name", Default: ""}},
})
RegisterDialect(sysvarDialect, &Info{Placeholder: func(int) string { return "?" }})
repeatedQuery.Register(sysvarDialect, &Binding[Table]{
Stmt: Always(`SELECT @@project_id, @name, @@sql_mode`),
Params: []Param{{Name: "name", Default: ""}},
})
RegisterDialect(namedDialect, &Info{Named: true})
repeatedQuery.Register(namedDialect, &Binding[Table]{
Stmt: Always(`SELECT 1 WHERE (@name = '' OR a LIKE @name) AND @system`),
Params: []Param{{Name: "name", Default: ""}, {Name: "system", Default: false}},
})
RegisterDialect(testDialect, &Info{
Placeholder: func(n int) string { return "$" + string(rune('0'+n)) },
VersionQuery: `SHOW server_version`,
VersionColumns: 1,
ParseVersion: func(cols []string) (VersionSet, error) {
var s VersionSet
s.Set("", ParseVersion(cols[0]))
s.Display = "TestDB " + cols[0]
return s, nil
},
})
Tables.Register(testDialect, &Binding[Table]{
Stmt: Stmt{
{{Query: `SELECT n.nspname AS "schema"`}},
{{Query: `, c.relname AS "name"`}},
// added in 15, so older releases pad
{
{Query: `, NULL AS "access_privileges"`},
{Min: V(15), Query: `, c.relacl AS "access_privileges"`},
},
// removed in 12, so newer releases pad
{
{Query: `, d.adsrc AS "default_source"`},
{Min: V(12), Query: `, NULL AS "default_source"`},
},
{{Query: `FROM pg_class c WHERE n.nspname = @schema`}},
},
Fields: []Field{
{Name: "schema"},
{Name: "name"},
{Name: "access_privileges", Min: V(15)},
{Name: "default_source"},
},
Params: []Param{{Name: "schema"}},
Scan: func(rows *sql.Rows) (Table, error) {
var t Table
var priv, def *string
err := rows.Scan(&t.Schema, &t.Name, &priv, &def)
return t, err
},
})
}
func meta(t *testing.T, ver string) *Meta {
t.Helper()
var s VersionSet
s.Set("", ParseVersion(ver))
m, err := New(testDialect, s)
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
return m
}
// TestPaddingBothDirections is the rule the whole design rests on. A query
// returns the same columns on every version. Padding happens on the old side
// and on the new side, and the new side is the case an earlier draft missed.
func TestPaddingBothDirections(t *testing.T) {
t.Parallel()
want := map[string][]string{
"11": {`NULL AS "access_privileges"`, `d.adsrc AS "default_source"`},
"12": {`NULL AS "access_privileges"`, `NULL AS "default_source"`},
"18": {`c.relacl AS "access_privileges"`, `NULL AS "default_source"`},
}
for ver, parts := range want {
s, _, err := Tables.Build(meta(t, ver), map[string]any{"schema": "public"})
if err != nil {
t.Fatalf("%s: expected no error, got: %v", ver, err)
}
for _, p := range parts {
if !strings.Contains(s, p) {
t.Errorf("%s: expected %q in:\n%s", ver, p, s)
}
}
if n := strings.Count(s, ` AS "`); n != 4 {
t.Errorf("%s: expected 4 named columns, got %d:\n%s", ver, n, s)
}
}
}
// TestFieldMinDistinguishesAbsentFromNull covers the ambiguity the padding
// rule creates. A NULL means either that the value is null or that the server
// is too old to have the field, and only the declared minimum tells them
// apart.
func TestFieldMinDistinguishesAbsentFromNull(t *testing.T) {
t.Parallel()
fields, err := Tables.Fields(meta(t, "11"))
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
var found bool
for _, f := range fields {
if f.Name != "access_privileges" {
continue
}
found = true
if ParseVersion("11").AtLeast(f.Min) {
t.Error("expected access_privileges to be absent at release 11")
}
if !ParseVersion("18").AtLeast(f.Min) {
t.Error("expected access_privileges to be present at release 18")
}
}
if !found {
t.Fatal("expected an access_privileges field")
}
}
func TestSupportStates(t *testing.T) {
t.Parallel()
m := meta(t, "18")
if got := Tables.Support(m); got != Supported {
t.Errorf("expected supported, got %v", got)
}
// registered dialect, no binding for this query
if got := Schemas.Support(m); got != NotSupported {
t.Errorf("expected not supported, got %v", got)
}
if _, err := Schemas.Fields(m); !errors.Is(err, ErrNotSupported) {
t.Errorf("expected ErrNotSupported, got: %v", err)
}
// a dialect no model was built for is a different state entirely
if _, err := New("nosuchdb", VersionSet{}); !errors.Is(err, ErrModelNotBuilt) {
t.Errorf("expected ErrModelNotBuilt, got: %v", err)
}
if got := Tables.Support(nil); got != NotBuilt {
t.Errorf("expected not built, got %v", got)
}
}
// TestParamsAreCheckedNotIgnored is the criticism both reviews made of the
// earlier sketch. A typo must not silently drop a filter.
func TestParamsAreCheckedNotIgnored(t *testing.T) {
t.Parallel()
m := meta(t, "18")
if _, _, err := Tables.Build(m, map[string]any{"schma": "public"}); !errors.Is(err, ErrUnknownParam) {
t.Errorf("expected ErrUnknownParam for a typo, got: %v", err)
}
if _, _, err := Tables.Build(m, nil); !errors.Is(err, ErrMissingParam) {
t.Errorf("expected ErrMissingParam, got: %v", err)
}
}
func TestPlaceholdersAndArgs(t *testing.T) {
t.Parallel()
s, args, err := Tables.Build(meta(t, "18"), map[string]any{"schema": "public"})
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if !strings.Contains(s, "= $1") {
t.Errorf("expected the dialect placeholder, got:\n%s", s)
}
if strings.Contains(s, "@schema") {
t.Error("expected the named parameter to be rewritten")
}
if len(args) != 1 || args[0] != "public" {
t.Errorf("expected one argument, got %v", args)
}
}
func TestVersionTooOld(t *testing.T) {
t.Parallel()
st := Stmt{{{Min: V(12), Query: "SELECT 1"}}}
if _, err := st.Build(meta(t, "11").versions); !errors.Is(err, ErrVersionTooOld) {
t.Errorf("expected ErrVersionTooOld, got: %v", err)
}
}
func TestVersionQueryIsDataNotExecuted(t *testing.T) {
t.Parallel()
sql, cols, ok := testDialect.VersionQuery()
if !ok {
t.Fatal("expected a version query")
}
if sql != "SHOW server_version" || cols != 1 {
t.Errorf("unexpected version query %q with %d columns", sql, cols)
}
// the caller runs it and hands the columns back
s, err := testDialect.ParseVersion([]string{"18.6"})
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if got := s.Main().String(); got != "18.6" {
t.Errorf("expected 18.6, got %s", got)
}
if got := s.String(); got != "TestDB 18.6" {
t.Errorf("expected the display line, got %s", got)
}
}
func TestFirstDistinguishesEmptyFromZero(t *testing.T) {
t.Parallel()
empty := func(yield func(Table, error) bool) {}
if _, ok, err := First(empty); ok || err != nil {
t.Errorf("expected not found and no error, got ok=%v err=%v", ok, err)
}
one := func(yield func(Table, error) bool) { yield(Table{Name: "t"}, nil) }
v, ok, err := First(one)
if !ok || err != nil || v.Name != "t" {
t.Errorf("expected the first value, got %v ok=%v err=%v", v, ok, err)
}
}
func TestArgsMapOmitsUnset(t *testing.T) {
t.Parallel()
m := Args{Schema: "public"}.Map()
if len(m) != 1 || m["schema"] != "public" {
t.Errorf("expected only schema, got %v", m)
}
}
func TestAlwaysAndAccessors(t *testing.T) {
t.Parallel()
m := meta(t, "18")
if s, err := Always("SELECT 1").Build(m.versions); err != nil || s != "SELECT 1" {
t.Errorf("expected SELECT 1, got %q err %v", s, err)
}
if Tables.Name() != "tables" {
t.Errorf("expected tables, got %s", Tables.Name())
}
if m.Dialect() != testDialect {
t.Errorf("expected %s, got %s", testDialect, m.Dialect())
}
if m.Version().Main().String() != "18" {
t.Errorf("expected 18, got %s", m.Version().Main())
}
params, err := Tables.Params(m)
if err != nil || len(params) != 1 || params[0].Name != "schema" {
t.Errorf("expected one schema param, got %v err %v", params, err)
}
var found bool
for _, d := range Dialects() {
found = found || d == testDialect
}
if !found {
t.Error("expected the test dialect to be listed")
}
if ErrNotSupported.Error() != "not supported" {
t.Errorf("unexpected error text %q", ErrNotSupported.Error())
}
for s, exp := range map[Support]string{NotBuilt: "not built", NotSupported: "not supported", Supported: "supported"} {
if s.String() != exp {
t.Errorf("expected %q, got %q", exp, s)
}
}
if !(Version{}).IsZero() || ParseVersion("1").IsZero() {
t.Error("unexpected IsZero result")
}
}
// quietDialect is a model whose database reports no version. Registration
// happens once, in init, because a registry rejects a second registration and
// a test body can run more than once.
const quietDialect Dialect = "quietdb"
func TestDialectVersion(t *testing.T) {
t.Parallel()
// a dialect no model was built for
if _, err := Dialect("nosuchdb").Version(context.Background(), nil); !errors.Is(err, ErrModelNotBuilt) {
t.Errorf("expected ErrModelNotBuilt, got: %v", err)
}
// a model that reports no version at all treats the server as newest
versions, err := quietDialect.Version(context.Background(), nil)
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if !versions.Main().Unknown {
t.Error("expected an unknown version")
}
}
// TestRepeatedParamBindsTwice guards a fault that only a placeholder style
// like MySQL's can show. A parameter named twice in one statement must get two
// placeholders and two values, because every ? consumes an argument.
// PostgreSQL hides this, since $2 can appear twice.
// declared at package level, not in the test body: NewQuery and Register both
// reject a duplicate, and a test body runs again under -count=2.
const seqDialect Dialect = "seqdb"
var repeatedQuery = NewQuery[Table]("repeated")
func TestRepeatedParamBindsTwice(t *testing.T) {
t.Parallel()
q := repeatedQuery
m := &Meta{dialect: seqDialect}
s, args, err := q.Build(m, map[string]any{"name": "x"})
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if n := strings.Count(s, "?"); n != 2 {
t.Errorf("expected two placeholders, got %d in:\n%s", n, s)
}
if len(args) != 2 || args[0] != "x" || args[1] != "x" {
t.Errorf("expected the value twice, got %v", args)
}
}
// sysvarDialect has statements that read a system variable, which two at signs
// start. See D220.
const sysvarDialect Dialect = "sysvardb"
// TestSystemVariableIsNotAParameter checks that @@name stays in the statement
// and @name is still a parameter beside it.
func TestSystemVariableIsNotAParameter(t *testing.T) {
t.Parallel()
m := &Meta{dialect: sysvarDialect}
s, args, err := repeatedQuery.Build(m, map[string]any{"name": "x"})
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if want := `SELECT @@project_id, ?, @@sql_mode`; s != want {
t.Errorf("expected\n%s\ngot\n%s", want, s)
}
if len(args) != 1 || args[0] != "x" {
t.Errorf("expected the one value x, got %v", args)
}
}
// namedDialect binds by name, as SurrealDB does. See Info.Named and D164.
const namedDialect Dialect = "nameddb"
// TestNamedBindsEachValueByName checks that a dialect whose drivers take a
// named argument only gets $p1, $p2 and so on, and a sql.NamedArg for each
// value, in order. Placeholder is nil, so a call to it panics.
func TestNamedBindsEachValueByName(t *testing.T) {
t.Parallel()
m := &Meta{dialect: namedDialect}
s, args, err := repeatedQuery.Build(m, map[string]any{"name": "x", "system": true})
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if want := `SELECT 1 WHERE ($p1 = '' OR a LIKE $p2) AND $p3`; s != want {
t.Errorf("expected\n%s\ngot\n%s", want, s)
}
want := []any{sql.Named("p1", "x"), sql.Named("p2", "x"), sql.Named("p3", true)}
if len(args) != len(want) {
t.Fatalf("expected %d values, got %v", len(want), args)
}
for i, arg := range args {
if arg != want[i] {
t.Errorf("value %d: expected %#v, got %#v", i+1, want[i], arg)
}
}
}
// A dialect two products share. It is the MariaDB and MySQL case reduced to
// what the rules need: two keys, neither of them the main one.
const twinDialect Dialect = "twindb"
var (
twinQuery = NewQuery[Table]("twin")
twinOnlyQuery = NewQuery[Table]("twin_only")
twinMixedQuery = NewQuery[Table]("twin_mixed")
)
// shareDialect answers with twinDialect's binding, as a product that
// imitates another's catalog does. See D123.
const shareDialect Dialect = "sharedb"
func init() {
RegisterDialect(twinDialect, &Info{Placeholder: func(int) string { return "?" }})
RegisterDialect(shareDialect, &Info{Placeholder: func(int) string { return "?" }})
twinQuery.Register(twinDialect, &Binding[Table]{
Stmt: Stmt{
{
{Query: `SELECT 'neither' AS "name"`},
{Key: "alpha", Min: V(10, 2), Query: `SELECT 'alpha' AS "name"`},
{Key: "beta", Min: V(8, 0, 16), Query: `SELECT 'beta' AS "name"`},
},
},
Fields: []Field{{
Name: "name",
Min: V(10, 2), Key: "alpha",
Also: []Gate{{Key: "beta", Min: V(8, 0, 16)}},
}},
})
// every alternative names a key, so a server reporting neither is the
// wrong product rather than an old one
twinOnlyQuery.Register(twinDialect, &Binding[Table]{
Stmt: Stmt{{{Key: "alpha", Min: V(11, 5), Query: `SELECT 1`}}},
})
// a model fault: two keys, both met, nothing to choose between them
twinMixedQuery.Register(twinDialect, &Binding[Table]{
Stmt: Stmt{{
{Key: "alpha", Query: `SELECT 'a'`},
{Key: "beta", Query: `SELECT 'b'`},
}},
})
}
func twin(t *testing.T, pairs ...string) *Meta {
t.Helper()
var s VersionSet
for i := 0; i < len(pairs); i += 2 {
s.Set(pairs[i], ParseVersion(pairs[i+1]))
}
m, err := New(twinDialect, s)
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
return m
}
// TestKeyedFragmentNeedsTheKey is the rule D44 rests on. A named key is a fact
// about the server, so a server that does not report it does not meet the
// gate, however new its numbers are. Before this, MySQL 9 satisfied a gate
// written for MariaDB 10.2, because 9 is unknown under that key and unknown
// sorts above everything.
func TestKeyedFragmentNeedsTheKey(t *testing.T) {
t.Parallel()
want := map[*Meta]string{
twin(t, "alpha", "11.8"): "alpha",
twin(t, "beta", "9.7"): "beta",
// reports alpha, but too old for the alpha fragment
twin(t, "alpha", "10.1"): "neither",
// reports neither key
twin(t, "", "1.0"): "neither",
}
for m, expect := range want {
s, _, err := twinQuery.Build(m, nil)
if err != nil {
t.Fatalf("%s: expected no error, got: %v", m, err)
}
if !strings.Contains(s, "'"+expect+"'") {
t.Errorf("%s: expected the %s alternative, got:\n%s", m, expect, s)
}
}
}
// TestKeyedFieldKnowsBothProducts checks that a field arriving in a different
// release of each product reports its presence for both.
func TestKeyedFieldKnowsBothProducts(t *testing.T) {
t.Parallel()
want := map[*Meta]bool{
twin(t, "alpha", "11.8"): true,
twin(t, "alpha", "10.1"): false,
twin(t, "beta", "9.7"): true,
twin(t, "beta", "8.0.1"): false,
twin(t, "beta", "8.0.16"): true,
twin(t, "gamma", "999.99"): false,
}
for m, expect := range want {
fields, err := twinQuery.Fields(m)
if err != nil {
t.Fatalf("%s: expected no error, got: %v", m, err)
}
if got := fields[0].Present(m.Version()); got != expect {
t.Errorf("%s: expected present=%v, got %v", m, expect, got)
}
}
}
// TestWrongProductIsNotSupported separates the two reasons a statement does
// not resolve. A server too old for a piece can be upgraded. A server of the
// other product cannot, so it gets ErrNotSupported and reports the query as
// unsupported rather than answering with a failure.
func TestWrongProductIsNotSupported(t *testing.T) {
t.Parallel()
other := twin(t, "beta", "9.7")
if got := twinOnlyQuery.Support(other); got != NotSupported {
t.Errorf("expected not supported, got %v", got)
}
if _, _, err := twinOnlyQuery.Build(other, nil); !errors.Is(err, ErrNotSupported) {
t.Errorf("expected ErrNotSupported, got: %v", err)
}
// the same query on the right product, at too old a release, is a
// different answer again. It used to report Supported and leave the
// release to the error, which D54 recorded as an open question and
// answered: a caller that trusted Support walked into a query it was
// unable to build.
old := twin(t, "alpha", "10.6")
if got := twinOnlyQuery.Support(old); got != TooOld {
t.Errorf("expected version too old, got %v", got)
}
if _, _, err := twinOnlyQuery.Build(old, nil); !errors.Is(err, ErrVersionTooOld) {
t.Errorf("expected ErrVersionTooOld, got: %v", err)
}
}
// TestTwoKeysBothMetIsAFault checks that nothing guesses. Two alternatives for
// different products cannot both apply, and picking by the number
// compares releases that mean different things.
func TestTwoKeysBothMetIsAFault(t *testing.T) {
t.Parallel()
both := twin(t, "alpha", "11.8", "beta", "9.7")
if _, _, err := twinMixedQuery.Build(both, nil); !errors.Is(err, ErrAmbiguousFragment) {
t.Errorf("expected ErrAmbiguousFragment, got: %v", err)
}
// one key alone resolves
if _, _, err := twinMixedQuery.Build(twin(t, "alpha", "11.8"), nil); err != nil {
t.Errorf("expected no error, got: %v", err)
}
}
// TestKeyedBeatsUnkeyed checks the specificity rule. A fragment written for
// one product wins over one written for the family, whatever the numbers say.
func TestKeyedBeatsUnkeyed(t *testing.T) {
t.Parallel()
c := Choice{
{Min: V(99), Query: `family`},
{Key: "alpha", Query: `product`},
}
var s VersionSet
s.Set("", ParseVersion("100"))
s.Set("alpha", ParseVersion("1"))
got, err := c.Resolve(s)
if err != nil {
t.Fatalf("expected no error, got: %v", err)
}
if got != "product" {
t.Errorf("expected the keyed alternative, got %q", got)
}
}
func TestVersionSetHasAndKeys(t *testing.T) {
t.Parallel()
var s VersionSet
s.Set("", ParseVersion("11.8"))
s.Set("mariadb", ParseVersion("11.8"))
if !s.Has("mariadb") || s.Has("mysql") {
t.Error("expected only the key that was set")
}
if got := strings.Join(s.Keys(), ","); got != ",mariadb" {
t.Errorf("expected the keys sorted, got %q", got)
}
// Get cannot tell an absent key from an unreadable version, which is why
// Has exists
if !s.Get("mysql").Unknown {
t.Error("expected an absent key to read as unknown")
}
}
func init() {
if !twinQuery.Share(twinDialect, shareDialect) {
panic("twinDialect registers twinQuery, and Share said it does not")
}
}
// TestShareRegistersTheSameBinding holds that a shared binding answers for
// the dialect it was shared to exactly as for the one it came from, that
// sharing from a dialect with no binding says so, and that sharing onto a
// dialect that has one panics, as a second Register does.
func TestShareRegistersTheSameBinding(t *testing.T) {
t.Parallel()
var set VersionSet
set.Set("", V(1))
set.Set("alpha", V(11))
from, err := New(twinDialect, set)
if err != nil {
t.Fatal(err)
}
to, err := New(shareDialect, set)
if err != nil {
t.Fatal(err)
}
a, _, errA := twinQuery.Build(from, nil)
b, _, errB := twinQuery.Build(to, nil)
if errA != nil || errB != nil || a != b {
t.Errorf("the shared binding built %q and %v, and the original %q and %v", b, errB, a, errA)
}
if twinOnlyQuery.Support(to) != NotSupported {
t.Errorf("a query that was not shared answers for %s", shareDialect)
}
if twinOnlyQuery.Share(Dialect("nothing"), shareDialect) {
t.Error("Share from a dialect with no binding said it shared one")
}
defer func() {
if recover() == nil {
t.Error("sharing onto a dialect that has a binding did not panic")
}
}()
twinQuery.Share(twinDialect, twinDialect)
}