def to_erd_type(pg_type, modifier):
    """Map from postgres-style datatypes to ERDplus-style."""
    if pg_type == 'int4':
        dataType, dataTypeSize = 'int', 4
    elif pg_type == 'int8':
        dataType, dataTypeSize = 'int', 8
    elif pg_type == 'date':
        dataType, dataTypeSize = 'date', None
    elif pg_type == 'varchar':
        dataType = 'varcharn'
        dataTypeSize = modifier
    elif pg_type == 'bpchar':
        dataType = 'charn'
        dataTypeSize = modifier
    else:
        dataType, dataTypeSize = 'custom', pg_type
    return dataType, dataTypeSize