Fix permission checks and row_security checks for COPY