copy record?

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: copy record?
Date: 2011-05-26 20:23:50
Message-ID: 482E80323A35A54498B8B70FF2B87980049413B5EB@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi:

From within a perl/DBI script, I want to be able to make a copy of a record in a table, changing only the value of the primary key. I don't know in advance what all the columns are, just the table name.

I suppose I could pull the column names for the table from the metadata, query the table/record for the values to copy, build an insert statement from all of that and run it. But is there a simpler, more elegant way to do this?

Thanks for any help !

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brent Wood 2011-05-26 20:39:50 Re: Miidpoint between two long/lat points? (earthdistance?)
Previous Message Joshua D. Drake 2011-05-26 18:22:01 #PgWest 2011: CFP now open

Browse pgsql-sql by date

  From Date Subject
Next Message Tarlika Elisabeth Schmitz 2011-05-26 20:40:12 Re: extracting location info from string
Previous Message Ross J. Reedstrom 2011-05-26 18:07:56 Re: column type for pdf file