ビューのアスタは展開されて保存される
(8.0.32)
drop table if exists tab17 ;
drop view if exists view17;
drop view if exists view18;
create table tab17(col1 int, col2 varchar(100), col3 datetime);
create view view17 as select * from tab17;
create view view18 as select * from view17;
insert into tab17 values(1,'A',now() );
select * from tab17;
select * from view17;
select * from view18;
show create view view17;
show create view view18;
ビューのアスタは展開されて保存される
(19c)
drop table tab17 purge;
drop view view17;
drop view view18;
create table tab17(col1 int, col2 varchar2(100), col3 timestamp);
create view view17 as select * from tab17;
create view view18 as select * from view17;
insert into tab17 values(1,'A',systimestamp);
commit;
select * from tab17;
select * from view17;
select * from view18;
select text from user_views where VIEW_NAME = 'VIEW17';
select text from user_views where VIEW_NAME = 'VIEW18';
ビューのアスタは展開されて保存される
(15)
drop table if exists tab17 CASCADE;
create table tab17(col1 int, col2 varchar(100), col3 timestamp);
create view view17 as select * from tab17;
create view view18 as select * from view17;
insert into tab17 values(1,'A',clock_timestamp() );
select * from tab17;
select * from view17;
select * from view18;
SELECT * FROM pg_views where viewname = 'view17';
SELECT * FROM pg_views where viewname = 'view18';
ビューのアスタは展開されて保存される
(2022)
drop table if exists tab17 ;
drop view if exists view17;
drop view if exists view18;
create table tab17(col1 int, col2 varchar(100), col3 datetime2);
go
create view view17 as select * from tab17;
go
create view view18 as select * from view17;
go
insert into tab17 values(1,'A',getdate() );
select * from tab17;
select * from view17;
select * from view18;
sp_help view17;
go
sp_help view18;
go
SQL Server Management StudioからDDL確認
→ ビューのアスタは展開されていない★
alter table tab17 add col4 varchar(10) default 'X' not null;
select * from tab17;
select * from view17;
select * from view18;
しかし、参照元テーブルにカラム追加してもビューには反映されない
sp_help view17;
go
sp_help view18;
go