Re: [GENERAL] Merging records in a table with 2-columns primary key

2017-04-02 Thread Francisco Olarte
Alexander: On Sun, Apr 2, 2017 at 5:27 PM, Alexander Farber wrote: > 2) Is there a way to use an UPDATE reviews instead of the inefficient > (because copying) INSERT ... SELECT ... ON CONFLICT DO NOTHING? mmm, I've just sent a sugestion to use delete+reinsert and

Re: [GENERAL] Merging records in a table with 2-columns primary key

2017-04-02 Thread Francisco Olarte
Alexander: On Sun, Apr 2, 2017 at 4:26 PM, Alexander Farber wrote: > The purpose of the function is to merge several user records to one (with > the lowest uid). It looks complicated ( more on this later ) > While merging the reviews records I delete all

Re: [GENERAL] Merging records in a table with 2-columns primary key

2017-04-02 Thread Alexander Farber
Hello Andy and others - On Sun, Apr 2, 2017 at 5:13 PM, Andy Colson wrote: > On 04/02/2017 09:26 AM, Alexander Farber wrote: >> >> http://stackoverflow.com/questions/43168406/merging-records- >> in-a-table-with-2-columns-primary-key > > after some thinking, when I call

Re: [GENERAL] Merging records in a table with 2-columns primary key

2017-04-02 Thread Andy Colson
On 04/02/2017 09:26 AM, Alexander Farber wrote: Good afternoon, I have prepared a simple test case for my question - CREATE TABLE users ( uid SERIAL PRIMARY KEY, name varchar(255) NOT NULL ); CREATE TABLE reviews ( uid integer NOT NULL CHECK (uid <> author) REFERENCES

[GENERAL] Merging records in a table with 2-columns primary key

2017-04-02 Thread Alexander Farber
Good afternoon, I have prepared a simple test case for my question - CREATE TABLE users ( uid SERIAL PRIMARY KEY, name varchar(255) NOT NULL ); CREATE TABLE reviews ( uid integer NOT NULL CHECK (uid <> author) REFERENCES users ON DELETE CASCADE, author integer