-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[ORM] | Incompatible types when assigning to type ‘_option_string’ from type ‘string’ #19326
Comments
Is this is issue yet reproducible with latest version? |
Today I needed to do this relationship and I had the same problem. print of the set of structs. link for test: play |
It doesn't seem like a compilation error to me, but an internal error in V. (I could be very wrong). I recompiled V, with the following... However, when trying to compile an example code... result: Unhandled Exception 0xC0000005
25: v__ast__Scope_find ?? : address = 0x1a3d87ed750
24: v__ast__Scope_find_var ?? : address = 0x1a3d87ed780
23: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed7a0
22: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed6b0
21: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed7b0
20: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed7c0
19: v__checker__Checker_check_files ?? : address = 0x1a3d87ed740
18: v__checker__Checker_check_files ?? : address = 0x1a3d87ed660
17: v__checker__Checker_check_files ?? : address = 0x1a3d87ed5f0
16: v__checker__Checker_expr ?? : address = 0x1a3d87ed580
15: v__checker__Checker_check_files ?? : address = 0x1a3d87ed600
14: v__checker__Checker_check ?? : address = 0x1a3d87ed7f0
13: v__checker__Checker_check_files ?? : address = 0x1a3d87ed910
12: v__builder__Builder_middle_stages ?? : address = 0x1a3d87ed5a0
11: v__builder__Builder_front_and_middle_stages ?? : address = 0x1a3d87ed720
10: v__builder__cbuilder__gen_c ?? : address = 0x1a3d87ed8b0
9 : v__builder__cbuilder__build_c ?? : address = 0x1a3d87ed5c0
8 : v__builder__cbuilder__compile_c ?? : address = 0x1a3d87ed730
7 : v__builder__Builder_rebuild ?? : address = 0x1a3d87ed850
6 : v__builder__compile ?? : address = 0x1a3d87ed860
5 : v__builder__cbuilder__gen_c ?? : address = 0x1a3d87ed690
4 : v__builder__cbuilder__gen_c ?? : address = 0x1a3d87ed5e0
3 : wmain ?? : address = 0x1a3d87ed6a0
2 : __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
1 : BaseThreadInitThunk ?? : address = 0x1a3d87edb00
0 : RtlUserThreadStart ?? : address = 0x1a3d87edb20
signal 11: segmentation fault
32: print_backtrace ?? : address = 0x1a3d87ed6c0
31: log2f ?? : address = 0x1a3d87ed6d0
30: `__scrt_common_main_seh'::`1'::filt$0 D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:304
29: _C_specific_handler ?? : address = 0x1a3d87ed6f0
28: _chkstk ?? : address = 0x1a3d87ed700
27: RtlFindCharInUnicodeString ?? : address = 0x1a3d87ed880
26: KiUserExceptionDispatcher ?? : address = 0x1a3d87ed8f0
25: v__ast__Scope_find ?? : address = 0x1a3d87ed900
24: v__ast__Scope_find_var ?? : address = 0x1a3d87edb40
23: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed9e0
22: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87ed9b0
21: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87edd50
20: v__checker__Checker_support_lambda_expr_one_param ?? : address = 0x1a3d87edd70
19: v__checker__Checker_check_files ?? : address = 0x1a3d87edaa0
18: v__checker__Checker_check_files ?? : address = 0x1a3d87edc80
17: v__checker__Checker_check_files ?? : address = 0x1a3d87edbb0
16: v__checker__Checker_expr ?? : address = 0x1a3d87ed9a0
15: v__checker__Checker_check_files ?? : address = 0x1a3d87eda20
14: v__checker__Checker_check ?? : address = 0x1a3d87edbd0
13: v__checker__Checker_check_files ?? : address = 0x1a3d87edc30
12: v__builder__Builder_middle_stages ?? : address = 0x1a3d87eda30
11: v__builder__Builder_front_and_middle_stages ?? : address = 0x1a3d87edb10
10: v__builder__cbuilder__gen_c ?? : address = 0x1a3d87eda40
9 : v__builder__cbuilder__build_c ?? : address = 0x1a3d87eda50
8 : v__builder__cbuilder__compile_c ?? : address = 0x1a3d87eda70
7 : v__builder__Builder_rebuild ?? : address = 0x1a3d87edb50
6 : v__builder__compile ?? : address = 0x1a3d87edd40
5 : v__builder__cbuilder__gen_c ?? : address = 0x1a3d87edb70
4 : v__builder__cbuilder__gen_c ?? : address = 0x1a3d87edc50
3 : wmain ?? : address = 0x1a3d87edd30
2 : __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
1 : BaseThreadInitThunk ?? : address = 0x1a3d87edc60
0 : RtlUserThreadStart ?? : address = 0x1a3d87edd60 Something interesting is that it doesn't display -showcc, so I imagine it's something related to V itself. |
Is this still crashing for you on latest version? |
Before there was an error in cgen, but now it's partly ok! But it still doesn't work. https://vosca.dev/p/075dd2aa4d
|
I see no errors on my testing. Can you check again @Ddiidev ? |
...
data := Realtor{
first_name: 'John',
last_name: 'Doe',
creci: '12345678',
cnpj: '12345678901234',
cpf: '12345678901',
phone: '1234567890',
real_state: RealState{
name: 'Teste',
cnpj: '12345678901234',
address: Address{
street: 'Teste',
city: 'Teste',
state: 'Teste',
zip_code: 'Teste',
proximity: 'Teste',
},
}
}
sql db {
create table Address
create table RealState
create table Realtor
}!
sql db {
insert data into Realtor
}!
dump(sql db {
select from Realtor
}!) NOTICE: relation "Address" already exists, skipping
NOTICE: relation "RealStates" already exists, skipping
NOTICE: relation "Realtors" already exists, skipping
[teste.v:77] ast.SqlExpr: [Realtor{
id: Option('5a359520-fd26-4aca-8f28-1361d1c0db23')
first_name: 'John'
last_name: 'Doe'
creci: '12345678'
cnpj: Option('12345678901234')
cpf: Option('12345678901')
phone: '1234567890'
real_state: RealState{
id: ''
parent_id: 0
name: ''
cnpj: ''
address: Address{
id: 0
create_at: ''
update_at: ''
street: ''
city: ''
state: ''
zip_code: ''
proximity: ''
}
}
}] Now it's working perfectly, thank you and congratulations to those involved! 🥳 ✅ Sqlite |
Thanks for a detailed report :) |
Describe the bug
When trying to create tables in Postgres, some errors occurred when generating the C code.
Errors with option and an "else" placed in the wrong place.
If you need a postgres bank for testing, a good one is supabase, in 5 minutes you can get it lit
Reproduction Steps
I have the following relationship of structs via sql:
A bug occurred when compiling:
Expected Behavior
something like...
Current Behavior
Possible Solution
I don't know exactly how to solve it, but the "else" problem I believe it should look like this...
Rather than ...
I tested it and it "worked", the only thing missing were the bugs with the options:
Additional Information/Context
I've already tried using tcc, gcc and clang.
I can't do the test on Windows (my native OS) because I couldn't install Postgres at all, I've already read the README, downloaded and installed the Postgres installer, but it always gives an error stating that the 'libpq-' file is missing. fe.h', I downloaded the Postgres repo and added all the necessary files and it worked, but soon header files were missing that I couldn't find in the repo, since then I have only developed within WSL with Ubuntu.
V version
V 0.4.1 12dd6e8
Environment details (OS name and version, etc.)
V full version: V 0.4.1 45e6e7d.12dd6e8
OS: linux, Ubuntu 22.04.3 LTS (WSL 2)
Processor: 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
getwd: /mnt/c/Users/AndreLuiz/Documents/SourceApps/QRImovel/QRIMovel-backend
vexe: /home/andre_luiz/system/v/v
vexe mtime: 2023-09-09 23:52:49
vroot: OK, value: /home/andre_luiz/system/v
VMODULES: OK, value: /home/andre_luiz/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.34.1
Git vroot status: weekly.2023.33-138-g12dd6e8b (4 commit(s) behind V master)
.git/config present: true
CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
thirdparty/tcc status: Error: fatal: detected dubious ownership in repository at '/home/andre_luiz/system/v/thirdparty/tcc'
To add an exception for this directory, call:
Error: fatal: detected dubious ownership in repository at '/home/andre_luiz/system/v/thirdparty/tcc'
To add an exception for this directory, call:
The text was updated successfully, but these errors were encountered: