Re: [GENERAL] Duplicating a table row while honouring key constraints

2007-11-12 Thread Alvaro Herrera
Gordon wrote: > At first I thought INSERT INTO table_name SELECT * from table_name > where primary_key = unique_value would do it, but that would obviously > violate the primary key uniqueness constraint. I'm wondering if > there's a way to do this where I only grab the data to be copied and > le

[GENERAL] Duplicating a table row while honouring key constraints

2007-11-12 Thread Gordon
I'm developing a web application in PHP and Postgres that will basically serve as a CMS. I want to implement a feature to allow users to make copies of documents or folders, so this will require the appropriate rows to be duplicated. If possible I'd like to do this with SQL queries and avoid SELE

Re: [GENERAL] Duplicating a table row while honouring key constraints

2007-11-12 Thread Lars Haugseth
* Gordon <[EMAIL PROTECTED]> wrote: > > I'm developing a web application in PHP and Postgres that will > basically serve as a CMS. I want to implement a feature to allow > users to make copies of documents or folders, so this will require the > appropriate rows to be duplicated. > > If possible