Every database offers wide range of built-in functions to operate with data and to make your development tasks faster. This chapter catalogues all such frequently and commonly used built-in functions and what changes you need to take while migrating from Oracle to PostgreSQL.
During database migration, built-in functions play a crucial role and must be handled correctly. You typically encounter 3 types of behaviourally changes with respect to functions.
- Similar Functions – These are the functions which exist in both Oracle and PostgreSQL database. The name and operations are also same in both the databases. From a migration perspective you need no or minimal effort to convert these functions.
- Dissimilar Functions – Functions which exist in either Oracle or PostgreSQL database fall into this category. There might be a situation that function have same behavior, operations in both databases, but have different names. Sometimes you might need to write custom code to handle cases where function exist in Oracle but not in PostgreSQL.
- Inconsistent Functions – These are the functions which exist in both Oracle and PostgreSQL database, but are behaviourally different. These functions are very important consideration in a migration, as you may assume since function exist in both the databases, the way they operate are also same. This is the reason you must understand and remember the behaviourally changes.
Built-in function | Handled In |
---|---|
UPPER | Similar Function |
LOWER | Similar Function |
INITCAP | Similar Function |
LENGTH | Inconsistent Function |
CONCAT | Inconsistent Function |
SUBSTR | Dissimilar Function |
INSTR | Dissimilar Function |
LTRIM | |
RTRIM | |
TRIM | |
LPAD | |
RPAD | |
REPLACE | |
TRANSALTE | |
CHR | |
ASCII | |
SOUNDEX | |
COALESCE |