Use duplicating to make a quick copy (clone) of the selected table (or other database object). The copy will be placed to the same database. If you need to create a copy of the table in an external database, use data exporting instead.
How to Duplicate a Database Object
To duplicate the selected table, choose Table | Duplicate... or click the corresponding button above the table list. The latter option is available when the Object Browser is visible.
To clone a database object of another type, select the object in its object list and click Duplicate button above the list or use Duplicate... item from the context menu of the list. Make sure the Object Browser is visible.
The full set of possible cloning options depends on the database type (i.e. dBase, Oracle, Firebird etc) and selected object type (table, view, stored procedure etc). For example, when copying a table, you can choose either to create a blank table or copy the data too; for some database types, copying indices and constraints are also possible, as long as permissions and descriptions. For views, you can make a clone either as another view or as a regular table copying the structure and (optionally) the view data.
As an alternative to duplicating tables, you can use the data exporting to the same database. This way gives you a possibility to modify the destination structure, description(s) etc.
Cloning a table in PostgreSQL database:
Database Object Duplicating Options
Target name | Specify a unique name for the new database object. |
Action | Specify either to execute the duplicating command batch immediately or generate SQL code instead. In latter case, you are able to modify the generated SQL code before applying the commands. |
Target | Only for views or external tables. Specify either to make a copy as a regular table or keep the source object type. |
Include partitions | For partitioned PostgreSQL tables only. Specify either to duplicate the table partitions (if any). In PostgreSQL databases (version 10 and above), table partitions can be considered either as separate tables or as parts of a partitioned table. If you want to duplicate partitions along with their parent table, turn this option on; but please note that it may be not desirable, for example, when you you create an empty clone of the partitioned table. |
Include privileges | Specify either to duplicate the object privileges. Not all databases support object privileges. |
Include comments | Specify either to duplicate the object comments. Not all databases support comments on database objects. |
Include data | Only for tables. Specify either to copy table or view data into the new table. |
Include primary key | Only for tables. Specify either to duplicate the primary key of the table. For named primary key constraint, Database Tour constructs new unique name based on the new table name. |
Include indices | Only for tables. Specify either to duplicate the table indices. Database Tour constructs unique names for the new indices based on the new table name. |
Include foreign keys | Only for tables. Specify either to duplicate the table foreign keys. For named foreign key constraints, Database Tour constructs new unique names based on the new table name. |
Include constraints | Only for tables. Specify either to duplicate the table constraints, except primary and foreign keys. For named constraints, Database Tour constructs new unique names based on the new table name. |
Notes
- Duplicating a large table with Include data option can take some time.
- For BDE local connections, the duplicating is done by means of BDE; all family files (index etc.) are also duplicated.
- In some cases, data edit mode is required to duplicate the table (so, you should switch to Data page and click the corresponding button).
- Database Tour currently supports cloning table indices and constraints not for all database types.
See also