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

java.lang.NullPointerException in ALTER PROPERTY #8763

Closed
askorohod opened this issue Feb 11, 2019 · 3 comments
Closed

java.lang.NullPointerException in ALTER PROPERTY #8763

askorohod opened this issue Feb 11, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@askorohod
Copy link

OrientDB Version: 3.0.12

Java Version: OpenJDK 64-Bit Server VM 18.9

OS: CentOS Linux release 7.2.1511

Expected behavior

Property type is altered

Actual behavior

java.lang.NullPointerException

Steps to reproduce

Create a class X with property y of type STRING
Enter ALTER PROPERTY X.Y TYPE LINK in Studio
The response is a java.lang.NullPointerException

@luigidellaquila luigidellaquila self-assigned this Feb 11, 2019
luigidellaquila added a commit that referenced this issue Feb 14, 2019
@luigidellaquila
Copy link
Member

Hi @askorohod

I just pushed a fix that solves the NPE, but please consider that changing the type of a property in most cases is not allowed (ie. if there is no natural way to convert from the old type to the new one, eg. from INTEGER to LONG)

Thanks

Luigi

@askorohod
Copy link
Author

askorohod commented Feb 14, 2019

Hi @luigidellaquila,
First of all thank you for the quick fix.
I have to disagree with you though on your comment. The ALTER TABLE name ALTER COLUMN column_name SET DATA TYPE data_type is SQL standard and is supported by every SQL DB if the table is empty (otherwise the only solution would be drop the table and re-create). Additionally a lot of SQL DBs support the extension USING in which you can specify how to migrate the data from old type to new type. Incidentally re-typing to a "bigger" type (e.g. INTEGER to LONG) does not require the USING clause at all and will be executed on tables with data (though locking the whole table in the process).
But nevertheless thanks for the quick fix.

Alex

@luigidellaquila
Copy link
Member

Hi @askorohod

I agree with you, technically speaking it's possible, but right now the implementation is like that, so that's the behaviour you will see for now

Thanks

Luigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants