WIP: Compiled SQL function #33

Draft
flecomte wants to merge 37 commits from compiled_sql_function into master
2 changed files with 20 additions and 1 deletions
Showing only changes of commit f4e88d385b - Show all commits

View File

@@ -94,7 +94,7 @@ private fun ScriptPart.getParameterMode(): NextScript<Direction> {
@Throws(ParameterNameMalformed::class)
private fun ScriptPart.getParameterName(): NextScript<String> {
try {
return getNextScript { afterBeginBy(" ", "\n") }
return getNextScript { afterBeginBy(" ", "\n") && status.isNotEscaped() }
} catch (e: ParseException) {
throw ParameterNameMalformed(this, e)
}

View File

@@ -135,6 +135,25 @@ class FunctionTest : FreeSpec({
}
}
"Escaped parameters name" - {
val param = parseFunction(
// language=PostgreSQL
"""
create or replace function myfun("one""or two" text, "#@€" int) returns text language plpgsql as
$$ begin end;$$;
""".trimIndent()
).parameters
"should have 2 parameters" {
param shouldHaveSize 2
}
"should have names" {
param[0].name shouldBe "one\"or two"
param[1].name shouldBe "#@€"
}
}
"Parameters with type `character varying(255)`" - {
val param = parseFunction(
// language=PostgreSQL