-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cozo 0.7.5 QueryException: required column alias not provided by input #9
Comments
OK after some experimentation, I found how to omit nullable columns from CozoScript {:create Core {id: Uuid default rand_uuid_v4() =>
name: String,
label: String,
alias: String? default default null,
notes: String? default '<NI>',
usage: String? default '<NI>',
description: String? default '<NI>' } Here the row = [{'name': 'foonam1', 'label': 'foolab1', 'notes': 'bar1'},
{'name': 'foonam2', 'label': 'foolab2', 'notes': 'bar2'}]
client.put('Core', row) Here is the important reference from documentation that seems to contradict my case.
But according to the error I described above you cannot omit any nullable column in the spec, unless it has a default value. Then it continues...
In the context of the specific paragraph, that is not clear and a bit confusing, what do you mean ? SummaryIn the current implementation of CozoScript 0.7.5 it should become clear in the documentation when a column is required e.g.:
if that is not the intended behavior then it should be fixed in the code PS: It is also confusing that instead of having a |
Hi, in the relation
Core
with headingthe following row is inserted
Notice that
alias
is of typestring?
(nullable), the default value has not been specified and in the row dictionary that key is omitted.In that case, inserting the row above fails and CozoScript produces the following error message
QueryException: required column alias not provided by input
But the
alias
field is nullable, so one would expect that if this column is not present in the input it will automatically take the null value. Well at least this is the case with SQLinsert
command. If a column allows NULL values and has no NOT NULL constraint, then it can be omitted from theinsert
values. Why is that different with CozoScript ?Now if I try to insert the same row but with the
alias
key in the dictionary, that succeeds and I am getting anOK
status.Here is the database after the insertion of these two rows
This screen capture shows that if you specify nullable columns that have a default value, let's say
<NI>
these can be omitted from theput
command.The question that arises here is how you can omit a nullable column from the
put
when there is not a default value.The text was updated successfully, but these errors were encountered: