Temp table created using schema.sql is not insertable.
Version
1.26.0
What happened?
Even though the table seems to be created, its not able to insert into that table saying that the schema 'table' is not found.
Relevant log output
schema not found
Database schema
No response
SQL queries
CREATE TEMP TABLE temp_table (LIKE prev_table include ALL) ON COMMIT DROP;
INSERT INTO temp_table (...) VALUES (...)
Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "db/query/"
schema: "db/migrations/"
gen:
go:
package: "db"
sql_package: "pgx/v5"
out: "db/sqlc"
emit_interface: true
emit_json_tags: true
emit_pointers_for_null_types: true
emit_result_struct_pointers: true
overrides:
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
@Jille created the issue here. Even removing the ON COMMIT DROP doesn't seem to work. How to put it in the same session?
I'm using the conn.Begin() to start the transaction.
If you're using a transaction you're in the same session by definition.
Can you share your code? Which call gives that error exactly?
Using sqlc generate itself is causing the error. Should the create temp table command not be in the same file as the rest of the sql query commands?