Comments (2)
🕊️ This isn't supported as the levenshtein
function requires the fuzzystrmatch
extension
https://www.postgresql.org/docs/current/fuzzystrmatch.html. There are too many extensions to PostgreSql for all to get added into the core.
🛠️ A way to support extension functions is to create a dialect that adds your function, here is an example https://github.com/griffio/sqldelight-custom-dialect.
You could add levenshtein
to the Custom Resolver as :
override fun functionType(functionExpr: SqlFunctionExpr): IntermediateType? {
return when (functionExpr.functionName.text.lowercase()) {
"levenshtein" -> IntermediateType(PrimitiveType.TEXT)
else -> typeResolver.functionType(functionExpr)
}
}
The query should work then
SELECT name FROM category
WHERE locale_code = :localeCode
AND levenshtein(name, :searchTerm) <= 3
ORDER BY levenshtein(name, :searchTerm);
Also note that CREATE EXTENSION
is only in the current snapshot #4541
from sqldelight.
Thank you! @griffio
Interesting that Plugin doesn't highlight with error line the unknown keyword.
from sqldelight.
Related Issues (20)
- Can't delete HOT 1
- Cannot convert the provided notation to an object of type Dependency HOT 2
- Table not created on desktop without awaiting the result of Schema.create HOT 3
- java.lang.IllegalStateException in SqliteParserUtil.kt:114
- Unable to run `ALTER TABLE <> DROP CONSTRAINT <> RESTRICT;` when using postgresql HOT 2
- AndroidSqliteDriver fails to create single Table when not In-memory
- java.util.NoSuchElementException in UpsertClauseMixin.kt:47
- Keywords as column name - generated code missing double quotes for INSERT statement HOT 6
- java.lang.RuntimeException in SqlDelightFileViewProviderFactory.kt:76
- java.lang.Throwable in SqlDelightFileViewProviderFactory.kt:91
- Kotlin Multiplatform build fails on macOS HOT 4
- Changes in the database are not observed when using a context other than Dispatchers.Main
- K2 Support HOT 1
- not able to create .sq file in kotlin multiplatfrom project HOT 2
- Cannot use a simple migration statement HOT 4
- SQLDelight Plugin does not work with Android Studio Koala HOT 18
- verify DB migration failure on windows for KMP project HOT 8
- R2dbcPreparedStatement parameters are incorrectly generated when tuple object substitution is used HOT 1
- java.lang.RuntimeException in SqlDelightGotoDeclarationHandler.kt:124
- Enable creation of a database interface with dependencies only, no .sq files
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.