Migrated from halcyonnouveau/clorinde#92, originally reported by @KenAKAFrosty on 2025-04-16.
Not sure if this should even be considered a bug.
Possibly something to just mention in the docs or a FAQ.
If you have an enum type like CREATE TYPE badge AS ENUM ('staff', 'maintenance', 'guest', '') , where you have an empty string value as a valid part of the enum, expect to see this error when running the CLI if your queries return that column:
thread 'main' panicked at ...
Ident is not allowed to be empty; use Option<Ident>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Makes sense when you consider that the created Rust enum can't (and shouldn't) support an empty value inherently
One could argue that the type shouldn't contain the empty value, but instead allow for nullable columns where that type is used. I'm inclined to agree, but I'm short on a time machine to convince my old self of that 😅
Not a huge deal as I can work around this now that I know the issue. But if someone was dipping their toes into clorinde, and hit this kind of error, it may put them off. Would be a shame since they wouldn't get to see how awesome clorinde is!
Happy to hear thoughts on this. And I'm open to help with getting it somewhere in the docs if that's something we want!
Original discussion
@beanpuppy (2025-04-17):
Thanks for bringing this up. Having an empty string value in an enum doesn't seem like a very good idea, so I wouldn't really want to add support for this even if we could.
I'm not sure if we need to document it anywhere as I doubt many people would do something like this. But since it is technically valid postgres to do this, and we aim to have complete postgres support for every possible thing it could do, I can see how we might want it documented somewhere just for completeness and posterity.
We don't have a FAQ, but I'm not opposed to the idea of it, I don't know what else could be added to it though.
We could also have a "known limitations" document for things like this. Although the only other thing I can think of right now to add to it is halcyonnouveau#86, but there's probably more if I dug deeper and loosened my criteria for "limitation".
If it were just left to me, I'd probably leave it here and refer to this issue if anyone else comes and asks for it. But if you're really wanting to write some docs, you're free to open a PR with whatever you think is best.
Not sure if this should even be considered a bug.
Possibly something to just mention in the docs or a FAQ.
If you have an enum type like
CREATE TYPE badge AS ENUM ('staff', 'maintenance', 'guest', ''), where you have an empty string value as a valid part of the enum, expect to see this error when running the CLI if your queries return that column:Makes sense when you consider that the created Rust enum can't (and shouldn't) support an empty value inherently
Not a huge deal as I can work around this now that I know the issue. But if someone was dipping their toes into clorinde, and hit this kind of error, it may put them off. Would be a shame since they wouldn't get to see how awesome clorinde is!
Happy to hear thoughts on this. And I'm open to help with getting it somewhere in the docs if that's something we want!
Original discussion
@beanpuppy (2025-04-17):