79520690

Date: 2025-03-19 15:46:09
Score: 1.5
Natty:
Report link

How can we use typmod if the TYPMOD_IN function parses and returns the correct typmod, but the INPUT function always gets -1 from:

Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
which says:

        /*
         * For most types we pass typmod -1 to the input routine, because
         * existing input routines follow implicit-coercion semantics for
         * length checks, which is not always what we want here.  Any length
         * constraint will be applied later by our caller.  An exception
         * however is the INTERVAL type, for which we *must* pass the typmod
         * or it won't be able to obey the bizarre SQL-spec input rules. (Ugly
         * as sin, but so is this part of the spec...)
         */
        if (baseTypeId == INTERVALOID)
            inputTypeMod = baseTypeMod;
        else
            inputTypeMod = -1;
Reasons:
  • Blacklisted phrase (1): How can we
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): How can we use
  • Low reputation (1):
Posted by: chernia