Skip to content

Commit

Permalink
database: fix ambiguous column name: reference_id (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-dionysos authored Feb 21, 2025
1 parent 1ffb294 commit d70d367
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions database/query/query_text_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ func (db *dbClient) searchWithoutDepsSQL(whereMain, whereSearch, systemCreatedAt
e.sig,
e.content,
tags as jtags
from(
from (
select
*
from events e WHERE id IN (select id from pre_search) ` + where + `
from events e WHERE e.id IN (select id from pre_search) ` + where + `
UNION ALL
select
*
from events e WHERE reference_id IS NOT NULL AND reference_id IN(select id from pre_search)
from events e WHERE e.reference_id IS NOT NULL AND e.reference_id IN(select id from pre_search)
) e ` + limitQuery + `;`

return sql, nil
Expand Down Expand Up @@ -137,8 +137,8 @@ func (db *dbClient) searchWithDepsSQL(whereMain, depClause, whereSearch, systemC
SELECT
ev.*
FROM events ev
WHERE reference_id IS NOT NULL
AND reference_id IN (SELECT id FROM eventsmain)
WHERE ev.reference_id IS NOT NULL
AND ev.reference_id IN (SELECT id FROM eventsmain)
) e
` + depClause + `;`

Expand Down
2 changes: 1 addition & 1 deletion database/query/query_where_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ group by e.master_pubkey`)
}
w.WriteString(")")
if filter.Reduce.Group && filter.Reduce.Kinds[1] == nostr.KindReaction {
w.WriteString(" GROUP BY reference_id")
w.WriteString(" GROUP BY f.reference_id")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ require (
github.com/containerd/console v1.0.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/getsentry/sentry-go v0.31.1 // indirect
github.com/gin-contrib/sse v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn
github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8=
github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk=
Expand Down

0 comments on commit d70d367

Please sign in to comment.