I need to create some nearly identical copies of rows in a complicated
table.

Is there a handy syntax that would let me copy a existing row, but get a
new primary key for the copy?  I'd then go in an edit the 1 or 2
additional columns that differ.  The duplicate would be in the same
table as the original.

This would save me a bunch of typing.  Can it be done?

INSERT INTO mytable SELECT * FROM mytable WHERE pk = 123;

Or something close to that... I suspect if you changed the '*' to the columns you wanted you could also work in the other columns you want to change as well...

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to