orafce compatibility functions for PostgreSQL: when a migration team needs them
orafce is an open-source PostgreSQL module that implements some Oracle database functions that PostgreSQL lacks or handles differently. Migration teams add it when an Oracle application calls those functions in many places, and rewriting every call to a PostgreSQL equivalent would cost more than the migration can absorb. Installing the module lets the application keep calling familiar function names while the database moves underneath it. The project describes itself as useful for production work, so the question for most teams is not whether it is usable but which of their calls it covers and where its behavior still differs from Oracle.
orafce is one part of a migration, not the whole of it. Schema objects, data types, PL/SQL procedures and application SQL still need conversion, and the schema and code conversion tool Ora2Pg is usually the starting point for that work outside this module. Treat orafce as a compatibility layer that sits beside the converted code, and plan the two together so that each emulated function has a named owner, a test case and a documented difference. Confirm the exact function and package list for the orafce version you intend to install against the project's own documentation, since coverage changes between releases.
Managed services are another signal worth checking before you commit. orafce is supported in AWS Aurora with PostgreSQL compatibility and in Azure Database for PostgreSQL, so a team that expects to move between self-hosted and managed PostgreSQL later can verify that the same module is available on both. For a self-hosted deployment, confirm the orafce version matches your PostgreSQL major version before installation and again during each planned major upgrade, and ask your team to run the application's Oracle-dependent test suite against the emulated functions rather than assuming parity.
Which Oracle functions and packages orafce emulates
orafce covers a set of Oracle functions and packages that PostgreSQL lacks or handles differently, so application SQL and PL/SQL-style code can run with fewer edits. The cards below describe the categories the project addresses, the production statement it makes, and the checks to run against your own Oracle inventory before you rely on it.
Function categories in the repository
The orafce project implements in PostgreSQL some of the Oracle database functions that are missing or behave differently. Read the current function list in the repository and sort it into the categories your applications actually call, such as string, date and numeric helpers. Do not assume a function exists because a neighboring one does. Confirm each name and signature against the release you plan to install.
orafce repositoryOracle packages and their coverage
Some Oracle packages are emulated in part, and the coverage may not match the procedures your code calls. Build a list of every package and procedure referenced in your schema objects, batch jobs and application code. Mark each one as fully covered, partly covered or absent. Packages with partial coverage usually need a test plan of their own.
Production use statement
The project states that the module is useful for production work. That statement describes the project's intent, not a guarantee for your workload. Ask the team that owns your migration to record which emulated functions run in production paths, and to decide whether the project's stated use is enough for each one or whether extra testing is required.
Behavior differences from Oracle
An emulated function can still return different results from Oracle in edge cases, such as null handling, date arithmetic, rounding, character sets and empty string treatment. Compare outputs from Oracle and PostgreSQL on the same sample data for every function in your inventory. Record each difference and decide whether the application logic changes or the difference is accepted.
Check against your SQL inventory
Run a query or static scan over your Oracle code to count calls to each function and package, grouped by application. Compare that list with the repository's current function list. Functions with no match need either a rewrite into native PostgreSQL or a custom implementation, and that work should be scoped before the migration plan is fixed.
Managed service support
orafce is supported in AWS Aurora with PostgreSQL compatibility and in Azure Database for PostgreSQL. If you run self-hosted PostgreSQL, you install and version the extension yourself. Confirm the extension's version support for the PostgreSQL major you target, and plan to retest emulated functions after each major upgrade.
orafce repositoryConfiguration decisions before installing orafce
This table compares the four main decisions to settle before orafce goes into a database: where it is installed, whether Oracle-named calls stay, how widely it is adopted, and how its version is pinned. Read each row as a choice with a fit condition, then confirm the listed points with the project and your own test results before the first production change.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Installation scope | Install globally in each database that needs it | Oracle-style names are available everywhere, so unrelated schemas can pick them up by accident | Single-application databases where the whole schema is part of the migration |
| Installation scope | Install per schema or into a dedicated schema | Search path and grants need deliberate design, and more setup per schema | Shared databases with several applications or tenants |
| Call style | Keep Oracle-named calls unchanged | Fastest path for the migration, but the code keeps an Oracle vocabulary and a dependency on the extension | Early phases, where the goal is getting the workload running and then measuring |
| Call style | Rewrite calls to native PostgreSQL | More effort per call site, and no runtime dependency on orafce | Long-lived systems, or where the team wants to remove the extension later |
| Adoption breadth | Use orafce across all call sites | Consistent behavior, but every emulated function becomes a system you must test | Migrations with broad Oracle-specific SQL and PL/SQL usage |
| Adoption breadth | Use orafce only for identified hot spots | Smaller test surface, but teams must track which code paths depend on it | Migrations where Ora2Pg conversion already handles most code |
| Version pinning | Pin the orafce release to the PostgreSQL major in use | Each PostgreSQL major upgrade can require a matching extension version and a retest | Any environment, since upgrades must include the extension |
| Confirm with the project | Supported PostgreSQL majors, build requirements and behavior notes for each release | Documentation may differ from your build, so verify in a staging environment | Before every install, upgrade and managed-service deployment |
How the orafce rollout sequence runs
The sequence moves orafce from a single test instance to production in an ordered way, so every Oracle-dependent call is found, converted, compared and signed off before the application depends on it. Each step produces a named artifact that the next step consumes.
Inventory Oracle-specific calls in code
The application team and the database team search application code, stored procedures, views, triggers and scheduled jobs for Oracle-specific functions and packages, such as DBMS_OUTPUT, NVL2, TO_CHAR format masks, sequences used as defaults and package calls. The output is an inventory list that records each call, its location, the module that owns it and whether orafce is expected to cover it. The step is done when the list is reviewed by both teams and every object in the source schema is either listed or confirmed as needing no change. Ask the migration vendor or your own engineers to confirm the search covers dynamic SQL built in application code, since static searches miss it.
Run Ora2Pg schema and code conversion
The database team runs Ora2Pg against the Oracle source to produce PostgreSQL DDL, data type mappings and converted PL/SQL where Ora2Pg has a rule for it. The output is a conversion report plus generated SQL files kept in version control, with the report listing objects Ora2Pg could not convert or converted with warnings. The step is done when the report is triaged against the inventory from the previous step, so each unconverted or flagged object has an owner and a next action. Keep the conversion settings file under version control so the run can be repeated during later rehearsals.
Install and version-match orafce on test
The platform team installs orafce on a non-production PostgreSQL instance that runs the same major version as the target production cluster, and creates the extension in the schema the converted code expects. The output is a recorded installation with the orafce version and PostgreSQL version written into the migration runbook. The step is done when the extension loads, the expected functions and packages are visible, and the installed version is checked against the PostgreSQL major you plan to run in production. Confirm the orafce release you choose against the project's compatibility notes in its repository, because support depends on the pairing.
Run behavior comparison on representative data
The QA team runs the same inputs through the Oracle source and the PostgreSQL target, using a representative data set that includes NULL values, empty strings, date boundaries, time zones, numeric precision edges and character set cases. The output is a difference log that records each query, the Oracle result, the PostgreSQL result and the reason for any mismatch. The step is done when every inventoried call has at least one comparison result, and when the team has agreed which differences are acceptable and which must be fixed. Use real-world volumes where you can, because edge cases in small samples can hide differences.
Fix differences and retest
Developers and DBAs resolve each item in the difference log, either by changing application code to match the PostgreSQL behavior, by adjusting converted SQL, or by writing a documented wrapper where orafce does not match Oracle closely enough. The output is a revised code set, an updated difference log showing the resolution for each item, and a retest run. The step is done when the retest produces no open items that the business owner has not accepted in writing. Record every accepted difference in the runbook so that application owners know the behavior they are relying on.
Obtain signed-off test result
The application owner, the database owner and the security or compliance reviewer review the final difference log, the conversion report and the retest results together. The output is a signed-off test result that names the orafce and PostgreSQL versions tested, the data set used and the accepted differences. The step is done when the sign-off is stored with the release record, so an auditor or a future upgrade team can see what was tested and why. Re-open this sign-off whenever orafce or PostgreSQL is upgraded, because the earlier result applies only to the tested pairing.
Promote through environments in order
The release team deploys the same converted code and the same orafce version through staging, pre-production and production, in that order, with the extension installed by a repeatable script rather than by hand. The output is a deployment record for each environment and a post-deployment comparison on a sample of live-like queries. The step is done when staging and production report the same extension version and the production smoke tests match the signed-off results. Keep a documented rollback path for the application and database changes, and confirm with your platform provider how orafce is handled in managed services you run alongside self-hosted instances.
Where orafce behavior still differs from Oracle
Function names do not prove behavior. orafce implements some Oracle functions that are missing from PostgreSQL or behave differently there, but the emulation is not a drop-in copy of Oracle, so every function and package your application calls needs its own test cases taken from your Oracle system. Start by exporting the outputs of representative calls from the source database, including edge inputs, and replay them against the PostgreSQL target. Treat any mismatch as a defect to resolve before cutover, not a detail to document and move on from.
The differences most likely to surface are in null and empty string handling, date and number formatting, and session state. Oracle's treatment of empty strings as null is a long-standing source of divergence, so confirm how each emulated function handles null, empty and whitespace-only inputs in your data. Date and number formatting depends on session settings such as NLS parameters in Oracle and locale and format settings in PostgreSQL, so test the same value under the session configuration your application actually uses. Packages that hold state across calls, such as package variables, depend on how your connection pool reuses sessions, which makes pooled session state one of the first things to check with PgBouncer in place.
Error codes, exception behavior and transaction semantics need the same scrutiny. Application code that catches a specific Oracle error number or relies on a particular exception type will break if the PostgreSQL side raises a different SQLSTATE or rolls back at another point. Test error paths deliberately, including raised exceptions inside procedures, and confirm what is committed when a call fails partway through. Record the results in a compatibility register that names each function, the Oracle behavior, the observed PostgreSQL behavior and the decision taken, and confirm the orafce version and PostgreSQL major version you tested against in the orafce repository release notes before you rely on the register.
What drives orafce migration effort and cost
This table lists the factors that raise or lower the effort of moving Oracle-dependent code to PostgreSQL with orafce in place, and what to ask for in a quote. Read each row as a question to answer about your own estimate before comparing partner proposals. The main takeaway is that the count of Oracle-specific call sites and package dependencies usually matters more than the orafce install itself.
| Driver | Effect on effort and cost | What to ask for in a quote |
|---|---|---|
| Oracle-specific call sites | Each call to a built-in Oracle function or package routine must be mapped to an orafce function, a native PostgreSQL equivalent, or a rewrite. A high count raises review time even when most calls map cleanly. | A call-site inventory by function name, with a planned disposition for each group. |
| PL/SQL dependent on packages | Packages with state, cursors, or package variables behave differently from PostgreSQL functions. Heavy package use often needs redesign, not just emulation, and raises both design and test effort. | A list of packages in scope, showing which are emulated by orafce and which need manual conversion. |
| Test coverage of the application | Thin tests leave behavior differences undetected, so teams spend more time on manual checks. Good coverage shortens the defect cycle but needs setup effort first. | Whether the partner will build regression tests before conversion, and who owns the expected results. |
| Number of PostgreSQL major versions and environments | Each target major version and each environment (development, test, staging, production) needs its own orafce build, install and verification. More targets multiply install and retest work. | The target PostgreSQL major versions, the orafce version pinned for each, and the environments covered by the quote. |
| Regression comparison against Oracle | Comparing outputs from Oracle and PostgreSQL for the same inputs catches differences in dates, numerics, nulls and string handling. Without a baseline, these differences surface in production. | How result sets will be captured from Oracle, stored, and compared, and what tolerance is accepted for differences. |
| Supported platforms and managed services | orafce is supported in AWS Aurora with PostgreSQL compatibility and in Azure Database for PostgreSQL. Self-hosted installs need the build and packaging work done in-house, which adds effort on your side. | Confirmation that the chosen platform and version are supported, and who handles build and packaging. |
| Ongoing ownership after go-live | Upgrades to new PostgreSQL majors and new orafce releases need retesting of every emulated function in use. This recurs for as long as the application runs on PostgreSQL. | Whether support or a retainer covers orafce upgrades and regression reruns, and how often they are scheduled. |
How orafce fits alongside Ora2Pg conversion
Ora2Pg and orafce do different jobs, and planning them as one step is the most common way migration teams lose time. Ora2Pg converts the schema and some of the procedural code from Oracle into PostgreSQL equivalents, while orafce supplies PostgreSQL functions and packages that carry Oracle names. The practical split is that converted code still calling Oracle functions by name (for example, date or string helpers that have no direct PostgreSQL counterpart) can often run once orafce is installed in the target database, while code that depends on Oracle-specific syntax, package state, cursor behavior or transaction semantics still needs manual rewriting. Before the conversion backlog is sized, the team should map each object to one of those three outcomes: converted automatically, covered by orafce, or rewritten by hand.
The order of operations changes which errors show up and when. If orafce is installed before a conversion run, some failures disappear and the team may not notice which code paths were actually exercised. If it is installed afterward, the error log from the Ora2Pg run shows the full list of unresolved function calls, which is useful evidence for estimating the manual work. Either way, the team should record the Ora2Pg version, the orafce version and the target PostgreSQL major version used for each test run, because the set of functions each component handles can change between releases. Confirm the current conversion behavior, the supported Oracle constructs and any configuration options against the Ora2Pg documentation before you commit to a conversion approach, rather than relying on examples from older guides. Ask the team that owns the database to confirm the orafce version compatible with the PostgreSQL major version you plan to run.
Where orafce sits in the migration pipeline
The flow starts with the Oracle source, which Ora2Pg converts into PostgreSQL schema and code. The converted objects load into a self-hosted PostgreSQL target where orafce is installed, so Oracle-style functions resolve without rewriting every call. The application then runs against that target, and a regression comparison checks its output against the Oracle baseline. Differences found there go back to the converted code, orafce usage, or configuration, and the loop repeats until results match.
Ora2Pg conversion, orafce on the PostgreSQL target, and the regression loop.
How orafce connects to the rest of the platform
Does orafce need to be reinstalled after a PostgreSQL major upgrade?
Yes, plan to reinstall or upgrade orafce as part of every PostgreSQL major upgrade, and confirm which orafce release supports your target major version. Extensions are built against a specific PostgreSQL major, so the compiled module from one major version cannot be assumed to load on the next. The PostgreSQL upgrading documentation covers the core upgrade paths, including pg_upgrade and logical replication. Check the orafce repository for the version pairing before you pick a target major, and test the emulated functions on the new version in a staging copy before cutover. Record the orafce version in your change plan so the rollback path also knows which module to restore.
How do backup and restore handle orafce objects?
Confirm that your backup tool captures the extension definition, its installed schema objects and any objects that depend on it, then prove the restore on a separate server. Logical dumps record CREATE EXTENSION statements, while physical backups capture the files as they stand. Point-in-time recovery restores the whole cluster from a base backup and archived WAL, so the extension comes back with the data, but the module binary must still match the restored major version. Ask whether your restore test includes calls to the emulated functions, not just a row count, because a restore can succeed while a function call fails on a missing dependency.
Does orafce work behind PgBouncer connection pooling?
Test it before you rely on it, because connection poolers can change how session state behaves. orafce's emulated packages may keep state within a session, and transaction pooling in PgBouncer does not guarantee that consecutive statements reach the same backend. Check any session-level package variables, search path settings and SET statements your application uses. PgBouncer is a lightweight connection pooler for PostgreSQL, and its documentation describes which pooling modes preserve session state. Run your application's Oracle-style call paths through the pooler in a staging environment and compare results with a direct connection.
How does orafce fit with PostgreSQL authentication?
orafce does not add its own login or permission layer. Access to the emulated functions follows the database's configured authentication methods and the role privileges you grant on the schema where the functions are installed. Review pg_hba.conf for the connection paths that applications use, and confirm that the roles calling the functions hold only the EXECUTE privileges they need. The PostgreSQL authentication methods documentation lists the supported methods, including password, certificate and directory-based options. If your applications use a password method, confirm it is SCRAM rather than MD5, since PostgreSQL 18 deprecated MD5 password authentication.
How do I monitor errors raised by emulated Oracle functions?
Treat emulated functions as application-visible behavior and log their errors the same way you log other SQL errors. Enable PostgreSQL error logging with a log line prefix that includes the database, user and application name, so an error from an emulated call can be traced to a caller. Raise the log level for the specific statements you care about only after checking log volume. Build alerts on error rates by SQLSTATE rather than on raw messages, and compare error counts before and after each cutover. Confirm with the orafce project which functions raise errors in ways that differ from Oracle, since these are the cases your monitoring must catch.
What does orafce cost to run, and who pays for it?
orafce is open source, so the software itself carries no license fee. The costs come from the people and infrastructure around it: engineers who test the emulated functions against your application, the time to update the module during upgrades, and monitoring and backup work that covers it. Ask a partner to price these as separate line items in the written scope, including who runs the regression tests after each PostgreSQL minor or major release. Recurring costs depend on how many upgrades you plan and how many Oracle-specific call paths your application uses. DeployOpen quotes follow from a written scope, and no fixed price applies to this topic.
Can orafce be used on managed PostgreSQL services?
Yes, orafce is supported on AWS Aurora with PostgreSQL compatibility and on Azure Database for PostgreSQL, according to the orafce repository. Self-hosted deployments give you direct control over the module version, the PostgreSQL major and the restore procedure. On a managed service, the provider decides which extension versions are available and when they change, so confirm the exact orafce version offered for your target major before you plan an upgrade. Check the provider's documentation for extension upgrade steps and any restrictions on creating extensions with your role.
What the client receives at handover
The handover package for an orafce engagement is built so that another engineer can explain every Oracle-style call in the application, reproduce the installed setup and decide what to do next without the original team. The core items are an Oracle-call inventory listing each function and package the application invokes, where it is called from, and whether it resolves to orafce, to a native PostgreSQL function or to a rewritten statement. The inventory is the document a later upgrade or security review will start from, so it should be kept under version control with the application code.
The second group covers the installed configuration and the behavior record. The installed orafce configuration is delivered as a version-pinned extension setup: the exact orafce release matched to the PostgreSQL major version in use, the CREATE EXTENSION statements and schema placement, the search_path settings that the application depends on, and the role grants that control who can call the emulated objects. Alongside it sits a behavior difference log recording each place where orafce output differs from the Oracle original, with the owner who accepted that difference, the reason, and the tests that cover it. Ask the partner to show how accepted differences are reviewed when a difference is found later, because an unreviewed difference is the most common source of quiet data changes.
The third group covers verification and recovery. Handover should include regression test results for the inventoried calls, run on the target PostgreSQL version, together with the test data used and any cases that were not covered. Also expect rollback notes describing how to remove or disable the extension and restore the prior code path, and a runbook for upgrades that states which orafce release to use for each planned PostgreSQL major, how the extension is rebuilt, and where the regression suite is run again. Confirm with the orafce repository's current release notes which PostgreSQL versions each release supports before committing to a version pin, since support can change between releases.
How DeployOpen scopes and delivers orafce work
DeployOpen plans, installs and tests orafce against the Oracle behavior your applications depend on, inside the PostgreSQL environment you run. Each engagement starts with a written scope, so the functions to emulate, the test cases and the handover material are agreed before the build begins.
How we scope
- Inventory the Oracle functions and packages your application code and database objects call, and map each to orafce or to a rewrite.
- Agree in writing which orafce functions are in scope, which behaviors must match Oracle exactly and which differences you accept.
- Confirm the PostgreSQL major version, the orafce release for it, and the managed or self-hosted environment it will run in.
- Engagements are fixed-scope, so deliverables and timelines are settled in the written scope before work starts.
How we build
- Install orafce alongside the target PostgreSQL version and create it in the schemas and roles your applications use.
- Write regression tests that run representative Oracle-dependent queries and compare results with the expected Oracle output.
- Coordinate the Ora2Pg conversion output with orafce so converted objects call the emulated functions without duplicate definitions.
- Document each function that behaves differently, with the edge cases found during testing and the application changes required.
How we hand over
- Deliver installation scripts, configuration notes and the test suite so your team can rerun the checks.
- Provide a compatibility register listing each emulated function, its tested behavior and known differences.
- Walk your database and application teams through the findings, open risks and the decisions that remain with you.
- Record the upgrade steps for orafce alongside your PostgreSQL major upgrade plan.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Retest the compatibility suite when PostgreSQL or orafce is upgraded, and report any changed behavior before it reaches production.
- Agree with your team who owns the compatibility register and how new Oracle-dependent code is reviewed.

