Skip to content

Commit

Permalink
Call quote_ident before nextval (#217)
Browse files Browse the repository at this point in the history
It turns out you can't do `nextval('FooBar_id_seq')` in PostgreSQL, you need to write `nextval('"FooBar_id_seq"')`.
  • Loading branch information
shane-circuithub committed Nov 22, 2022
1 parent ed4b5bb commit 42c1e1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
pkgs = import sources.nixpkgs {overlays = [];};
hsPkgs = import ./default.nix;
in
hsPkgs.shellFor {
Expand Down
3 changes: 2 additions & 1 deletion src/Rel8/Expr/Sequence.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import Prelude
import Rel8.Expr ( Expr )
import Rel8.Expr.Function ( function )
import Rel8.Expr.Serialize ( litExpr )
import Rel8.Expr.Text ( quoteIdent )

-- text
import Data.Text ( pack )


-- | See https://www.postgresql.org/docs/current/functions-sequence.html
nextval :: String -> Expr Int64
nextval = function "nextval" . litExpr . pack
nextval = function "nextval" . quoteIdent . litExpr . pack

0 comments on commit 42c1e1c

Please sign in to comment.