Skip to content

sqlc >= v1.18.0 detects a string concatenation as sql.NullBool #2734

Open
@jamietanna

Description

@jamietanna

Version

1.21.0

What happened?

I've just done a few version bumps up to v1.21.0 and noticed that:

select
-- ...
db.engine || ' ' || db.engine_version as runtime

Ends up being converted to an sql.NullBool.

The upgrade diff for the generate structs can be found below:

 // Code generated by sqlc. DO NOT EDIT.
 // versions:
-//   sqlc v1.17.0
+//   sqlc v1.21.0
 // source: queries.sql
 
 package db
@@ -198,21 +198,11 @@ where
 `
 
 type RetrieveAWSAdvisoriesRow struct {
-       Arn            string
-       Name           string
-       Runtime        interface{}
-       AdvisoryType   interface{}
-       Description    interface{}
-       Arn_2          string
-       Name_2         string
-       Runtime_2      string
-       AdvisoryType_2 interface{}
-       Description_2  interface{}
-       Arn_3          string
-       Name_3         string
-       Runtime_3      interface{}
-       AdvisoryType_3 interface{}
-       Description_3  interface{}
+       Arn          string
+       Name         string
+       Runtime      sql.NullBool
+       AdvisoryType interface{}
+       Description  interface{}
 }

Previously it was an interface{} or a string, whereas now it's a sql.NullBool 🤔

I've had a look back on the Playground as far back as v1.18.0 (link) and it affects that as well as up to v1.21.0 (with #2729 applied locally)

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/4644276ab2d6a08adc69359a99b241c23a0ce108f0a01d9bb937a81d584501ef

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions