Is it possible to use a PG sequence on a per record label?

前端 未结 4 1725
悲&欢浪女
悲&欢浪女 2020-12-11 07:04

Does PostgreSQL 9.2+ provide any functionality to make it possible to generate a sequence that is namespaced to a particular value? For example:

 .. | user_i         


        
4条回答
  •  独厮守ぢ
    2020-12-11 07:23

    Yes:

    CREATE TABLE your_table
    (
        column type DEFAULT NEXTVAL(sequence_name),
        ...
    );
    

    More details here: http://www.postgresql.org/docs/9.2/static/ddl-default.html

提交回复
热议问题