Skip to Main Content
  • Questions
  • EBR - comments are lost for editionable views/inherited objects, which are compiled to a new edition

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Karel.

Asked: April 08, 2024 - 3:01 pm UTC

Last updated: May 16, 2024 - 6:34 am UTC

Version: 19.22

Viewed 100+ times

You Asked

Hello,

We are start using EBR last year and sometimes we find some surprising behavior.

Today I found that comments of editionable view are lost after view compile in a new edition. :-(


Testcase:

alter session set edition=ORA$BASE;

create user ebr_t1 default tablespace USERS;
alter user ebr_t1 quota 1m on users;

alter user ebr_t1 ENABLE EDITIONS;

create table ebr_t1.data_table (id number, text_value varchar2(50));

comment on table ebr_t1.data_table is 'data table';
comment on column ebr_t1.data_table.id  is 'DT: Primary Key';
comment on column ebr_t1.data_table.text_value  is 'DT: text value';

create or replace view ebr_t1.data_view as
  select id, text_value from ebr_t1.data_table;

comment on table ebr_t1.data_view is 'data view';
comment on column ebr_t1.data_view.id  is 'DV: Primary Key';
comment on column ebr_t1.data_view.text_value  is 'DV: text value';

select * from dba_tab_comments tc where tc.owner='EBR_T1' and tc.table_name='DATA_TABLE';
select * from dba_col_comments cc where cc.owner='EBR_T1' and cc.table_name='DATA_TABLE';

create edition EBR_E1;

alter session set edition=EBR_E1;

select * from dba_tab_comments tc where tc.owner='EBR_T1' and tc.table_name='DATA_VIEW';
select * from dba_col_comments cc where cc.owner='EBR_T1' and cc.table_name='DATA_VIEW';

alter view ebr_t1.data_view compile;

select * from dba_tab_comments tc where tc.owner='EBR_T1' and tc.table_name='DATA_VIEW';
select * from dba_col_comments cc where cc.owner='EBR_T1' and cc.table_name='DATA_VIEW';


alter session set edition=ORA$BASE;

drop edition EBR_E1 cascade;

drop user ebr_t1 cascade;



Is it expected behavior or bug?

I didn't find any catalog view, which is possible to use to recover comments for these types of objects, someting like DBA_TAB_COMMENTS_AE.

I prepared just a small workaround: store comments before compile inherited objects and then stored comments for the objects again create.

Best regards Karel Prech

and Connor said...

Can you please add the output of your test case to the question, because I'm not seeing any issues when I run it on my local machine.


Rating

  (1 rating)

Comments

Script output

Karel Prech, May 10, 2024 - 6:25 am UTC

Hello Connor,
I'm sorry for my delay, I didn't get any notification of your answer.

Script output from my environment:

Connected to Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 
Connected as prechk@CLDORAKAPSNAP

Session altered


User created


User altered


User altered


Table created


Comment added


Comment added


Comment added


View created


Comment added


Comment added


Comment added


OWNER                                                                            TABLE_NAME                                                                       TABLE_TYPE    COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_TABLE                                                                       TABLE         data table                                                                                   4

OWNER                                                                            TABLE_NAME                                                                       COLUMN_NAME                                                                      COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_TABLE                                                                       ID                                                                               DT: Primary Key                                                                              4
EBR_T1                                                                           DATA_TABLE                                                                       TEXT_VALUE                                                                       DT: text value                                                                               4

Edition created


Session altered


OWNER                                                                            TABLE_NAME                                                                       TABLE_TYPE    COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_VIEW                                                                        VIEW          data view                                                                                    4

OWNER                                                                            TABLE_NAME                                                                       COLUMN_NAME                                                                      COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_VIEW                                                                        ID                                                                               DV: Primary Key                                                                              4
EBR_T1                                                                           DATA_VIEW                                                                        TEXT_VALUE                                                                       DV: text value                                                                               4

View altered


OWNER                                                                            TABLE_NAME                                                                       TABLE_TYPE    COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_VIEW                                                                        VIEW                                                                                                       4

OWNER                                                                            TABLE_NAME                                                                       COLUMN_NAME                                                                      COMMENTS                                                                         ORIGIN_CON_ID
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------
EBR_T1                                                                           DATA_VIEW                                                                        ID                                                                                                                                                                            4
EBR_T1                                                                           DATA_VIEW                                                                        TEXT_VALUE                                                                                                                                                                    4

SQL> 


Best regards Karel
Connor McDonald
May 16, 2024 - 6:34 am UTC

Thanks for this - we've logged this as a bug

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library