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
SELECTCOUNT(*)
FROM some_table
WHERE
CASE
WHEN :username IS NULL THEN 1=1 ELSE username = :username
END
The following exception is thrown during code generation:
org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2267)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:312)
at org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData(PgPreparedStatement.java:1585)
at norm.analyzer.SqlAnalyzer.sqlModel(SqlAnalyzer.kt:23)
at norm.api.NormApi.generate(NormApi.kt:22)
at norm.cli.NormCli$run$1$2$1.invoke(NormCli.kt:80)
at norm.cli.NormCli$run$1$2$1.invoke(NormCli.kt:28)
at norm.fs.IO.process(IO.kt:22)
at norm.cli.NormCli$run$1.invoke(NormCli.kt:80)
at norm.cli.NormCli$run$1.invoke(NormCli.kt:28)
at norm.util.PGKt.withPGConnection(PG.kt:14)
at norm.cli.NormCli.run(NormCli.kt:68)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:168)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:258)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:255)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:273)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:298)
at norm.cli.NormCliKt.main(NormCli.kt:20)
Possible workaround (for postgres) - cast the parameter in the query
SELECTCOUNT(*)
FROM some_table
WHERE
CASE
WHEN CAST(:username ASVARCHAR) IS NULL THEN 1=1 ELSE username = CAST(:username ASVARCHAR)
END
The text was updated successfully, but these errors were encountered:
Consider the query
The following exception is thrown during code generation:
Possible workaround (for postgres) - cast the parameter in the query
The text was updated successfully, but these errors were encountered: