1.0 to 2.0 migration preparation and FAQs

Updated at:
Copy as MD

Before migrating PolarDB for PostgreSQL(Compatible with Oracle) from version 1.0 to 2.0, complete the preparation steps below. If you encounter problems after migration, check the FAQ section for solutions to the most common issues.

Pre-migration checklist

Complete these steps before cutting over to version 2.0. Each item is a blocker or a known cause of post-migration failures.

1. Replace application drivers

Important

Version 1.0 and 2.0 use entirely different driver systems. Using 1.0 drivers against a 2.0 cluster will cause application failures.

Replace all version 1.0 drivers in your application with version 2.0 drivers before cutover. Version 2.0 supports the following:

2. Verify parameter changes

Check any parameters you manually changed in version 1.0. Two parameters were renamed in version 2.0 and their defaults changed:

1.0 parameter name

1.0 default

2.0 parameter name

2.0 default

Function

Action required

polar_comp_stmt_level_tx

off

polar_enable_stmt_transaction_rollback

on

Controls statement-level transaction rollback

If you set this to a non-default value in 1.0, reconfigure it in 2.0 using the new parameter name. Note that the default changed from off to on—verify this is compatible with your application logic.

polar_empty_string_is_null_enable

on

polar_enable_empty_string_is_null

on

Controls whether empty strings are treated as NULL

If you set this to a non-default value in 1.0, reconfigure it in 2.0 using the new parameter name. The default is unchanged.

Parameter configurations are not automatically migrated. Reconfigure any non-default values manually in version 2.0.

3. Verify database client compatibility

Both version 1.0 and 2.0 are 100% compatible with the PostgreSQL protocol, so your existing database clients work without changes. Common clients include:

Best practices

  • Test before cutting over production. Fully validate all application functionality against a test cluster running version 2.0 before migrating production.

  • Back up your data. Take a complete backup of source data before starting migration.

  • Work through the FAQ checklist. Address each known issue category below systematically—some are blockers that cause immediate failures, others cause data anomalies that appear only after cutover.

  • Test application compatibility. Comprehensively test the compatibility of your applications with version 2.0.

  • Optimize for version 2.0. Utilize the new features of version 2.0 to optimize database access performance for your applications.

  • Document your changes. Record all configuration modifications and code changes for future reference.

  • Get help early. For complex issues, contact support before they block your migration.

FAQ

The table below summarizes each known issue, its impact, and whether it must be resolved before or after cutover.

Issue

Impact if not resolved

When to resolve

Sequences generate duplicate or skipped values

Duplicate primary keys or data gaps after cutover

Immediately after migration, before application starts

Stored procedure calls with OUT parameters fail

Application errors on every affected call

Before cutover (requires code change)

Tables, views, or stored procedures cannot be found

Application errors when accessing database objects

After cutover

Tables or views return permission denied

Access failures for affected users

After cutover

Objects with mixed-case double-quoted identifiers cannot be found

Object lookup failures for affected identifiers

After cutover (rare issue)

Sequences generate duplicate or skipped values after migration

During migration, Sequence current values may not be copied to the destination database. If the destination Sequence starts lower than the source, newly generated values conflict with existing data (duplicates) or leave gaps in the sequence.

Synchronize Sequence values from the source to the destination database immediately after migration and before your application starts generating new values:

  1. Run the following SQL in the source database to get the current value of each Sequence:

    DO LANGUAGE plpgsql $$
    DECLARE
      nsp name;
      rel name;
      val int8;
    BEGIN
      FOR nsp, rel IN
        SELECT nspname, relname
        FROM pg_class t2, pg_namespace t3
        WHERE t2.relnamespace = t3.oid
          AND t2.relkind = 'S'
          AND t2.relowner != 10
      LOOP
        EXECUTE format($_$select last_value from %I.%I$_$, nsp, rel) into val;
        RAISE NOTICE '%',
        format($_$select setval('%I.%I'::regclass, %s);$_$, nsp, rel, val+1);
      END LOOP;
    END;
    $$;
  2. Copy the setval(...) statements from the output and run them in the destination database.

  3. Confirm the Sequence values in the destination match the source before opening traffic.

Stored procedure calls with OUT parameters fail in version 2.0

In version 2.0, calling a stored procedure or function with OUT parameters requires passing a placeholder value at each OUT parameter position. Calls that omit OUT arguments—which worked in version 1.0—fail with an error.

This is a kernel-level compatibility change and cannot be resolved through configuration. Update your application code to pass a placeholder value at each OUT parameter position. The value is used only for type detection and does not affect the procedure's behavior.

-- Stored procedure definition
CREATE PROCEDURE p(a OUT INT) IS
BEGIN
  a := 1;
END;

-- Call method in PolarDB-O 1.0 (will fail in 2.0)
CALL p();

-- Call method compatible with PolarDB-O 2.0 and Oracle
CALL p(100); -- Parameter value can be any integer, only used for type detection

Tables, views, or stored procedures cannot be found after migration

Missing objects after migration are almost always caused by search_path not being set on the destination cluster. Set it at the database level to match your schema layout:

ALTER DATABASE database_name SET search_path = 'schema1,schema2,public';
If you connect via JDBC, also add currentSchema=schema1 to the JDBC connection string to specify the namespace.

If adjusting search_path does not resolve the issue, create public synonyms as a fallback. The following script generates the CREATE PUBLIC SYNONYM statements for all tables and views owned by a specific user:

DO $$
DECLARE
    relation_name VARCHAR(100);
    relation_nsp VARCHAR(100);
BEGIN
    FOR relation_name, relation_nsp IN
        SELECT relname, relnamespace::regnamespace
        FROM pg_class
        WHERE relkind IN ('r', 'v')
        AND relowner = '<actual object creator username>'::regrole::oid
    LOOP
        RAISE NOTICE 'CREATE PUBLIC SYNONYM % FOR %.%;',
                     relation_name, relation_nsp, relation_name;
    END LOOP;
END $$;

Replace <actual object creator username> with the actual username. After running the script, review the output statements for correctness, then execute them to create the synonyms.

Tables or views return permission denied after migration

Permissions are not automatically migrated. Grant the necessary permissions manually:

-- Grant query permission on a table to a user
GRANT SELECT ON table_name TO user_name;

-- Grant query permission on a view to a user
GRANT SELECT ON view_name TO user_name;

-- Grant usage permission on a schema to a user
GRANT USAGE ON SCHEMA schema_name TO user_name;

Objects created with mixed-case double-quoted identifiers cannot be found

Important

This issue is rare. If you are unsure whether it applies to your database, contact support for confirmation before making changes.

If your application relied on a bug in early versions of 1.0 where double-quoted mixed-case identifiers were handled differently, enable the case-interleaving ignore parameter in version 2.0:

SET polar_enable_ignore_case_interleaving = on;

What's next