# Implementation Tasks: Drop Procedure

**Branch**: `feat/plsql-functions` | **Date**: 2026-05-16

This file is a structured checklist of execution tasks generated by `/speckit.tasks` and consumed by `/speckit.implement`. 

## Task Execution Rules

1.  **Strict ordering**: Execute tasks sequentially. Do not proceed to the next task until the current one is complete, unless they are explicitly marked as parallelizable [P] and belong to the same phase.
2.  **No assumptions**: If a task relies on an undefined API or file, stop and ask the user for clarification.
3.  **Run tests**: After completing tasks within a phase, run relevant tests before moving on.
4.  **Mark completion**: As each task is finished, check the box (change `[ ]` to `[x]`).

## Dependencies & Execution Plan

- Phase 1: Setup - Foundational checks (no code changes needed, AST/Parser exists).
- Phase 2: US1 (Basic Deletion) - Implement core execution logic.
- Phase 3: US2 (Deletion with IF EXISTS) - Ensure idempotent execution logic.
- Phase 4: Integration - E2E tests for both scenarios.

Parallel execution opportunities: 
- Phase 2 and 3 can technically be implemented together in `src/executor/ddl.rs`.

---

## Phase 1: Setup

Goal: Verify the existing parser and AST state.

- [x] T001 [P] Verify `DropProcedureStatement` AST and parsing logic in `src/parser/ast.rs` and `src/parser/statements.rs`.
- [x] T002 [P] Verify `SystemCatalog::drop_procedure` or similar API exists (or needs creation) in the catalog/storage layer.

## Phase 2: US1 - Basic Deletion

Goal: Implement the ability to drop an existing procedure and return an error if it doesn't exist.

- [x] T003 [US1] Implement or update `execute_drop_procedure` in `src/executor/ddl.rs` to delete the procedure from `pg_proc` via the catalog.
- [x] T004 [US1] Add logic to return an "object not found" error if the procedure doesn't exist and `if_exists` is false.

## Phase 3: US2 - Deletion with IF EXISTS

Goal: Implement idempotent dropping.

- [x] T005 [US2] Update `execute_drop_procedure` in `src/executor/ddl.rs` to bypass the error and return success if the procedure doesn't exist but `if_exists` is true.

## Phase 4: Polish & Integration

Goal: Ensure end-to-end functionality via integration tests.

- [x] T006 [P] Add integration tests in `tests/procedure_tests.rs` for basic deletion.
- [x] T007 [P] Add integration tests in `tests/procedure_tests.rs` for dropping non-existent procedures (error case).
- [x] T008 [P] Add integration tests in `tests/procedure_tests.rs` for deletion with `IF EXISTS`.
- [x] T009 Run `make test` and `make lint` to verify all changes.
