Untitled

mail@pastecode.io avatar
unknown
pgsql
a month ago
404 B
4
Indexable
Never
postgres=# CREATE TABLE t (a INT);
CREATE TABLE
postgres=# INSERT INTO t VALUES (1);
INSERT 0 1
postgres=# CREATE VIEW v AS SELECT * FROM t;
CREATE VIEW
postgres=# SELECT * FROM v;
 a 
---
 1
(1 row)

postgres=# ALTER TABLE t ADD COLUMN b INT DEFAULT 666;
ALTER TABLE
postgres=# SELECT * FROM v;
 a 
---
 1
(1 row)

postgres=# SELECT * FROM t;
 a |  b  
---+-----
 1 | 666
(1 row)
Leave a Comment