postgresql company id based sequence
I have a database with companies and their products, I want for each company to have a separate product id sequence. I know that postgresql can't do this, the only way is to have a separate sequence for each company but this is cumbersome. I thought about a solution to have a separate table to hold the sequences CREATE TABLE "sequence" ( "table" character varying(25), company_id integer DEFAULT 0, "value" integer ) "table" will be holt the table name for the sequence, such as products, categories etc. and value will hold the actual sequence data that will be used for product_id on inserts I