-- 35_expression_index_lower_email.sql
-- Banking Pattern Pack — PostgreSQL
-- Purpose: Expression index lower(email) for sign‑in.
-- Context: Retail bank example with customers, accounts, transactions, cards, loans.
-- Date: 2025-08-18
-- Notes:
--   * Safe to read; run on a development DB.
--   * Requires: CREATE privileges; some files may need superuser for extensions.
--   * Search path set to 'bank' schema for clarity.
SET search_path = bank, public;

-- Expression index for case‑insensitive email lookups
CREATE INDEX IF NOT EXISTS customers_email_lower_idx ON bank.customers (lower(email));
-- Query can use it:
-- SELECT * FROM bank.customers WHERE lower(email) = lower('asha@example.com');
