mmottl / postgresql-ocaml

OCaml-bindings for the PostgreSQL database
Other
141 stars 23 forks source link

Crashes when using a uuid column #20

Closed sgrove closed 5 years ago

sgrove commented 7 years ago

Simpley doing print_endline ("field type: " ^ string_of_field_type (r#ftype 0)); seems to cause my ocaml program to exit (with code 0 and output of Postgresql.Oid(2950), which is the uuid oid) when run against a query that returns a uuid column. I noticed uuid is not one of the types included in http://mmottl.github.io/postgresql-ocaml/api/Postgresql.html#TYPEftype - is there any way around this? Uuid are fairly critical to my use case, and it's important that they be stored as such for other consumers of the db.

mmottl commented 7 years ago

I'm surprised that your program exits with code 0. Raising an exception should usually give you an error code. Maybe this is due to the way your user program handles exceptions.

Anyway, please feel free to submit a pull request to add any additional ftypes you need. It's really easy: just add them to the C-stubs first, making sure to #define the required macros near the beginning of the source. For consistency, please make sure to add them in the related numerical order. Then you add the tag in the right order to the oid_tbl in the C-stubs. Finally, add the new tags to ftype in postgresql.mli and postgresql.ml in exactly the same place as you did for oid_tbl, update the string conversion functions, and you are done.

mmottl commented 5 years ago

This issue may not exist anymore or bother anyone. Closing...