### Version 1.20.0 ### What happened? The generated code ```go func (q *Queries) GetA(ctx context.Context) (GetARow, error) { row := q.db.QueryRowContext(ctx, getA) var i GetARow err := row.Scan( &i.A.ID, &i.A.Name, &i.B.ID, &i.B.AID, &i.B.Label, ) return i, err } ``` will fail when there is no B to join to A, because it did not detect that the whole `i.B` is nullable. ### Relevant log output ```shell sql: Scan error on column index 2, name "id": converting NULL to int32 is unsupported ``` ### Database schema ```sql CREATE TABLE A ( id BIGSERIAL PRIMARY KEY, name text NOT NULL ); CREATE TABLE B ( id BIGSERIAL PRIMARY KEY, a_id BIGINT NOT NULL, label text NOT NULL ); ``` ### SQL queries ```sql SELECT sqlc.embed(A), sqlc.embed(B) FROM A LEFT JOIN B ON A.id = B.a_id LIMIT 1; ``` ### Configuration _No response_ ### Playground URL https://play.sqlc.dev/p/c045f5e33caf61f3e913a742f08518a167c247c4e5902a995f17ee200a553b2a](https://play.sqlc.dev/p/a6840c57f06a38387e9af1604059bb1db09e0db71f7a462c7bcd6a8dcfc42043 ### What operating system are you using? Linux ### What database engines are you using? PostgreSQL ### What type of code are you generating? Go
Activity
hectorj-thetreep commentedon Aug 18, 2023
Ideally I would like something like this:
But it might be tricky to Scan.
An alternative is to have
NullableBbe a copy ofBwith all its fields nullable… not ideal but maybe easier.nickjackson commentedon Aug 18, 2023
this is a duplicate of #2348 and #2472
hectorj-thetreep commentedon Aug 18, 2023