| From: | Philip Warner <pjw(at)rhyme(dot)com(dot)au> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: pg_dump not dumping default_text_search_config WAI? |
| Date: | 2025-11-10 03:43:33 |
| Message-ID: | 10c7c87cbe9e9d738fad4d26112e856a@rhyme.com.au |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2025-11-10 03:03, Tom Lane wrote:
> Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes: On 2025-11-09 04:06, Tom Lane wrote: IIRC you'd need to use --create to prod pg_dump to produce
> a CREATE DATABASE command as well as any database-level
> ALTER commands.
> Is that a good approach?
Without --create,
pg_dump is not chartered to make a new database but only to restore
into whatever DB you've connected to. So the present approach of
issuing "ALTER DATABASE foo" commands would be completely wrong.
This could be solved if we had some kind of "ALTER CURRENT DATABASE"
command, but we don't.
That's a good point; any such change might involve the addition of
"ALTER CURRENT DATABASE" which would be good in and of itself, I think.
But I note that, when one restores to an existing database, pg_restore
*does* know the DB name (it's on the command line). So it could issue
the 'ALTER DATABASE <name>' commands, I think.
> Plus there's the question of how the results would interact with
> any existing DB-level settings. I'm not really sure that issuing
> such commands against a pre-existing DB is a good idea ...
I think it is a good idea, at least for what I think is a common use
case:
- pg_dump someDb
- Create new test DB: create database someTestDb;
- pg_restore -> someTestDb
I came to this problem because I naively expected this to make a
functionally equivalent database copy. It did not. Text search failed.
There may be other settings that materially affect functionality.
I don't mind if performance-related and backend related settings are not
copied (though it should be an option), but actually having a
dump/restore create a non-functional DB seems wrong to me.
Worst case scenario (for backward compatibility) this would need to be
an optional behaviour.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2025-11-10 04:00:03 | Re: pg_createsubscriber --dry-run logging concerns |
| Previous Message | Michael Paquier | 2025-11-10 03:31:50 | Re: Add tests for object size limits of injection points |