SealCuadrado
SealCuadrado

Reputation: 769

Export and Import tables (not data) using pgAdmin

With pgAdmin, on my created DB, I have seven tables (all of them have at least one primary key, and some of them include foreign keys). Let's suppose in a moment I need to do a mayor correction so I don't have no other choice that to move it to another DB, and I don't want to rewrite the characteristics of the seven tables over and over again.

So, with that said, how I can export my tables (the structure, not the data), so, when I create another DB with pgAdmin, I can import my tables previously created.

Upvotes: 0

Views: 1401

Answers (2)

Sunil B N
Sunil B N

Reputation: 4225

With pgAdmin 1.14 and prior releases, there were only two ways to insert data in a table: use the restore tool (which uses pg_restore) ; use the query tool to execute INSERT queries (COPY queries are allowed if they use a file, but not stdin/stdout). This link would help you

Upvotes: 1

varun
varun

Reputation: 4650

create table new (
    like old
    including defaults
    including constraints
    including indexes
);

REF Copy table structure into new table

Upvotes: 1

Related Questions