CREATE TABLE n_catalogs.slist_search_text( search_text character varying NOT NULL, -- Строка поиска search_quantity bigint NOT NULL, -- Количество search_type integer NOT NULL, -- Тип поиска CONSTRAINT slist_search_text_text_type_pkey PRIMARY KEY (search_text, search_type));
q.prepare("INSERT INTO n_catalogs.slist_search_text AS old (search_text, search_quantity, search_type) " "VALUES (?, 1, ?) ON CONFLICT (search_text, search_type) " "DO UPDATE SET search_quantity = old.search_quantity + 1;");
CREATE TABLE test( stext character varying NOT NULL, squantity bigint NOT NULL, CONSTRAINT text_pkey PRIMARY KEY (stext, squantity));
INSERT INTO test VALUES('A', 1), ('B', 1);
INSERT INTO test(stext, squantity) VALUES('A', 1) ON CONFLICT (stext, squantity) DO NOTHING;
INSERT INTO test(stext, squantity) VALUES('A', 2) ON CONFLICT (stext, squantity) DO NOTHING;