Regression in Rows.Scan
: incorrect handling of sql.Scanner
implementation in v5.7.2
#2204
Labels
Rows.Scan
: incorrect handling of sql.Scanner
implementation in v5.7.2
#2204
The
Rows.Scan
method of thepgx
package is documented as follows:According to the documentation, it accepts as arguments:
Scanner
interface,nil
.Starting from version v5.7.2, point (2) is no longer true because:
sql.Scanner
interface.sql.Scanner
but point to types that do.Both changes contradict the method's documentation. In particular:
These issues were introduced in commit 5c9b565. The issue #2146, which this commit intended to resolve, did not need fixing in the first place because the original behavior was correct. The example code in the issue is incorrect. Specifically:
The second argument to
rows.Scan
has type**T
, but**T
does not implementsql.Scanner
. Therefore, theScan
method has noScan
implementation to invoke.The example code should be corrected as follows:
Here,
r.Data
must not be passed as a pointer.As a result, commit 5c9b565 should be reverted to restore the correct behavior, which was consistent with both the documentation and expected usage.
The text was updated successfully, but these errors were encountered: