On Mon, Oct 16, 2017 at 12:04 PM, David Storrs <david.sto...@gmail.com>
wrote:

> 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')),
>

You can also change your query, instead of the table, with something like:

(query-exec db "insert into files (..., ($1::text)::file_state, ...)" "OK")

that query now expects the client side to provide a text value for $1
(which the racket code is completely capable of); the server will handle
the cast from text to file_state for you. Similarly you can get data in
unsupported types from the database by adding a cast to text in your
selects.

-- 
Jay Kominek

-- 
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