sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

cannot debug endtoendtests because of compiler failure

Open akutschera opened this issue 3 years ago • 1 comments

Version

1.15.0

What happened?

When trying to debug an endtoend test (e.g. TestReplay) the compiler fails with internal compiler error: NewBulk too big: nbit=22255 count=1028433 nword=696 size=715789368 (of course the numbers vary). You can also reproduce this by going to directory internal/engine/postgresql and running go test -c -o /tmp/xx.__debug_bin -gcflags all=-N . This is a problem in the go compiler (see https://github.com/golang/go/issues/48375) which seems to happen when large slices or maps are generated. In our case that is https://github.com/kyleconroy/sqlc/blob/main/internal/engine/postgresql/pg_catalog.go which has gotten too big for the compiler since https://github.com/kyleconroy/sqlc/commit/8fa5272ea4a7648f27401f70fc816348519ab0fe The suggested workaround is to create the slice outside of the function.

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

akutschera avatar Sep 17 '22 11:09 akutschera

The attached PR will fix the compile problem. Unfortunately the code that I generate on my machine is different from the one in the repo, probably because I have a different postgresql-instance running. So I still need help re-generating the code (i.e. running sqlc-pg-gen agaings a 'correct' postgresql instance).

akutschera avatar Sep 17 '22 12:09 akutschera