Uses CREATE DATABASE ... TEMPLATE to create a duplicate of a database. Additionally copies over database-specific
    settings.

    When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of
    place in the form DEST_old_YYYYMMDD (unless --no-backup is specified).

def cmd_copy():
    """Uses CREATE DATABASE ... TEMPLATE to create a duplicate of a database. Additionally copies over database-specific
    settings.

    When used with --force, an existing database with the same name as DEST is replaced, the original is renamed out of
    place in the form DEST_old_YYYYMMDD (unless --no-backup is specified).
    """
    db = connect()

    if args.force and db_exists(db, args.dest):
        tmp_db = generate_alt_dbname(db, args.dest, 'tmp')
        pg_copy(db, args.src, tmp_db)

        pg_move_extended(db, tmp_db, args.dest)

    else:
        pg_copy(db, args.src, args.dest)