Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temporarily bypassing unique constraint

Status
Not open for further replies.

Quilmes

Programmer
Aug 13, 2000
12
AU
Hey

I am trying to do an insert into ... select * from ...
I am basically migrating some old data into a table with an identical schema. If I try and do this as a straight insert into select * ... the pkey field unique constraint stops this from working..

I know I can do it by using something like
insert into t1 col2, col3, col4... values select col2, col3, col4, ...

but just for interest's sake i was wondering if pgsql allowed you to force new pkey values to be generated for the inserted values so you don't have to type out all the column names minus the pkey column name.

I'm using 7.4 btw.

Thanks!


quilmes
 
Thanks, that is a helpful tip.
I am going to upgrade to v8.0 shortly.

Cheers!


quilmes
 
this is not only 8.0 feature, I don't know when it appeared, but it is at least from 7.1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top