Skip to content

Inconsistent behaviour of rows.NextResultSet() between lib/pg and go-sql-driver/mysql #828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Feb 1, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 1, 2019

Calling NextResultSet() on rows returned by

rows, err := db.QueryContext(ctx, "select somecol from sometable")

behaves inconsistent between lib/pq and go-sql-driver/mysql. While it is true for pq, it is false for mysql. This gists shows complete code that demonstrates this behaviour:

https://gist.github.com/lutzhorn/1aa7de538d1edd0b3904799b5bb972fd

The maintainers of mysql claim on the go-nuts mailinglist that returning false ist correct in this scenario.

What is the correct behaviour?

@methane
Copy link

methane commented Feb 1, 2019

Ref: https://groups.google.com/d/msg/golang-nuts/WMw_vsiFpvU/uwvCJus8DwAJ

This is the subthread about this difference.

@methane
Copy link

methane commented Feb 1, 2019

Another reference is this:
https://golang.org/pkg/database/sql/driver/#RowsNextResultSet

        // HasNextResultSet is called at the end of the current result set and
        // reports whether there is another result set after the current one.
        HasNextResultSet() bool

        // NextResultSet advances the driver to the next result set even
        // if there are remaining rows in the current result set.
        //
        // NextResultSet should return io.EOF when there are no more result sets.
        NextResultSet() error

Maybe, lib/pq doesn't have full implementation of NextResultSet?
It can not "skip remaining rows in the current result set."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant