Comments (3)
๐ป Looks like missing the type from SqlBinaryExpr
Can be fixed by adding UUID
and probably some more missing types but needs to have table interface tests
from sqldelight.
The only thing I would add is that the query above has a syntax error with the comma, that is not valid SQL so not sure how it ran -syntax error at or near "FROM"
Do you have other examples that show a compilation error?
someQuery:
SELECT some_table_1.id AS id,
some_table_2.id IS NOT NULL AS check_table_2,
some_table_3.id IS NOT NULL AS check_table_3,
some_table_4.id IS NOT NULL AS check_table_4, <-- Comma here is not valid in SQL
FROM some_table_1
LEFT JOIN some_table_2 ON some_table_2.id = some_table_1.id
LEFT JOIN some_table_3 ON some_table_3.id = some_table_1.id
LEFT JOIN some_table_4 ON some_table_4.id = some_table_1.id
WHERE some_table_1.id = :id;
from sqldelight.
Good catch. I hastily obfuscated my domain from the example and made a couple mistakes in the process. Here's a new example that I've tested demonstrates the issue:
Tables
CREATE TABLE companyRecord (
id UUID PRIMARY KEY,
name TEXT NOT NULL
);
CREATE TABLE companyAttributes (
id UUID PRIMARY KEY REFERENCES companyRecord,
slogan TEXT NOT NULL
);
Queries
testQuery1:
SELECT companyRecord.id,
companyRecord.name,
companyAttributes.slogan IS NOT NULL AS has_slogan
FROM companyRecord
LEFT JOIN companyAttributes ON companyAttributes.id = companyRecord.id
WHERE companyRecord.id = ?;
testQuery2:
SELECT companyRecord.id,
companyRecord.name,
companyAttributes.id IS NOT NULL AS has_attributes
FROM companyRecord
LEFT JOIN companyAttributes ON companyAttributes.id = companyRecord.id
WHERE companyRecord.id = ?;
testQuery1
compiles fine. testQuery2
fails to compile with this error:
> A failure occurred while executing app.cash.sqldelight.gradle.SqlDelightTask$GenerateInterfaces
> Failed to compile PostgreSqlCompoundSelectStmtImpl(COMPOUND_SELECT_STMT): [] :
SELECT companyRecord.id,
companyRecord.name,
companyAttributes.id IS NOT NULL AS has_attributes
FROM companyRecord
LEFT JOIN companyAttributes ON companyAttributes.id = companyRecord.id
WHERE companyRecord.id = ?
The error is not surfaced in IntelliJ through the SQLDelight pluginโit is only shown through compilation.
from sqldelight.
Related Issues (20)
- The query with LIMIT 1 is not emitting updates
- com.intellij.diagnostic.PluginException in RequiredPicturePathArgument.kt:-1
- com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments in CreateViewIntention.kt:39
- Idea Plugin doesn't recognize MySQL AUTO_INCREMENT
- java.lang.IllegalStateException in PostgreSqlTypeResolver.kt:191
- org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException in SqlDelightGotoDeclarationHandler.kt:124
- java.lang.RuntimeException in SqlDelightGotoDeclarationHandler.kt:124
- org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException in UnusedColumnInspection.kt:41
- Fatal Exception: co.touchlab.sqliter.interop.SQLiteExceptionErrorCode on IOS KMP
- Not generating parameters for `INSERT` function written in the `.sq` file after running `./gradlew generateCommonMainAppDatabaseInterface` HOT 2
- java.sql.SQLException: opening db: '<>.db': Operation not permitted
- SQLDelight plugin prevents the IDE from providing key IntelliJ features HOT 1
- java.util.NoSuchElementException in AlterTableAlterColumnMixin.kt:95
- java.util.NoSuchElementException in AlterTableRenameColumnMixin.kt:21
- java.lang.ClassCastException in InsertStmtValuesMixin.kt:61
- com.intellij.util.io.CorruptedException in SqlDelightGotoDeclarationHandler.kt:213
- java.io.IOException in SqlDelightGotoDeclarationHandler.kt:213
- java.lang.IllegalStateException in SqlDelightGotoDeclarationHandler.kt:124
- com.intellij.serviceContainer.AlreadyDisposedException in SqlDelightGotoDeclarationHandler.kt:124
- java.lang.Throwable in CopyAsSqliteAction.kt:38
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqldelight.