From bc81ae0862c93da77448db613694a589e3decf6b Mon Sep 17 00:00:00 2001 From: Christian Himpe Date: Wed, 20 Nov 2024 08:19:17 +0100 Subject: [PATCH] fix: return value of CREATE PROPERTY for DEFAULT attribute --- .../sql/parser/CreatePropertyAttributeStatement.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/src/main/java/com/arcadedb/query/sql/parser/CreatePropertyAttributeStatement.java b/engine/src/main/java/com/arcadedb/query/sql/parser/CreatePropertyAttributeStatement.java index 7c0934e44..ad241af40 100644 --- a/engine/src/main/java/com/arcadedb/query/sql/parser/CreatePropertyAttributeStatement.java +++ b/engine/src/main/java/com/arcadedb/query/sql/parser/CreatePropertyAttributeStatement.java @@ -53,7 +53,15 @@ public CreatePropertyAttributeStatement copy() { public Object setOnProperty(final Property internalProp, final CommandContext context) { final String attrName = settingName.getStringValue(); - final Object attrValue = this.settingValue == null ? true : this.settingValue.execute((Identifiable) null, context); + final Object attrValue; + if (this.settingValue == null) { + attrValue = true; + } else if (attrName.equalsIgnoreCase("default")) { + attrValue = this.settingValue.toString(); + } else { + attrValue = this.settingValue.execute((Identifiable) null, context); + } + try { if (attrName.equalsIgnoreCase("readonly")) { internalProp.setReadonly((boolean) attrValue); @@ -68,7 +76,7 @@ public Object setOnProperty(final Property internalProp, final CommandContext co } else if (attrName.equalsIgnoreCase("default")) { if (this.settingValue == null) throw new CommandExecutionException("Default value not set"); - internalProp.setDefaultValue(this.settingValue.toString()); + internalProp.setDefaultValue("" + attrValue); } else if (attrName.equalsIgnoreCase("regexp")) { internalProp.setRegexp("" + attrValue); } else {