我正在尝试通过以下方式创建序列:
create sequence some_seq start with (select max(id) + 1 from some_table);
但我收到以下错误:
ERROR: syntax error at or near "("
我也尝试过这种方法:
DO $$
DECLARE
min_seq_value int8 := (select max(id) + 1 from some_table);
BEGIN
create sequence some_seq start with min_seq_value;
END; $$;
但它给了我:
ERROR: syntax error at or near "min_seq_value"
它似乎很基本,但我无法让它工作。有任何想法吗?
谢谢!