You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Statements that cannot parse the column name can be executed, and the type cannot be inferred after changing the name of $2
Relevant log output
# package commcarddb
queries/commcard/commcard.sql:1:1: could not determine data type of parameter $2
Database schema
CREATETABLEpublic.solar_commcard_mapping (
id integerNOT NULL,
"deviceId"integerNOT NULL,
version character varying(32) DEFAULT ''::character varying NOT NULL,
sn character varying(32) DEFAULT ''::character varying NOT NULL,
"createdAt"timestamp with time zone DEFAULT now(),
"updatedAt"timestamp with time zone DEFAULT now()
);
SQL queries
This will work, but $2 won't resolve the column name-- name: InsertMappping :batchexec WITH table1 AS( SELECT "version" from solar_commcard_mapping where "deviceId" = $1 order by "updatedAt" desc limit 1)INSERT INTO solar_commcard_mapping("deviceId", "version", "sn","updatedAt")SELECT $1,$2::text,$3,$4 WHERE not exists(SELECT * from table1 where table1."version" = $2::text) or not exists (select * from table1) ;
package commcarddb
queries/commcard/commcard.sql:1:1: could not determine data type of parameter $2
WITH table1 AS
(
SELECT "version" from solar_commcard_mapping where "deviceId" = $1 order by "updatedAt" desc limit 1
)
INSERT INTO solar_commcard_mapping("deviceId", "version", "sn","updatedAt")
SELECT $1,@version::text,$3,$4 WHERE not exists(SELECT * from table1 where table1."version" = @version::text) or not exists (select * from table1) ;
* test: Add case for #2132
* test: Add case for #2152
* test: Mark case for #2152
* test: Add case for #2187
* test: Add case for #2226
* test: Add case for #2364
* test: Add case for #2386
* test: Add case for #2538
* test: Add case for #2644
* test: Add case for #2731
Uh oh!
There was an error while loading. Please reload this page.
Version
1.16.0
What happened?
Statements that cannot parse the column name can be executed, and the type cannot be inferred after changing the name of $2
Relevant log output
Database schema
SQL queries
package commcarddb
queries/commcard/commcard.sql:1:1: could not determine data type of parameter $2
Configuration
Playground URL
https://play.sqlc.dev/p/5fbfef02281fb67691c3cec9b2d084e5fde4329dcef538c7c84013fb2be45663
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: