This warning indicates your code uses a deprecated PostgreSQL feature. Update to the recommended modern alternative to ensure compatibility with future versions.
The 01P01 error code is a warning (not a failure) that PostgreSQL emits when your SQL code, stored procedures, or configuration uses a feature that has been marked as deprecated. PostgreSQL deprecates features that have been superseded by better alternatives or are considered insecure by modern standards. This is a proactive warning to help you identify code that will eventually stop working in future major PostgreSQL releases. The PostgreSQL Global Development Group typically maintains deprecated features for several major versions before removal, giving you time to migrate. Common deprecated features include MD5 password authentication (deprecated in PostgreSQL 18), certain configuration parameters, and older SQL syntax patterns. The warning belongs to class 01 (warning codes), which means your operation will still succeed, but you should address it to ensure long-term compatibility.
Check your PostgreSQL logs to see the full warning message:
# View recent PostgreSQL logs
sudo tail -n 100 /var/log/postgresql/postgresql-*.log | grep "01P01\|deprecated"The warning message will specify which feature triggered it. Common examples:
- "MD5 password support is deprecated"
- "Configuration parameter 'X' has been deprecated"
You can also query for MD5 passwords specifically:
-- Find roles still using MD5 passwords
SELECT rolname
FROM pg_authid
WHERE rolcanlogin = true
AND rolpassword LIKE 'md5%';Check the official PostgreSQL documentation for your version:
1. Visit the [Deprecated Features wiki page](https://wiki.postgresql.org/wiki/Deprecated_Features)
2. Check the [Obsolete or Renamed Features appendix](https://www.postgresql.org/docs/current/appendix-obsolete.html)
3. Review release notes for your PostgreSQL version
The documentation will indicate:
- Why the feature was deprecated
- What the recommended alternative is
- Timeline for removal (if specified)
For MD5 password deprecation (most common case):
-- Update postgresql.conf
-- Set password_encryption = 'scram-sha-256'
-- Then update each user's password
ALTER USER username WITH PASSWORD 'new_password';
-- This will now use SCRAM-SHA-256 automaticallyUpdate pg_hba.conf to use scram-sha-256:
# Change from:
host all all 0.0.0.0/0 md5
# To:
host all all 0.0.0.0/0 scram-sha-256Reload PostgreSQL configuration:
sudo systemctl reload postgresql
# Or via SQL:
SELECT pg_reload_conf();Verify that applications can still connect with the new authentication method:
# Test connection with psql
psql -h localhost -U username -d database_name
# Check for any deprecation warnings
psql -U postgres -c "SHOW password_encryption;"If using connection poolers (PgBouncer, pgpool), ensure they support SCRAM-SHA-256 authentication. Most modern versions do, but older versions may need updating.
Test all application connections to ensure compatibility:
- Web applications
- Background workers
- Backup scripts
- Monitoring tools
Once you've confirmed the new approach works:
1. Update all environments (dev, staging, production)
2. Update connection strings in application configuration
3. Document the changes for team members
4. Update deployment scripts and infrastructure-as-code
For CI/CD pipelines:
# GitHub Actions example
- name: Setup PostgreSQL
run: |
echo "password_encryption = scram-sha-256" >> postgresql.conf
psql -c "ALTER USER testuser WITH PASSWORD 'testpass';"PL/pgSQL Warning Code Handling
Note that PL/pgSQL does not recognize warning condition names like 'deprecated_feature'. If you're writing error handlers in PL/pgSQL, you must use the numeric code '01P01' instead:
BEGIN
-- Your code here
EXCEPTION
WHEN SQLSTATE '01P01' THEN
RAISE NOTICE 'Deprecated feature used';
END;This limitation exists because PL/pgSQL's mapping table only collects error codes (classes 03-XX), not warning codes (classes 00-02).
MD5 Removal Timeline
PostgreSQL has announced a phased removal plan for MD5 passwords:
- PostgreSQL 18 (current): Deprecation warnings emitted
- PostgreSQL 19 (expected): MD5 upgrades supported but no new MD5 passwords can be created
- PostgreSQL 20 (expected): MD5 authentication disabled
- PostgreSQL 21 (expected): Cannot upgrade with MD5 passwords
Security Context
MD5 password hashes are vulnerable to pass-the-hash attacks, where an attacker who obtains the hash can authenticate without knowing the actual password. This is why SCRAM-SHA-256 is strongly recommendedโit uses challenge-response authentication that doesn't transmit password hashes.
Client Library Compatibility
Before migrating to SCRAM-SHA-256, verify all client libraries support it:
- libpq 10+ (native C library)
- psycopg2 2.8+ (Python)
- pg (node-postgres) 7.12+ (Node.js)
- JDBC 42.2.0+ (Java)
- npgsql 3.2.7+ (.NET)
Older versions may need upgrading before you can switch authentication methods.
insufficient columns in unique constraint for partition key
How to fix "insufficient columns in unique constraint for partition key" in PostgreSQL
ERROR 42501: must be owner of table
How to fix "must be owner of table" in PostgreSQL
trigger cannot change partition destination
How to fix "Trigger cannot change partition destination" in PostgreSQL
vacuum failsafe triggered
How to fix "vacuum failsafe triggered" in PostgreSQL
ERROR: syntax error at end of input
Syntax error at end of input in PostgreSQL