-
Notifications
You must be signed in to change notification settings - Fork 987
Open
@lookeey
Description
Version
1.30.0
What happened?
I have a DB with a view like so:
CREATE VIEW schema.vw_myview AS
SELECT
p.id AS id_produto,
(SELECT i.name
FROM public.tb_ibpt i
WHERE ((i.code)::text = (p.ncm)::text)
LIMIT 1) AS description,
...
I would expect that selecting the description column in the resulting vw_myview would create a nullable type in the SQLC generated struct, but instead a string field is created. So when there are no matches in the subquery, there is a scan error.
Relevant log output
Database schema
SQL queries
Configuration
version: "2" sql: - engine: postgresql schema: generated.sql queries: - queries gen: go: package: sqls_erp sql_package: "pgx/v5" out: ../internal/sqls/sql_erp emit_json_tags: true
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go