You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
ENUM Type Fix - Execution Instructions
Problem
The database has PostgreSQL ENUM types, but Hibernate is configured to use VARCHAR with CHECK constraints. This causes the error:
ERROR: column "contract_nature" is of type ted.contract_nature but expression is of type character varying
Solution
Execute the fix-enum-types-comprehensive.sql script on the remote database.
Execution Methods
Option 1: Using psql (Recommended)
psql -h 94.130.218.54 -p 5432 -U postgres -d Sales -f fix-enum-types-comprehensive.sql
When prompted, enter password: PDmXRx0Rbk9OFOn9qO5Gm/mPCfqW8zwbZ+/YIU1lySc=
Option 2: Using psql with inline password (Windows PowerShell)
$env:PGPASSWORD="PDmXRx0Rbk9OFOn9qO5Gm/mPCfqW8zwbZ+/YIU1lySc="
psql -h 94.130.218.54 -p 5432 -U postgres -d Sales -f fix-enum-types-comprehensive.sql
Option 3: Copy-paste into database client
If you're using DBeaver, pgAdmin, or another GUI tool:
-
Connect to:
- Host:
94.130.218.54 - Port:
5432 - Database:
Sales - Username:
postgres - Password:
PDmXRx0Rbk9OFOn9qO5Gm/mPCfqW8zwbZ+/YIU1lySc=
- Host:
-
Open
fix-enum-types-comprehensive.sqlin the query editor -
Execute the entire script
What the script does
- ✅ Converts ENUM columns to VARCHAR(50) while preserving existing data
- ✅ Drops the old ENUM types
- ✅ Adds CHECK constraints for data validation
- ✅ Updates the search function to use VARCHAR parameters
- ✅ Shows verification query at the end
Verification
After execution, you should see:
status | column_name | data_type | character_maximum_length
---------------------------------------------|-----------------------|-------------------|--------------------------
ENUM types successfully converted to VARCHAR!| contract_nature | character varying | 50
ENUM types successfully converted to VARCHAR!| notice_type | character varying | 50
ENUM types successfully converted to VARCHAR!| procedure_type | character varying | 50
ENUM types successfully converted to VARCHAR!| vectorization_status | character varying | 50
After execution
Restart your Spring Boot application. The error should be resolved and the application will be able to insert data into the database.