<p>The program that I am currently assigned to has a requirement that I copy the contents of a table to a backup table, prior to the real processing.</p>

<p>During code review, a coworker pointed out that</p>

<pre><code>INSERT INTO BACKUP_TABLE
SELECT *
FROM PRIMARY_TABLE
</code></pre>

<p>is unduly risky, as it is possible for the tables to have different columns, and different column orders.</p>

<p>I am also under the constraint to not create/delete/rename tables. ~Sigh~</p>

<p>The columns in the table are expected to change, so simply hard-coding the column names is not really the solution I am looking for.</p>

<p>I am looking for ideas on a reasonable non-risky way to get this job done.</p>

You could try something like:
```
```
CREATE TABLE secondary_table AS SELECT * FROM primary_table;
```
```
Not sure if that automatically copies data. If not:
```
```
CREATE TABLE secondary_table AS SELECT * FROM primary_table LIMIT 1;
INSERT INTO secondary_table SELECT * FROM primary_table;
```
```
Edit:
Sorry, didn't read your post completely: especially the constraints part. I'm afraid I don't know how. My guess would be using a procedure that first describes both tables and compares them, before creating a lengthy insert / select query.
Still, if you're using a backup-table, I think it's pretty important it matches the original one exactly.