Replies: 1 comment
-
|
bump |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
9.17. Sequence Manipulation Functions in the Postgres docs state that
nextvalreturns abigint, which matches with Rel8'snextval :: QualifiedName -> Expr Int64. However, the CREATE SEQUENCE page states:To me, this means the type of
nextvalis dependent on the sequence it's accessing. Similar toDEFAULT, that's probably not very useful for Rel8. But it is confusing: the codebase I'm poking at has manynextvalfunctions likefooIdNextval = coerce (Rel8.nextval "foo_id_seq"). Sometimes they're coercing through both a newtype andExpr's phantom typevar at the same time. (Should Rel8 even permitcoerceExpr :: Expr a -> Expr b; coerceExpr = coerce? It does. Note the lack ofCoercible!)I think this is especially relevant because the
serialpseudo-type often used together withnextvalcorresponds to anInt32, but currently to use them together in Rel8 a user mustcoercedown fromInt64. (I think this may have been a source of confusion in our codebase: there is a mix ofInt32andInt64IDs that useserialin the table schema, whereInt32is surely more correct. It definitely confused me, heh.)I don't really have an answer in mind or a specific request. (I'm also new to Rel8 and SQL in general.) Has anyone else felt this issue? Is there something I'm missing? I think a
newtype PostgresSerialand a few nextval helpers would help us stay consistent, but I wonder if there's a library-level solution too.Beta Was this translation helpful? Give feedback.
All reactions