Subselect error with builder.Dialect
#2284
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#2284
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Not really sure if this error does only occur with subselects but that's how I found it.
results in the following working query
SELECT * FROM "bar" INNER JOIN (SELECT * FROM foo WHERE col1=$1) "foo" ON foo.key = bar.key WHERE col2=$2 [1 2]
As you can see there are parameters
$1
and$2
.If you change
inner
tothe generated query is
SELECT * FROM "bar" INNER JOIN (SELECT * FROM foo WHERE col1=$1) "foo" ON foo.key = bar.key WHERE col2=$1 [1 2]
Now both parameters are named
$1
and the query fails because there are more provided than needed parameters.Is that
.Dialect(builder.POSTGRES)
necessary for you?I noticed that problem in https://github.com/go-gitea/gitea/pull/25613 The relevant code is https://github.com/go-gitea/gitea/pull/25613/files#diff-682f1dccd138b66040eb9312ba2052783bbf970677bdf408f6e890231568ac68R40-R54
The use of
LIMIT
in the inner query requires to specify the dialect which causes the problems.