【发布时间】:2014-06-10 01:49:45
【问题描述】:
我的 postgres 数据库中有一个表,当我描述它时,它看起来像这样。
Table "public.statistical_outputs"
Column | Type | Modifiers
-------------------+--------------------------+------------------------------------------------------------------
id | bigint | not null default nextval('statistical_outputs_id_seq'::regclass)
我想知道如果我使用类似的语句会在 id 列中插入什么值
insert into statistical_outputs VALUES (DEFAULT);
我尝试过类似的东西
select nextval('id') from statistical_outputs;
但它不起作用。
可能相关的问题:
postgresql sequence nextval in schema
PostgreSQL nextval and currval in same query
此问题可能与以下问题重复:
Get the default values of table columns in Postgres?
但是,Chris 给出的答案是我想要的答案,而无需查看信息架构(我想我尝试过但没有奏效)。
【问题讨论】:
标签: sql postgresql