pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
10+ messages / 4 participants
[nested] [flat]
* ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-22 19:17 Tomas Pospisek <tpo2@sourcepole.ch>
0 siblings, 1 reply; 10+ messages in thread
From: Tomas Pospisek @ 2022-06-22 19:17 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi all,
while doing `cat pg_dump.dump | psql` I get the above message. Note that
`pg_dump.dump` contains:
CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING =
'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
What is exactly the problem? I understand that en_US.UTF-8 and
en_US.utf-8 is not *exactly* the same string.
However I do not understand how the difference came to be. And I do not
know what the "right" way is and how to proceed from here.
If I `pg_dump --create` some DB on the new server (13.7-1.pgdg18.04+1) I
get:
CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8';
When I do the same on the old server (12.8-1.pgdg20.04+1) I get:
CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8';
Any hints or help?
*t
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-22 19:25 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Tomas Pospisek <tpo2@sourcepole.ch>
0 siblings, 1 reply; 10+ messages in thread
From: Adrian Klaver @ 2022-06-22 19:25 UTC (permalink / raw)
To: Tomas Pospisek <tpo2@sourcepole.ch>; pgsql-general@lists.postgresql.org
On 6/22/22 12:17, Tomas Pospisek wrote:
> Hi all,
>
> while doing `cat pg_dump.dump | psql` I get the above message. Note that
> `pg_dump.dump` contains:
>
> CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING =
> 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
>
> What is exactly the problem? I understand that en_US.UTF-8 and
> en_US.utf-8 is not *exactly* the same string.
>
> However I do not understand how the difference came to be. And I do not
> know what the "right" way is and how to proceed from here.
>
> If I `pg_dump --create` some DB on the new server (13.7-1.pgdg18.04+1) I
> get:
>
> CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8';
>
> When I do the same on the old server (12.8-1.pgdg20.04+1) I get:
>
> CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8'
> LC_CTYPE = 'en_US.UTF-8';
>
> Any hints or help?
Are dumping/restoring from one version of Postgres to another?
If from older to newer then use the new version of pg_dump(13) to dump
the older(12) database. Then the 13 version of restore to load the
version 13 database.
> *t
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-22 20:18 Tomas Pospisek <tpo2@sourcepole.ch>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 10+ messages in thread
From: Tomas Pospisek @ 2022-06-22 20:18 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org
On 22.06.22 21:25, Adrian Klaver wrote:
> On 6/22/22 12:17, Tomas Pospisek wrote:
>> Hi all,
>>
>> while doing `cat pg_dump.dump | psql` I get the above message. Note
>> that `pg_dump.dump` contains:
>>
>> CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING
>> = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
>>
>> What is exactly the problem? I understand that en_US.UTF-8 and
>> en_US.utf-8 is not *exactly* the same string.
>>
>> However I do not understand how the difference came to be. And I do
>> not know what the "right" way is and how to proceed from here.
>>
>> If I `pg_dump --create` some DB on the new server (13.7-1.pgdg18.04+1)
>> I get:
>>
>> CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8';
>>
>> When I do the same on the old server (12.8-1.pgdg20.04+1) I get:
>>
>> CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8'
>> LC_CTYPE = 'en_US.UTF-8';
>>
>> Any hints or help?
>
> Are dumping/restoring from one version of Postgres to another?
Yes, indeed!
> If from older to newer then use the new version of pg_dump(13) to dump
> the older(12) database. Then the 13 version of restore to load the
> version 13 database.
I will. Thanks a lot Adrian!
*t
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-22 23:26 Tom Lane <tgl@sss.pgh.pa.us>
parent: Tomas Pospisek <tpo2@sourcepole.ch>
1 sibling, 0 replies; 10+ messages in thread
From: Tom Lane @ 2022-06-22 23:26 UTC (permalink / raw)
To: Tomas Pospisek <tpo2@sourcepole.ch>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org
Tomas Pospisek <tpo2@sourcepole.ch> writes:
> On 22.06.22 21:25, Adrian Klaver wrote:
>> On 6/22/22 12:17, Tomas Pospisek wrote:
>>> If I `pg_dump --create` some DB on the new server (13.7-1.pgdg18.04+1)
>>> I get:
>>>
>>> CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8';
>>>
>>> When I do the same on the old server (12.8-1.pgdg20.04+1) I get:
>>>
>>> CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8'
>>> LC_CTYPE = 'en_US.UTF-8';
>> Are dumping/restoring from one version of Postgres to another?
> Yes, indeed!
This is probably more about dumping from different operating systems.
The spelling of the locale name is under the control of the OS,
and Postgres doesn't know very much about the semantics of it
(so I think we conservatively assume that any difference in
spelling is significant).
Best bet might be to edit the dump file to adjust the locale
spellings to match your new system.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-23 07:37 Tomas Pospisek <tpo2@sourcepole.ch>
parent: Tomas Pospisek <tpo2@sourcepole.ch>
1 sibling, 1 reply; 10+ messages in thread
From: Tomas Pospisek @ 2022-06-23 07:37 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 22.06.22 22:18, Tomas Pospisek wrote:
> On 22.06.22 21:25, Adrian Klaver wrote:
>> On 6/22/22 12:17, Tomas Pospisek wrote:
>>> Hi all,
>>>
>>> while doing `cat pg_dump.dump | psql` I get the above message. Note
>>> that `pg_dump.dump` contains:
>>>
>>> CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING
>>> = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
>>>
>>> What is exactly the problem? I understand that en_US.UTF-8 and
>>> en_US.utf-8 is not *exactly* the same string.
>>>
>>> However I do not understand how the difference came to be. And I do
>>> not know what the "right" way is and how to proceed from here.
>>>
>>> If I `pg_dump --create` some DB on the new server
>>> (13.7-1.pgdg18.04+1) I get:
>>>
>>> CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8';
>>>
>>> When I do the same on the old server (12.8-1.pgdg20.04+1) I get:
>>>
>>> CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8'
>>> LC_CTYPE = 'en_US.UTF-8';
>>>
>>> Any hints or help?
>>
>> Are dumping/restoring from one version of Postgres to another?
>
> Yes, indeed!
>
>> If from older to newer then use the new version of pg_dump(13) to dump
>> the older(12) database. Then the 13 version of restore to load the
>> version 13 database.
>
> I will. Thanks a lot Adrian!
So I used both pg_dump and pg_restore from the newer machine. Result is
still the same. So I'll use Tom Lane's suggestion too and fix the
'UTF-8' spelling in the dump file:
Tom Lane wrote:
> This is probably more about dumping from different operating systems.
> The spelling of the locale name is under the control of the OS,
> and Postgres doesn't know very much about the semantics of it
> (so I think we conservatively assume that any difference in
> spelling is significant).
>
> Best bet might be to edit the dump file to adjust the locale
> spellings to match your new system.
Many thanks to both Tom & Adrian!!!
*t
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-23 17:11 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Tomas Pospisek <tpo2@sourcepole.ch>
0 siblings, 1 reply; 10+ messages in thread
From: Adrian Klaver @ 2022-06-23 17:11 UTC (permalink / raw)
To: Tomas Pospisek <tpo2@sourcepole.ch>; pgsql-general@lists.postgresql.org
On 6/23/22 00:37, Tomas Pospisek wrote:
> On 22.06.22 22:18, Tomas Pospisek wrote:
>> On 22.06.22 21:25, Adrian Klaver wrote:
>>> On 6/22/22 12:17, Tomas Pospisek wrote:
>
> So I used both pg_dump and pg_restore from the newer machine. Result is
> still the same. So I'll use Tom Lane's suggestion too and fix the
> 'UTF-8' spelling in the dump file:
Not sure why that is necessary? Is seems this is low hanging fruit that
could dealt with by the equivalent of lower('en_US.UTF-8') =
lower('en_US.utf-8').
>
> Tom Lane wrote:
>
> > This is probably more about dumping from different operating systems.
> > The spelling of the locale name is under the control of the OS,
> > and Postgres doesn't know very much about the semantics of it
> > (so I think we conservatively assume that any difference in
> > spelling is significant).
> >
> > Best bet might be to edit the dump file to adjust the locale
> > spellings to match your new system.
>
> Many thanks to both Tom & Adrian!!!
> *t
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-23 18:21 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 10+ messages in thread
From: Adrian Klaver @ 2022-06-23 18:21 UTC (permalink / raw)
To: Tomas Pospisek <tpo2@sourcepole.ch>; pgsql-general@lists.postgresql.org
On 6/23/22 10:11, Adrian Klaver wrote:
> On 6/23/22 00:37, Tomas Pospisek wrote:
>> On 22.06.22 22:18, Tomas Pospisek wrote:
>>> On 22.06.22 21:25, Adrian Klaver wrote:
>>>> On 6/22/22 12:17, Tomas Pospisek wrote:
>
>>
>> So I used both pg_dump and pg_restore from the newer machine. Result
>> is still the same. So I'll use Tom Lane's suggestion too and fix the
>> 'UTF-8' spelling in the dump file:
>
> Not sure why that is necessary? Is seems this is low hanging fruit that
> could dealt with by the equivalent of lower('en_US.UTF-8') =
> lower('en_US.utf-8').
Well that was clear as mud. My point was that I don't see why the end
user should have to do this when it could be handled internally in the
pg_restore code.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-24 08:11 Tomas Pospisek <tpo2@sourcepole.ch>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 10+ messages in thread
From: Tomas Pospisek @ 2022-06-24 08:11 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org
On 23.06.22 20:21, Adrian Klaver wrote:
> On 6/23/22 10:11, Adrian Klaver wrote:
>> On 6/23/22 00:37, Tomas Pospisek wrote:
>>> On 22.06.22 22:18, Tomas Pospisek wrote:
>>>> On 22.06.22 21:25, Adrian Klaver wrote:
>>>>> On 6/22/22 12:17, Tomas Pospisek wrote:
>>
>>>
>>> So I used both pg_dump and pg_restore from the newer machine. Result
>>> is still the same. So I'll use Tom Lane's suggestion too and fix the
>>> 'UTF-8' spelling in the dump file:
>>
>> Not sure why that is necessary? Is seems this is low hanging fruit
>> that could dealt with by the equivalent of lower('en_US.UTF-8') =
>> lower('en_US.utf-8').
>
> Well that was clear as mud.
:-D
> My point was that I don't see why the end
> user should have to do this when it could be handled internally in the
> pg_restore code.
That would indeed be very friendly of pg_restore if it'd take that
little task off the user :-)
+1 of course :-)
*t
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-24 11:21 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 1 reply; 10+ messages in thread
From: Peter Eisentraut @ 2022-06-24 11:21 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; Tomas Pospisek <tpo2@sourcepole.ch>; pgsql-general@lists.postgresql.org
On 23.06.22 20:21, Adrian Klaver wrote:
>> Not sure why that is necessary? Is seems this is low hanging fruit
>> that could dealt with by the equivalent of lower('en_US.UTF-8') =
>> lower('en_US.utf-8').
>
> Well that was clear as mud. My point was that I don't see why the end
> user should have to do this when it could be handled internally in the
> pg_restore code.
There are also cases where on one system the locale is spelled
xx_YY.UTF8 and on another xx_YY.UTF-8. If we start adjusting for case,
should we adjust for this as well? What other cases are there?
So this would need a bit more research.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)
@ 2022-06-24 14:36 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2022-06-24 14:36 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; Tomas Pospisek <tpo2@sourcepole.ch>; pgsql-general@lists.postgresql.org
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> There are also cases where on one system the locale is spelled
> xx_YY.UTF8 and on another xx_YY.UTF-8. If we start adjusting for case,
> should we adjust for this as well? What other cases are there?
> So this would need a bit more research.
Yeah. I would tend to define it as "if the locale names both end
in dot followed by a recognizable encoding name, then (a) make
sure that the encoding values are the same, then (b) strip off
the dot and encoding before comparing the rest". We already have
code to look up encoding names, and it handles all these variants.
So this doesn't seem like it should take much new code, though
maybe some refactoring would be needed to make the lookup code
available where this check is happening.
I'm not personally very excited about this, but if someone wanted
to prepare a patch...
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2022-06-24 14:36 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 19:17 ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8) Tomas Pospisek <tpo2@sourcepole.ch>
2022-06-22 19:25 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-06-22 20:18 ` Tomas Pospisek <tpo2@sourcepole.ch>
2022-06-22 23:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-06-23 07:37 ` Tomas Pospisek <tpo2@sourcepole.ch>
2022-06-23 17:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-06-23 18:21 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-06-24 08:11 ` Tomas Pospisek <tpo2@sourcepole.ch>
2022-06-24 11:21 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-06-24 14:36 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox