Home > Backend Development > Golang > Why Am I Getting 'panic: sql: expected 1 destination arguments in Scan, not .' When Scanning JSONB Data in PostgreSQL?

Why Am I Getting 'panic: sql: expected 1 destination arguments in Scan, not .' When Scanning JSONB Data in PostgreSQL?

Linda Hamilton
Release: 2024-11-05 15:40:02
Original
898 people have browsed it

Why Am I Getting

Scan Argument Mismatch in SQL Query Using QueryRow

While fetching records from a PostgreSQL table using db.QueryRow, you may encounter the error "panic: sql: expected 1 destination arguments in Scan, not ." This typically occurs when the destination arguments passed to Scan do not match the number of columns returned by the query.

In the given example, you are fetching the data column, which has the type jsonb. The error arises because you attempt to scan the returned data into three destination arguments (m.Id, m.Type, and `m.

The above is the detailed content of Why Am I Getting 'panic: sql: expected 1 destination arguments in Scan, not .' When Scanning JSONB Data in PostgreSQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template