mla/pg_sample

Export data with inserts statements

ash67 opened this issue · 4 comments

ash67 commented

Is it possible to export data with insert statements over COPY?

mla commented

Not as written. Why do you prefer inserts?

ash67 commented

@mla thanks for getting back to me! I m using pgmem for unit tests. It does not allow COPY to populate the db.

mla commented

k, we'd have to look. The COPY is convenient since we kind of fake it out.. we tell it we're going to create the real table name, but then we dump the data from the sample tables. Not sure how we can do that with inserts easily.

But one hack might be to use pg_sample to generate the sample db. Restore it. And then use pg_dump to dump it as insert statements.

ash67 commented

@mla thanks! The hack has worked for me. It does the job.