GitHub user vovik0134 added a comment to the discussion: [Ideas] Description of 
backward-incompatible changes between Greenplum 6 and Cloudberry in the 
documentation.

Backward-incompatible changes in the system catalog and metadata were also 
identified.

## Changes in the system catalog and metadata

### Removed and renamed columns in system catalog views and tables

When moving to Cloudberry, together with the PostgreSQL kernel and Greenplum 6 
upgrade, the following columns in system catalog views and tables were removed 
or renamed:

| Old column                                                                  | 
New column                                                           |
|-----------------------------------------------------------------------------|----------------------------------------------------------------------|
| `pg_class.relhasoids`                                                       | 
Removed                                                              |
| `pg_class.relhaspkey`                                                       | 
`EXISTS (SELECT FROM pg_index WHERE indrelid=... AND indisprimary)`  |
| `pg_class.relstorage`                                                       | 
`pg_class.relam`                                                     |
| `pg_proc.proisagg`                                                          | 
`pg_proc.prokind = 'a'`                                              |
| `pg_proc.proiswindow`                                                       | 
`pg_proc.prokind = 'w'`                                              |
| `pg_proc.protransform`                                                      | 
`pg_proc.prosupport`                                                 |
| `pg_attrdef.adsrc`                                                          | 
`pg_get_expr(adbin, adrelid)`                                        |
| `pg_constraint.consrc`                                                       
| `pg_get_constraintdef(oid)`                                          |
| `pg_stat_activity.waiting`                                                  | 
`wait_event_type`, `wait_event`                                      |
| `pg_am.*` — dozens of columns                                               | 
The access method API has been significantly reworked. There is no simple 
replacement. |
| `gp_distributed_log.distributed_id`, `gp_distributed_xacts.distributed_id`  | 
Removed                                                              |
| `gp_stat_replication.*_location`                                            | 
Renamed to `*_lsn`                                                   |
| `information_schema.routines.result_cast_character_set_name`                | 
Renamed to `result_cast_char_set_name`                               |

**How to detect**

Check the application codebase for uses of removed or renamed columns.

**How to fix**

Make the corresponding changes in the application codebase.

### Removal of system tables and views

The following system tables and views have been completely removed in 
Cloudberry compared to Greenplum 6:

* `pg_catalog.pg_partition`;
* `pg_catalog.pg_partition_columns`;
* `pg_catalog.pg_partition_encoding`;
* `pg_catalog.pg_partition_rule`;
* `pg_catalog.pg_partitions`;
* `pg_catalog.pg_partition_templates`;
* `pg_catalog.pg_stat_partition_operations`.

**How to detect**

Check the application codebase for uses of the removed system tables and views.

**How to fix**

Make the corresponding changes in the application codebase.

To work with partitioned tables in Cloudberry, use the `pg_partitioned_table` 
view and the `pg_partition_tree()`, `pg_partition_ancestors()`, and 
`pg_partition_root()` functions.

### Removal and renaming of system functions

The following system functions have been completely removed in Cloudberry 
compared to Greenplum 6:

* `pg_get_partition_def`, `pg_get_partition_rule_def`, 
`pg_get_partition_template_def`;
* `gp_elog`, `gp_fault_inject`, `gp_update_ao_master_stats`.

Functions in the `pg_*_xlog*` family have been renamed according to the 
`pg_*_wal*` pattern, for example, `pg_switch_xlog()` → `pg_switch_wal()`.  
Some functions have been removed.

**How to detect**

Check the application codebase for uses of removed and renamed system functions.

**How to fix**

Make the corresponding changes in the application codebase.

### Changes in how sequence metadata is displayed

Starting with PostgreSQL kernel version 10, the way sequence metadata is 
displayed has changed.  
Queries of the form `SELECT * FROM <seq_name>` now return only `last_value`, 
`log_cnt`, and `is_called`. Other properties are available through 
`pg_sequence` or `pg_sequences`.

Example for Greenplum 6:

```sql
CREATE SEQUENCE example_seq
    START WITH 100
    INCREMENT BY 1;

SELECT * FROM example_seq;
 sequence_name    | last_value | start_value | increment_by |      max_value    
  | min_value | cache_value | log_cnt | is_cycled | is_called
------------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 example_seq      |        100 |         100 |            1 | 
9223372036854775807 |         1 |           1 |       0 | f         | f
```

Example for Cloudberry:

