sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

nullable vectors map to pgvector.Vector

Open newhook opened this issue 1 year ago • 0 comments

Version

1.27.0

What happened?

I think nullable vectors should map to a *pgvector.Vector? The current code doesn't work for nil vectors:

Error=can't scan into dest[7]: unsupported data type: <nil>

Which seems to map the scan code for pgvector:

func (v *Vector) Scan(src interface{}) (err error) {
	switch src := src.(type) {
	case []byte:
		return v.Parse(string(src))
	case string:
		return v.Parse(src)
	default:
		return fmt.Errorf("unsupported data type: %T", src)
	}
}

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

newhook avatar Aug 15 '24 15:08 newhook