File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,19 @@ ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RESET
154154 <literal>bar</literal>:
155155<programlisting>
156156ALTER VIEW foo RENAME TO bar;
157- </programlisting></para>
157+ </programlisting>
158+ </para>
159+
160+ <para>
161+ To attach a default column value to an updatable view:
162+ <programlisting>
163+ CREATE TABLE base_table (id int, ts timestamptz);
164+ CREATE VIEW a_view AS SELECT * FROM base_table;
165+ ALTER VIEW a_view ALTER COLUMN ts SET DEFAULT now();
166+ INSERT INTO base_table(id) VALUES(1); -- ts will receive a NULL
167+ INSERT INTO a_view(id) VALUES(2); -- ts will receive the current time
168+ </programlisting>
169+ </para>
158170 </refsect1>
159171
160172 <refsect1>
You can’t perform that action at this time.
0 commit comments