• Tom Lane's avatar
    Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS. · b81a9c2f
    Tom Lane authored
    LIKE INCLUDING DEFAULTS tried to copy the attrdef expression without
    copying the state of the attgenerated column.  This is in fact wrong,
    because GENERATED and DEFAULT expressions are not the same kind of animal;
    one can contain Vars and the other not.  We *must* copy attgenerated
    when we're copying the attrdef expression.  Rearrange the if-tests
    so that the expression is copied only when the correct one of
    INCLUDING DEFAULTS and INCLUDING GENERATED has been specified.
    
    Per private report from Manuel Rigger.
    
    Tom Lane and Peter Eisentraut
    b81a9c2f
create_table_like.out 16.3 KB