• H
    Support casts to/from string types for every datatype · d481bd72
    Haozhou Wang 提交于
    Backport below commits from upstream:
    
        commit 31edbadf
        Author: Tom Lane <tgl@sss.pgh.pa.us>
        Date:   Tue Jun 5 21:31:09 2007 +0000
    
            Downgrade implicit casts to text to be assignment-only, except for the ones
            from the other string-category types; this eliminates a lot of surprising
            interpretations that the parser could formerly make when there was no directly
            applicable operator.
    
            Create a general mechanism that supports casts to and from the standard string
            types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's
            I/O functions.  These new casts are assignment-only in the to-string direction,
            explicit-only in the other, and therefore should create no surprising behavior.
            Remove a bunch of thereby-obsoleted datatype-specific casting functions.
    
            The "general mechanism" is a new expression node type CoerceViaIO that can
            actually convert between *any* two datatypes if their external text
            representations are compatible.  This is more general than needed for the
            immediate feature, but might be useful in plpgsql or other places in future.
    
            This commit does nothing about the issue that applying the concatenation
            operator || to non-text types will now fail, often with strange error messages
            due to misinterpreting the operator as array concatenation.  Since it often
            (not always) worked before, we should either make it succeed or at least give
            a more user-friendly error; but details are still under debate.
    
            Peter Eisentraut and Tom Lane
    
        commit bf940763
        Author: Tom Lane <tgl@sss.pgh.pa.us>
        Date:   Tue Mar 27 23:21:12 2007 +0000
    
            Fix array coercion expressions to ensure that the correct volatility is
            seen by code inspecting the expression.  The best way to do this seems
            to be to drop the original representation as a function invocation, and
            instead make a special expression node type that represents applying
            the element-type coercion function to each array element.  In this way
            the element function is exposed and will be checked for volatility.
            Per report from Guillaume Smet.
    d481bd72
readfast.c 68.8 KB