On Mon, Mar 30, 2026 at 4:57 PM Peter Eisentraut <[email protected]> wrote:
>
>  From the v25 I have committed everything except 0001 and 0009.  I will
> continue reviewing the rest.
>

I’ve had a glance over the remaining patches; here are a few comments:

V25-0001:

-       if (relation->schemaname)
+       if (escontext == NULL)
            ereport(elevel,
-                   (errcode(ERRCODE_UNDEFINED_TABLE),
-                    errmsg("relation \"%s.%s\" does not exist",
-                           relation->schemaname, relation->relname)));
+                   errcode(ERRCODE_LOCK_NOT_AVAILABLE),
+                   relation->schemaname ?
+                   errmsg("relation \"%s.%s\" does not exist",
+                          relation->schemaname, relation->relname) :
+                   errmsg("relation \"%s\" does not exist",
+                          relation->relname));
        else
-           ereport(elevel,
-                   (errcode(ERRCODE_UNDEFINED_TABLE),
-                    errmsg("relation \"%s\" does not exist",
-                           relation->relname)));
+           ereturn(escontext, InvalidOid,
+                   errcode(ERRCODE_LOCK_NOT_AVAILABLE),
+                   relation->schemaname ?
+                   errmsg("relation \"%s.%s\" does not exist",
+                          relation->schemaname, relation->relname) :
+                   errmsg("relation \"%s\" does not exist",
+                          relation->relname));
    }

The error code changed here -- was this intentional?
--

v25-0009 :

+SELECT CAST('abc'::bpchar AS citext DEFAULT NULL ON CONVERSION ERROR); -- error
+ERROR:  cannot cast type character to citext when DEFAULT expression
is specified in CAST ... ON CONVERSION ERROR
+LINE 1: SELECT CAST('abc'::bpchar AS citext DEFAULT NULL ON CONVERSI...
+                    ^
+HINT:  Safe type cast for user-defined types are not yet supported.


"Should the HINT be this DETAIL? I believe a hint should provide
guidance for the user to handle the error, but here the user cannot do
anything with the given information.
--

 /* Generic macro for applying evaluate_expr */
-#define ece_evaluate_expr(node) \
+#define ece_evaluate_expr(node, escontext) \
    ((Node *) evaluate_expr((Expr *) (node), \
                            exprType((Node *) (node)), \
                            exprTypmod((Node *) (node)), \
-                           exprCollation((Node *) (node))))
+                           exprCollation((Node *) (node)), \
+                           escontext))


I think we can simply cast escontext to Node * here, instead of
having the caller do it.

Regards,
Amul


Reply via email to