Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEFAULT with function call only works with ALTER PROPERTY #1609

Closed
TimMensch opened this issue May 20, 2024 · 5 comments
Closed

DEFAULT with function call only works with ALTER PROPERTY #1609

TimMensch opened this issue May 20, 2024 · 5 comments
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@TimMensch
Copy link

TimMensch commented May 20, 2024

ArcadeDB Version:

v24.4.1 (build c714a4f5c827d742d6edd0f7788fe049bc63607b/1713579699346/main)

OS and JDK Version:

Running on Linux 5.15.146.1-microsoft-standard-WSL2 - OpenJDK 64-Bit Server VM 11.0.22 (Temurin-11.0.22+7)

Expected behavior

Setting DEFAULT sysdate() during create should be identical to adding DEFAULT sysdate() during ALTER PROPERTY.

Actual behavior

When I say:

CREATE VERTEX TYPE Test;
CREATE PROPERTY Test.createdAt IF NOT EXISTS DATETIME (mandatory true, readonly, DEFAULT sysdate());
CREATE VERTEX Test; -- Wait a couple of seconds
CREATE VERTEX Test; -- Wait a couple of seconds 
CREATE VERTEX Test;

The three vertices all have the same createdAt field. Whereas if I say:

ALTER PROPERTY Test.createdAt DEFAULT sysdate();

Then

CREATE VERTEX Test;  -- Wait a couple of seconds
CREATE VERTEX Test;  -- Wait a couple of seconds
CREATE VERTEX Test;

...creates vertices with three unique timestamps.

I'm using the Docker Hub image version 24.4.1.

Originally posted by @TimMensch in #905 (comment)

@gramian
Copy link
Collaborator

gramian commented May 20, 2024

Hmm, I can reproduce this. It seems the timestamp in the first case is the creation date of the property, not the vertex.

Could you try:

CREATE PROPERTY Test.createdAt IF NOT EXISTS DATETIME (mandatory true, readonly, DEFAULT `sysdate()`);

this seems to work for me.

@TimMensch
Copy link
Author

OK, sure, that works. Thanks.

@lvca
Copy link
Contributor

lvca commented May 21, 2024

I guess the docs are not clear on this point. I found this example that is misleading:

ArcadeDB> CREATE PROPERTY Employee.hiredAt DATETIME (readonly, default sysdate('YYYY-MM-DD HH:MM:SS'))

@lvca lvca added this to the 24.5.1 milestone May 21, 2024
@lvca lvca added documentation Improvements or additions to documentation and removed workaround-provided labels May 21, 2024
@lvca
Copy link
Contributor

lvca commented May 21, 2024

Ok, I haven't seen this from @gramian #1611. Now it should be fixed.

@lvca lvca closed this as completed May 21, 2024
@lvca lvca added bug Something isn't working fixed and removed documentation Improvements or additions to documentation labels May 21, 2024
@gramian gramian reopened this Oct 30, 2024
@gramian gramian closed this as completed Oct 30, 2024
@gramian
Copy link
Collaborator

gramian commented Oct 30, 2024

Sorry false alarm, but there is something related not right I cannot yet pin down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants