提交 1908f840 编写于 作者: A Andreas Scherbaum 提交者: Andreas Scherbaum

Add information how to add a sequence as default value (#2726)

* Add information how to add a sequence as default value
上级 32c8b291
......@@ -76,4 +76,20 @@
</p>
</body>
</topic>
<topic id="topic91" xml:lang="en">
<title>Making a Sequence the Default Value for a Column</title>
<body>
<p>A sequence can be used in the <codeph>CREATE TABLE</codeph> command (instead of the
<codeph>SERIAL</codeph> or <codeph>BIGSERIAL</codeph> type):</p>
<p>
<codeblock>CREATE TABLE ... (
id INT4 DEFAULT nextval('id_seq')
);
</codeblock>
</p>
<p>Alternatively, a column can be altered and a sequence can be added as default value:</p>
<codeblock>ALTER TABLE ... ALTER COLUMN id SET DEFAULT nextval('id_seq');
</codeblock>
</body>
</topic>
</topic>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册