Not a critical issue, but the db package will not handle enums in
Postgres.  This is clear from the docs but I just now tripped over it
and thought I'd raise awareness.

Workaround:  make the field of type TEXT and then add a table constraint:
CONSTRAINT "files_current_state_cns" CHECK (current_state in
('INFO','NEW','COPYING','OK')),


Relevant walkthrough:

OSX 10.11.6 (15G1611)
PostgreSQL 9.6

create type file_state as enum ('INFO','NEW','COPYING','OK');
create table files ... "current_state" FILE_STATE NOT NULL ...;


psql -d biomantica
biomantica=# insert into files (..., current_state,...) values (..., 'OK', ...))
INSERT 0 1  ; insert succeeded

; from racket
(define db (postgresql-connect ...))
(query-exec db "delete from files")
(query db "insert into files (..., current_state, ...) values (...,'OK',...))

Exception: 'query-exec: unsupported type  typeid: 131721'


All of the ellided column names and values match up and were straight
copy/paste from psql into the racket command, so I have to assume the
issue is the file_state enum.  As mentioned above, you can create an
enum-by-another-name using a text field and a constraint.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to