Menu

#48 view ddl ignores primary key constraint

V1.21RC3
open
nobody
None
5
2010-01-14
2010-01-14
Anonymous
No

Execute this DDL:
create table my_table
(
code varchar2(20) not null,
attr1 varchar2(10),
attr2 varchar2(10),
constraint my_table_pk primary key (code)
)
;
create view my_view
(
code,
attr1,
constraint my_view_pk primary key (code) rely disable
)
as
select
code,
attr1
from my_table
;
Loading the view in SQLTools_pp 1.21 RC3 yields
CREATE OR REPLACE VIEW MY_VIEW (
CODE,
ATTR1
) AS
select
code,
attr1
from my_table
/

Discussion

  • randolf_geist

    randolf_geist - 2010-01-14

    That is probably correct - the built-in DDL generation code probably is not aware of the "constraints on view" option and therefore ignores it.

    What do you get if you use the "DBMS_METADATA" option for the DDL generation (available in the dialog showing up)? This should get it right.

    Randolf

     
  • Anonymous

    Anonymous - 2010-01-18

    Yes, that fixes the problem.
    Although it also is much slower, and causes schema name to be included and names to be enclosed in "'s (but those annoying facts are outside the scope of this excellent tool, I gather)

    Thank you,
    Erik

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.