Parameters with type fixed size array

This commit is contained in:
2023-06-02 22:29:25 +02:00
parent f228ec8da2
commit 5c37481368
2 changed files with 39 additions and 1 deletions

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" - {