```sql
CREATE SEQUENCE example_seq
    START WITH 100
    INCREMENT BY 1;

SELECT * FROM example_seq;
 last_value | log_cnt | is_called
------------+---------+-----------
        100 |       0 | f

SELECT * FROM pg_sequence WHERE seqrelid = 'example_seq'::regclass;
 seqrelid | seqtypid | seqstart | seqincrement |       seqmax        | seqmin | 
seqcache | seqcycle
----------+----------+----------+--------------+---------------------+--------+----------+----------
    17186 |       20 |      100 |            1 | 9223372036854775807 |      1 | 
      20 | f

SELECT * FROM pg_sequences WHERE sequencename = 'example_seq';
 schemaname | sequencename    | sequenceowner | data_type | start_value | 
min_value |      max_value      | increment_by | cycle | cache_size | last_value
------------+-----------------+---------------+-----------+-------------+-----------+---------------------+--------------+-------+------------+------------
 public     | example_seq     | user1         | bigint    |         100 |       
  1 | 9223372036854775807 |            1 | f     |         20 |
```

**How to detect**

Check the application codebase for queries of the form `SELECT * FROM 
<seq_name>` that use fields other than `last_value`, `log_cnt`, and `is_called`.

**How to fix**

Make the corresponding changes in the application codebase by querying 
`pg_sequence` or `pg_sequences`.

### Change in the internal representation of external tables

Inside Cloudberry, external tables are represented as foreign tables. Compared 
to Greenplum 6, this results in the following differences:

* The `pg_tables` system view no longer shows external tables.
* `pg_class.relkind` for external tables is now `'f'`, not `'r'`.
* The `pg_exttable` system table has become a view.
* The `EXPLAIN` output has changed: `Foreign Scan` is displayed instead of 
`External Scan`.

**How to detect**

Check the application codebase and scripts for references to external table 
metadata.

The list of external tables can be obtained with the following query:

```sql
SELECT n.nspname, c.relname, c.relkind, e.urilocation, e.execlocation, 
e.fmttype, e.fmtopts
FROM pg_exttable e
    JOIN pg_class c ON c.oid = e.reloid
    JOIN pg_namespace n ON n.oid = c.relnamespace;
```

**How to fix**

Make changes to the application codebase and scripts according to these changes.

### The `gp_toolkit` schema is now provided as an extension

In Cloudberry, unlike Greenplum 6, `gp_toolkit` is provided as an extension.  
>From an installation perspective, nothing changes: when a database is created, 
>`gp_toolkit` is connected automatically.

The following views have been removed:

* `gp_toolkit.gp_size_of_partition_and_indexes_disk`;
* `gp_toolkit.__gp_user_data_tables`.

The signatures of the following existing functions have changed:

* `gp_toolkit.__gp_aoseg*`;
* `gp_toolkit.__gp_aocsseg*`;
* `gp_dist_wait_status`;
* `gp_execution_segment`;
* `gp_request_fts_probe_scan`;
* `gp_tablespace_segment_location`.

The following columns have been removed from existing views:

* `gp_toolkit.gp_locks_on_resqueue.lorwaiting`;
* `gp_toolkit.gp_resgroup_config.cpu_rate_limit`;
* `gp_toolkit.gp_resgroup_config.memory_auditor`;
* `gp_toolkit.gp_resgroup_config.memory_shared_quota`;
* `gp_toolkit.gp_resgroup_config.memory_spill_ratio`;
* `gp_toolkit.gp_resgroup_status.cpu_usage`;
* `gp_toolkit.gp_resgroup_status.memory_usage`;
* `gp_toolkit.gp_resgroup_status_per_host.cpu`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_available`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_quota_available`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_quota_used`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_shared_available`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_shared_used`;
* `gp_toolkit.gp_resgroup_status_per_host.memory_used`;
* `gp_toolkit.gp_resgroup_status_per_host.rsgname`;
* `gp_toolkit.gp_resgroup_status_per_segment.cpu`;
* `gp_toolkit.gp_resgroup_status_per_segment.hostname`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_available`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_quota_available`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_quota_used`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_shared_available`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_shared_used`;
* `gp_toolkit.gp_resgroup_status_per_segment.memory_used`;
* `gp_toolkit.gp_resgroup_status_per_segment.rsgname`;
* `gp_toolkit.gp_resgroup_status.rsgname`;
* `gp_toolkit.__gp_user_tables.autrelstorage`.

**How to detect**

Check the application codebase and scripts for uses of changed or removed 
objects.

**How to fix**

Adapt the application codebase and scripts: stop using removed objects and 
account for changes in existing ones.

GitHub link: 
https://github.com/apache/cloudberry/discussions/1816#discussioncomment-17260347

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to