WIP: Compiled SQL function #33

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

View File

@@ -127,7 +127,7 @@ private fun ScriptPart.getParameterType(): NextScript<ParameterType> {
.apply { rest = nextScriptPart }
rest = rest.trimStart(' ', '\n', '\t', ')')
val isArray = rest.restOfScript.contains("[]")
val isArray = rest.restOfScript.contains("""\[[0-9]*]""".toRegex())
return NextScript(
ParameterType(

View File

@@ -381,6 +381,44 @@ class FunctionTest : FreeSpec({
param[2].direction shouldBe IN
}
}
"Parameters with type array multidimensional of text" - {
val param = parseFunction(
// language=PostgreSQL
"""
create or replace function myfun(one text[][]) language plpgsql as
$$ begin end;$$;
""".trimIndent()
).parameters
"should have parameter type is array" {
param[0].type.isArray shouldBe true
}
"should have parameter type name" {
param[0].type.name shouldBe "text"
}
}
"Parameters with type fixed size array" - {
val param = parseFunction(
// language=PostgreSQL
"""
create or replace function myfun(one text[45], two text[1][]) language plpgsql as
$$ begin end;$$;
""".trimIndent()
).parameters
"should have parameter type is array" {
param[0].type.isArray shouldBe true
param[1].type.isArray shouldBe true
}
"should have parameter type name" {
param[0].type.name shouldBe "text"
param[1].type.name shouldBe "text"
}
}
}
"Function Returns" - {