Обсуждение: enhancement to pg_dump: supress columns
I have a situation where I need to hack pg_dump not to dump columns with a particular name. If this is of interest to the community I can spend a little extra effort and work up a patch. I'd be curious to see if anyone else thinks this is worthwhile. Why would I want to do this? I use a global sequence for a database wide unique identifier for purposes of locking (to hook into the user lock module). This works great but our clients frequently like to make copies of data for testing purposes and a dump/reload into a separate schema makes a copy of the generated identifier in the database. Basically, I need a field to revert to default in a dump/reload cycle. A command line switch to pg_dump seems the easiest way to handle this. A specialized domain qualifier which prevents the column from being dumped is perhaps more elegant but more work. Merlin
A general ability to be able to dump views as if they were tables would be more broadly applicable methinks? Merlin Moncure wrote: > I have a situation where I need to hack pg_dump not to dump columns with > a particular name. If this is of interest to the community I can spend > a little extra effort and work up a patch. I'd be curious to see if > anyone else thinks this is worthwhile. > > Why would I want to do this? I use a global sequence for a database > wide unique identifier for purposes of locking (to hook into the user > lock module). This works great but our clients frequently like to make > copies of data for testing purposes and a dump/reload into a separate > schema makes a copy of the generated identifier in the database. > > Basically, I need a field to revert to default in a dump/reload cycle. > A command line switch to pg_dump seems the easiest way to handle this. > A specialized domain qualifier which prevents the column from being > dumped is perhaps more elegant but more work. > > Merlin > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
Christopher wrote: > A general ability to be able to dump views as if they were tables would > be more broadly applicable methinks? > > Merlin Moncure wrote: > > I have a situation where I need to hack pg_dump not to dump columns with > > a particular name. If this is of interest to the community I can spend > > a little extra effort and work up a patch. I'd be curious to see if > > anyone else thinks this is worthwhile. > > Yes, although that would not solve my particular problem. Since I don't want to dump a particular column that is present in all tables, using views would mean creating a lot of views for one purpose :(. Basically, I have a simulated oid which is superior to the provided oid in all ways except one, in that the oid allows you to keep it from dumping. Another example of a column you might not want to dump is passwords...although that's a fairly weak case. hmm, I might be out in the wilderness on this one. Merlin
On N, 2005-10-13 at 15:13 -0400, Merlin Moncure wrote: > I have a situation where I need to hack pg_dump not to dump columns with > a particular name. If this is of interest to the community I can spend > a little extra effort and work up a patch. I'd be curious to see if > anyone else thinks this is worthwhile. > > Why would I want to do this? I use a global sequence for a database > wide unique identifier for purposes of locking (to hook into the user > lock module). This works great but our clients frequently like to make > copies of data for testing purposes and a dump/reload into a separate > schema makes a copy of the generated identifier in the database. > > Basically, I need a field to revert to default in a dump/reload cycle. > A command line switch to pg_dump seems the easiest way to handle this. > A specialized domain qualifier which prevents the column from being > dumped is perhaps more elegant but more work. I think that general ability to *exclude* things (schemas, tables, functions) from pg_dump output would be great: pg_dump mydb -X schema.view -X "schema.function(int,text,text)" -X "schema.table.*fieldnamepart*" -- Hannu Krosing <hannu@skype.net>
> On N, 2005-10-13 at 15:13 -0400, Merlin Moncure wrote: > > I have a situation where I need to hack pg_dump not to dump columns with > > a particular name. If this is of interest to the community I can spend > > a little extra effort and work up a patch. I'd be curious to see if > > anyone else thinks this is worthwhile. > > > > Why would I want to do this? I use a global sequence for a database > > wide unique identifier for purposes of locking (to hook into the user > > lock module). This works great but our clients frequently like to make > > copies of data for testing purposes and a dump/reload into a separate > > schema makes a copy of the generated identifier in the database. > > > > Basically, I need a field to revert to default in a dump/reload cycle. > > A command line switch to pg_dump seems the easiest way to handle this. > > A specialized domain qualifier which prevents the column from being > > dumped is perhaps more elegant but more work. > > I think that general ability to *exclude* things (schemas, tables, > functions) from pg_dump output would be great: > > pg_dump mydb -X schema.view -X "schema.function(int,text,text)" -X > "schema.table.*fieldnamepart*" hmm, ok, that works. Also schema.domain Merlin