mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
Show failing row in check constraint error
This commit is contained in:
parent
acf0ce5c9a
commit
dd2cac29d0
@ -315,7 +315,15 @@ insertPermsCheck tn insertResult cond sw =
|
||||
(S.SEFunction
|
||||
(S.FunctionExp
|
||||
(QualifiedObject (SchemaName "hdb_catalog") (FunctionName "check_violation"))
|
||||
(S.FunctionArgs [] mempty)
|
||||
(S.FunctionArgs
|
||||
[ S.SEOpApp (S.SQLOp " || ")
|
||||
[ S.SELit "The record "
|
||||
, S.SETyAnn (S.SERowIden insertResult) (S.TypeAnn "text")
|
||||
, S.SELit " does not satisfy the check constraint."
|
||||
]
|
||||
]
|
||||
mempty
|
||||
)
|
||||
Nothing)
|
||||
)
|
||||
] Nothing)
|
||||
|
@ -663,9 +663,9 @@ CREATE VIEW hdb_catalog.hdb_computed_field_function AS
|
||||
FROM hdb_catalog.hdb_computed_field
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION hdb_catalog.check_violation() RETURNS bool AS
|
||||
CREATE OR REPLACE FUNCTION hdb_catalog.check_violation(msg text) RETURNS bool AS
|
||||
$$
|
||||
BEGIN
|
||||
RAISE check_violation USING message='insert check constraint failed';
|
||||
RAISE check_violation USING message=msg;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
@ -1,6 +1,6 @@
|
||||
CREATE OR REPLACE FUNCTION hdb_catalog.check_violation() RETURNS bool AS
|
||||
CREATE OR REPLACE FUNCTION hdb_catalog.check_violation(msg text) RETURNS bool AS
|
||||
$$
|
||||
BEGIN
|
||||
RAISE check_violation USING message='insert check constraint failed';
|
||||
RAISE check_violation USING message=msg;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
Loading…
Reference in New Issue
Block a user