Add support for strict scan.
If there are unused columns in query result set Query method panics.
This commit is contained in:
parent
cfc264221b
commit
d86f14e665
9 changed files with 402 additions and 207 deletions
|
|
@ -320,7 +320,6 @@ func testJoinEverything(t require.TestingT) {
|
|||
Track.AllColumns,
|
||||
Genre.AllColumns,
|
||||
MediaType.AllColumns,
|
||||
PlaylistTrack.AllColumns,
|
||||
Playlist.AllColumns,
|
||||
Invoice.AllColumns,
|
||||
Customer.AllColumns,
|
||||
|
|
@ -365,8 +364,6 @@ SELECT "Artist"."ArtistId" AS "Artist.ArtistId",
|
|||
"Genre"."Name" AS "Genre.Name",
|
||||
"MediaType"."MediaTypeId" AS "MediaType.MediaTypeId",
|
||||
"MediaType"."Name" AS "MediaType.Name",
|
||||
"PlaylistTrack"."PlaylistId" AS "PlaylistTrack.PlaylistId",
|
||||
"PlaylistTrack"."TrackId" AS "PlaylistTrack.TrackId",
|
||||
"Playlist"."PlaylistId" AS "Playlist.PlaylistId",
|
||||
"Playlist"."Name" AS "Playlist.Name",
|
||||
"Invoice"."InvoiceId" AS "Invoice.InvoiceId",
|
||||
|
|
@ -1295,7 +1292,7 @@ func TestAggregateFunc(t *testing.T) {
|
|||
WITHIN_GROUP_ORDER_BY(Invoice.BillingAddress.DESC()).AS("percentile_disc_3"),
|
||||
|
||||
PERCENTILE_CONT(Float(0.3)).WITHIN_GROUP_ORDER_BY(Invoice.Total).AS("percentile_cont_1"),
|
||||
PERCENTILE_CONT(Float(0.2)).WITHIN_GROUP_ORDER_BY(INTERVAL(1, HOUR).DESC()).AS("percentile_cont_int"),
|
||||
PERCENTILE_CONT(Float(0.2)).WITHIN_GROUP_ORDER_BY(INTERVAL(1, HOUR).DESC()).AS("percentile_cont_interval"),
|
||||
|
||||
MODE().WITHIN_GROUP_ORDER_BY(Invoice.BillingPostalCode.DESC()).AS("mode_1"),
|
||||
).FROM(
|
||||
|
|
@ -1309,18 +1306,19 @@ SELECT PERCENTILE_DISC ($1::double precision) WITHIN GROUP (ORDER BY "Invoice"."
|
|||
PERCENTILE_DISC ("Invoice"."Total" / $2) WITHIN GROUP (ORDER BY "Invoice"."InvoiceDate" ASC) AS "percentile_disc_2",
|
||||
PERCENTILE_DISC ((select array_agg(s) from generate_series(0, 1, 0.2) as s)) WITHIN GROUP (ORDER BY "Invoice"."BillingAddress" DESC) AS "percentile_disc_3",
|
||||
PERCENTILE_CONT ($3::double precision) WITHIN GROUP (ORDER BY "Invoice"."Total") AS "percentile_cont_1",
|
||||
PERCENTILE_CONT ($4::double precision) WITHIN GROUP (ORDER BY INTERVAL '1 HOUR' DESC) AS "percentile_cont_int",
|
||||
PERCENTILE_CONT ($4::double precision) WITHIN GROUP (ORDER BY INTERVAL '1 HOUR' DESC) AS "percentile_cont_interval",
|
||||
MODE () WITHIN GROUP (ORDER BY "Invoice"."BillingPostalCode" DESC) AS "mode_1"
|
||||
FROM chinook."Invoice"
|
||||
GROUP BY "Invoice"."Total";
|
||||
`, 0.1, 100.0, 0.3, 0.2)
|
||||
|
||||
var dest struct {
|
||||
PercentileDisc1 string
|
||||
PercentileDisc2 string
|
||||
PercentileDisc3 string
|
||||
PercentileCont1 string
|
||||
Mode1 string
|
||||
PercentileDisc1 string
|
||||
PercentileDisc2 string
|
||||
PercentileDisc3 string
|
||||
PercentileCont1 string
|
||||
PercentileContInterval string
|
||||
Mode1 string
|
||||
}
|
||||
|
||||
err := stmt.Query(db, &dest)
|
||||
|
|
@ -1332,6 +1330,7 @@ GROUP BY "Invoice"."Total";
|
|||
"PercentileDisc2": "2009-01-19T00:00:00Z",
|
||||
"PercentileDisc3": "{\"Via Degli Scipioni, 43\",\"Qe 7 Bloco G\",\"Berger Stra<72>e 10\",\"696 Osborne Street\",\"2211 W Berry Street\",\"1033 N Park Ave\"}",
|
||||
"PercentileCont1": "0.99",
|
||||
"PercentileContInterval": "01:00:00",
|
||||
"Mode1": "X1A 1N6"
|
||||
}
|
||||
`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue