RefLib

Reference library for AI

Back

postgresql_16:7.1.43.4 Examples

PostgreSQL 16 > Reference > SQL Commands > ALTER VIEW > Examples

To rename the view foo to bar: ALTER VIEW foo RENAME TO bar;

To attach a default column value to an updatable view: CREATE TABLE base_table (id int, ts timestamptz); CREATE VIEW a_view AS SELECT * FROM base_table; ALTER VIEW a_view ALTER COLUMN ts SET DEFAULT now(); INSERT INTO base_table(id) VALUES(1); -- ts will receive a NULL INSERT INTO a_view(id) VALUES(2); -- ts will receive the current time

Back