PostgreSQL sequence based on another column

后端 未结 8 1365
情话喂你
情话喂你 2020-11-30 01:33

Lets say I have a table as such:

Column   |     Type    |                        Notes
---------+------------ +----------------------------------------------         


        
8条回答
  •  有刺的猬
    2020-11-30 02:25

    PostgreSQL supports grouped unique columns, as such:

    CREATE TABLE example (
        a integer,
        b integer,
        c integer,
        UNIQUE (a, c)
    );
    

    See PostgreSQL Documentation - Section 5.3.3

    Easy :-)

提交回复
热议问题