pgcopydb icon indicating copy to clipboard operation
pgcopydb copied to clipboard

Skip or filter a cast during clone?

Open evmcl opened this issue 2 years ago • 2 comments

Is there a way to filter out a cast when cloning a database? I'm getting the following error:

pg_restore: while PROCESSING TOC:
ERROR  pg_restore: from TOC entry 5168; 2605 721107 CAST CAST (character varying AS jsonb) (no owner)
ERROR  pg_restore: error: could not execute query: ERROR:  must be owner of type character varying or type jsonb
ERROR  Command was: CREATE CAST (character varying AS jsonb) WITH INOUT AS IMPLICIT;

Currently in my script that does a dump and restore, I do:

pg_restore -l my.backup | grep -F -v 'CAST - CAST (character varying AS jsonb)' > ops.txt

Then restore to the new database with:

pg_restore -L ops.txt -d newdb my.backup

Would like to use pgcopydb instead if possible.

Help appreciated!

evmcl avatar Dec 21 '23 06:12 evmcl

Hi @evmcl ; thanks for opening an issue. We might be able to cook a feature wherein you could pass your own pg_restore --use-list file to pgcopydb and we would merge the internally computed file with the user-provided file. I would review and merge such a feature if a PR is opened. Do you want to work on it?

dimitri avatar Dec 22 '23 14:12 dimitri

I would review and merge such a feature if a PR is opened. Do you want to work on it?

Unfortunately, #619 is a show-stopper for our usage currently, so it would be difficult to get time allocated to looking at this change.

evmcl avatar Jan 07 '24 10:01 evmcl