pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
18+ messages / 4 participants
[nested] [flat]

* pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 11:53  rihad <rihad@mail.ru>
  0 siblings, 2 replies; 18+ messages in thread

From: rihad @ 2017-12-22 11:53 UTC (permalink / raw)
  To: pgsql-general

Hi there, this is a reproducible error. We recently pg_upgraded our 
production database to 10.1 from 9.6.6. The upgrade runs fine with the 
suggestion to analyze all data.

[rihad@postgres-10-test]$ cat analyze_new_cluster.sh
#!/bin/sh

echo 'This script will generate minimal optimizer statistics rapidly'
echo 'so your system is usable, and then gather statistics twice more'
echo 'with increasing accuracy.  When it is done, your system will'
echo 'have the default level of optimizer statistics.'
echo

echo 'If you have used ALTER TABLE to modify the statistics target for'
echo 'any tables, you might want to remove them and restore them after'
echo 'running this script because they will delay fast statistics 
generation.'
echo

echo 'If you would like default statistics as quickly as possible, cancel'
echo 'this script and run:'
echo '    "/10.1/bin/vacuumdb" --all --analyze-only'
echo

"/10.1/bin/vacuumdb" --all --analyze-in-stages
echo

echo 'Done'


which we run after the upgrade. It doesn't matter if we do the analyze 
so in a test environment with no activity or run it concurrently with 
the already started production queries.


The problem:


Some of our tables have indices of the form:


     "index_translations_on_locale_and_key" UNIQUE, btree (locale, key)

  locale     | character varying(255)      |           | |
  key        | character varying(255)      |           |          |


or


     "index_users_on_email_and_type" UNIQUE, btree (email, type)

  email           | character varying(255)      |           | not null | 
''::character varying
  type            | character varying           |           | not null |


(these are different tables)

Trying to find data using the specified indices fails to find matching rows:


foo=# select * from translations where locale='de' and 
key='extranet.options.places.age_brackets_hints.a';
  id | locale | key | value | created_at | updated_at | resolved
----+--------+-----+-------+------------+------------+----------
(0 rows)

foo=# explain select * from translations where locale='de' and 
key='extranet.options.places.age_brackets_hints.a';
                                                        QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
  Index Scan using index_translations_on_locale_and_key on translations  
(cost=0.41..2.63 rows=1 width=234)
    Index Cond: (((locale)::text = 'de'::text) AND ((key)::text = 
'extranet.options.places.age_brackets_hints.a'::text))
(2 rows)


reindexing the table fixes the issue:


foo=# reindex index index_translations_on_locale_and_key ;
REINDEX
foo=# select * from translations where locale='de' and 
key='extranet.options.places.age_brackets_hints.a';
    id   | locale |                     key |                        
value                        | created_at         |         
updated_at         | resolved
--------+--------+----------------------------------------------+-----------------------------------------------------+----------------------------+----------------------------+----------
  136373 | de     | extranet.options.places.age_brackets_hints.a | Alter 
für einen vollen Gast-Tarif, z.B ab 12 Jahre  | 2017-08-22 
11:27:27.774259 | 2017-09-02 09:05:45.244927 | f
(1 row)

foo=# explain select * from translations where locale='de' and 
key='extranet.options.places.age_brackets_hints.a';
                                                        QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
  Index Scan using index_translations_on_locale_and_key on translations  
(cost=0.41..2.63 rows=1 width=234)
    Index Cond: (((locale)::text = 'de'::text) AND ((key)::text = 
'extranet.options.places.age_brackets_hints.a'::text))
(2 rows)



The upgrade guide states that only hash indices should be rebuilt after 
the upgrade, not btree ones.





^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 11:56  rihad <rihad@mail.ru>
  0 siblings, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 11:56 UTC (permalink / raw)
  To: pgsql-general

I forgot to mention the real problem: the mentioned unique constraint 
didn't work and allowed duplicate rows to get inserted into the table 
until the duplicates were manually removed the the index was rebuilt.




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 13:09  Magnus Hagander <magnus@hagander.net>
  parent: rihad <rihad@mail.ru>
  1 sibling, 1 reply; 18+ messages in thread

From: Magnus Hagander @ 2017-12-22 13:09 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; +Cc: pgsql-general

On Fri, Dec 22, 2017 at 12:53 PM, rihad <rihad@mail.ru> wrote:

> Hi there, this is a reproducible error. We recently pg_upgraded our
> production database to 10.1 from 9.6.6. The upgrade runs fine with the
> suggestion to analyze all data.
>
> [rihad@postgres-10-test]$ cat analyze_new_cluster.sh
> #!/bin/sh
>
> echo 'This script will generate minimal optimizer statistics rapidly'
> echo 'so your system is usable, and then gather statistics twice more'
> echo 'with increasing accuracy.  When it is done, your system will'
> echo 'have the default level of optimizer statistics.'
> echo
>
> echo 'If you have used ALTER TABLE to modify the statistics target for'
> echo 'any tables, you might want to remove them and restore them after'
> echo 'running this script because they will delay fast statistics
> generation.'
> echo
>
> echo 'If you would like default statistics as quickly as possible, cancel'
> echo 'this script and run:'
> echo '    "/10.1/bin/vacuumdb" --all --analyze-only'
> echo
>
> "/10.1/bin/vacuumdb" --all --analyze-in-stages
> echo
>
> echo 'Done'
>
>
> which we run after the upgrade. It doesn't matter if we do the analyze so
> in a test environment with no activity or run it concurrently with the
> already started production queries.
>
>
> The problem:
>
>
> Some of our tables have indices of the form:
>
>
>     "index_translations_on_locale_and_key" UNIQUE, btree (locale, key)
>
>  locale     | character varying(255)      |           | |
>  key        | character varying(255)      |           |          |
>
>
> or
>
>
>     "index_users_on_email_and_type" UNIQUE, btree (email, type)
>
>  email           | character varying(255)      |           | not null |
> ''::character varying
>  type            | character varying           |           | not null |
>
>
> (these are different tables)
>
> Trying to find data using the specified indices fails to find matching
> rows:
>
>
> foo=# select * from translations where locale='de' and
> key='extranet.options.places.age_brackets_hints.a';
>  id | locale | key | value | created_at | updated_at | resolved
> ----+--------+-----+-------+------------+------------+----------
> (0 rows)
>
> foo=# explain select * from translations where locale='de' and
> key='extranet.options.places.age_brackets_hints.a';
>                                                        QUERY PLAN
> ------------------------------------------------------------
> ------------------------------------------------------------
>  Index Scan using index_translations_on_locale_and_key on translations
> (cost=0.41..2.63 rows=1 width=234)
>    Index Cond: (((locale)::text = 'de'::text) AND ((key)::text =
> 'extranet.options.places.age_brackets_hints.a'::text))
> (2 rows)
>
>
> reindexing the table fixes the issue:
>
>
> foo=# reindex index index_translations_on_locale_and_key ;
> REINDEX
> foo=# select * from translations where locale='de' and
> key='extranet.options.places.age_brackets_hints.a';
>    id   | locale |                     key |
> value                        | created_at         |
> updated_at         | resolved
> --------+--------+------------------------------------------
> ----+-----------------------------------------------------+-
> ---------------------------+----------------------------+----------
>  136373 | de     | extranet.options.places.age_brackets_hints.a | Alter
> für einen vollen Gast-Tarif, z.B ab 12 Jahre  | 2017-08-22 11:27:27.774259
> | 2017-09-02 09:05:45.244927 | f
> (1 row)
>
> foo=# explain select * from translations where locale='de' and
> key='extranet.options.places.age_brackets_hints.a';
>                                                        QUERY PLAN
> ------------------------------------------------------------
> ------------------------------------------------------------
>  Index Scan using index_translations_on_locale_and_key on translations
> (cost=0.41..2.63 rows=1 width=234)
>    Index Cond: (((locale)::text = 'de'::text) AND ((key)::text =
> 'extranet.options.places.age_brackets_hints.a'::text))
> (2 rows)
>
>
>
> The upgrade guide states that only hash indices should be rebuilt after
> the upgrade, not btree ones.
>
>
>
What platform are you on, how was PostgreSQL installed, and exactly how was
pg_upgrade executed? (or is, since it's reproducible)


-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/;
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 13:09  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: rihad <rihad@mail.ru>
  1 sibling, 1 reply; 18+ messages in thread

From: Laurenz Albe @ 2017-12-22 13:09 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; pgsql-general

rihad wrote:
> Hi there, this is a reproducible error. We recently pg_upgraded our 
> production database to 10.1 from 9.6.6. The upgrade runs fine with the 
> suggestion to analyze all data.

[...]

> Trying to find data using the specified indices fails to find matching rows:

[...]

> reindexing the table fixes the issue:

Did you also upgrade the operating system or at least libc?

Then the problem could come from a modified collation.
Compare https://www.postgresql.org/message-id/CB4D1C6BAA80CF146CB0D4F2%40eje.credativ.lan

Yours,
Laurenz Albe




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 13:32  Peter Geoghegan <pg@bowt.ie>
  parent: rihad <rihad@mail.ru>
  0 siblings, 2 replies; 18+ messages in thread

From: Peter Geoghegan @ 2017-12-22 13:32 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; +Cc: pgsql-general

On Fri, Dec 22, 2017 at 11:56 AM, rihad <rihad@mail.ru> wrote:
> I forgot to mention the real problem: the mentioned unique constraint didn't
> work and allowed duplicate rows to get inserted into the table until the
> duplicates were manually removed the the index was rebuilt.

You should run amcheck functions on both environments, against all
indexes, to see where the inconsistency arose, and to isolate any
other inconsistencies that may have been missed. While amcheck is
available from contrib in Postgres 10, you can get a version that will
work on other versions through OS packages for most major Linux
distributions. See:

https://github.com/petergeoghegan/amcheck

Note also that only this external version has the "heapallindexed" check.

-- 
Peter Geoghegan




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 14:42  rihad <rihad@mail.ru>
  parent: Magnus Hagander <magnus@hagander.net>
  0 siblings, 0 replies; 18+ messages in thread

From: rihad @ 2017-12-22 14:42 UTC (permalink / raw)
  To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-general

On 12/22/2017 05:09 PM, Magnus Hagander wrote:
> What platform are you on
FreeBSD 10.3-RELEASE-p26 amd64


> , how was PostgreSQL installed
pkg install.
Additionally, 10.1 needed for pg_upgrade to run was installed using 
portmaster -m PREFIX=/10.1, because FreeBSD doesn't allow more than one 
major version to be installed simultaneously.
After the upgrade took place, 9.6.6 was pkg deleted and 10.1 was pkg 
installed.


> and exactly how was pg_upgrade executed? (or is, since it's reproducible)
>

sudo -u postgres /10.1/bin/pg_upgrade -j2 --link -r -b /usr/local/bin -B 
/10.1/bin/ -d /var/db/postgres/data96/ -D /var/db/postgres/data10/

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 14:50  rihad <rihad@mail.ru>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 14:50 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-general

On 12/22/2017 05:09 PM, Laurenz Albe wrote:
> rihad wrote:
>> Hi there, this is a reproducible error. We recently pg_upgraded our
>> production database to 10.1 from 9.6.6. The upgrade runs fine with the
>> suggestion to analyze all data.
> [...]
>
>> Trying to find data using the specified indices fails to find matching rows:
> [...]
>
>> reindexing the table fixes the issue:
> Did you also upgrade the operating system or at least libc?
It looks like it.

$ ll /lib/libc.so.7
-r--r--r--  1 root  wheel  1647104 Jun 19  2017 /lib/libc.so.7

this never was a major/minor OS upgrade, just whatever FreeBSD patch 
releases included.

>
> Then the problem could come from a modified collation.
> Compare https://www.postgresql.org/message-id/CB4D1C6BAA80CF146CB0D4F2%40eje.credativ.lan

de (German) was just an example, the inability to find matching rows 
affected other languages like fr or even en, too.
It does look like a collation issue, though.




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 14:55  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: rihad <rihad@mail.ru>
  0 siblings, 0 replies; 18+ messages in thread

From: Laurenz Albe @ 2017-12-22 14:55 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; pgsql-general

rihad wrote:
> On 12/22/2017 05:09 PM, Laurenz Albe wrote:
> > rihad wrote:
> > > Hi there, this is a reproducible error. We recently pg_upgraded our
> > > production database to 10.1 from 9.6.6. The upgrade runs fine with the
> > > suggestion to analyze all data.
> > 
> > [...]
> > 
> > > Trying to find data using the specified indices fails to find matching rows:
> > 
> > [...]
> > 
> > > reindexing the table fixes the issue:
> > 
> > Did you also upgrade the operating system or at least libc?
> 
> It looks like it.
> 
> $ ll /lib/libc.so.7
> -r--r--r--  1 root  wheel  1647104 Jun 19  2017 /lib/libc.so.7
> 
> this never was a major/minor OS upgrade, just whatever FreeBSD patch 
> releases included.
> 
> > Then the problem could come from a modified collation.
> > Compare https://www.postgresql.org/message-id/CB4D1C6BAA80CF146CB0D4F2%40eje.credativ.lan
> 
> de (German) was just an example, the inability to find matching rows 
> affected other languages like fr or even en, too.
> It does look like a collation issue, though.

That would be the best thing, because it would mean that there is no
PostgreSQL bug or hardware problem, and REINDEX will fix the problem.

Yours,
Laurenz Albe




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 15:01  rihad <rihad@mail.ru>
  parent: Peter Geoghegan <pg@bowt.ie>
  1 sibling, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 15:01 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-general

On 12/22/2017 05:32 PM, Peter Geoghegan wrote:
> On Fri, Dec 22, 2017 at 11:56 AM, rihad <rihad@mail.ru> wrote:
>> I forgot to mention the real problem: the mentioned unique constraint didn't
>> work and allowed duplicate rows to get inserted into the table until the
>> duplicates were manually removed the the index was rebuilt.
> You should run amcheck functions on both environments, against all
> indexes, to see where the inconsistency arose, and to isolate any
> other inconsistencies that may have been missed. While amcheck is
> available from contrib in Postgres 10, you can get a version that will
> work on other versions through OS packages for most major Linux
> distributions. See:
>
> https://github.com/petergeoghegan/amcheck
>
> Note also that only this external version has the "heapallindexed" check.
>
Hm, interesting. It doesn't look like FreeBSD ports include the amcheck 
extension, but I could still use the versions bundled with postgres 
10.1-contrib.

Also, the version included doesn't allow a second boolean argument.

I first ran it on a reindexed index, which didn't show any problems, as 
expected.

Then I ran it on an unfixed broken index.

foo=# create extension amcheck;
CREATE EXTENSION

foo=# select bt_index_check('index_translations_on_locale_and_key');
  bt_index_check
----------------

(1 row)

foo=# select bt_index_check('index_users_on_email_and_type');
ERROR:  item order invariant violated for index 
"index_users_on_email_and_type"
DETAIL:  Lower index tid=(3,25) (points to index tid=(26,1)) higher 
index tid=(3,26) (points to index tid=(27,1)) page lsn=0/0.





^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 15:07  rihad <rihad@mail.ru>
  parent: rihad <rihad@mail.ru>
  0 siblings, 0 replies; 18+ messages in thread

From: rihad @ 2017-12-22 15:07 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-general

On 12/22/2017 07:01 PM, rihad wrote:
> [snip]
> foo=# select bt_index_check('index_users_on_email_and_type');
> ERROR:  item order invariant violated for index 
> "index_users_on_email_and_type"
> DETAIL:  Lower index tid=(3,25) (points to index tid=(26,1)) higher 
> index tid=(3,26) (points to index tid=(27,1)) page lsn=0/0.
>

Interestingly, another (varchar,varchar) index on a completely different 
table doesn't have the problem because it probably doesn't contain any 
non-ascii symbols.


  gateway_reference | character varying(255)      | |          |
  gateway_name      | character varying           | |          |

foo=# select 
bt_index_check('index_transactions_on_gateway_name_and_gateway_reference');
  bt_index_check
----------------

(1 row)






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 15:18  rihad <rihad@mail.ru>
  parent: Peter Geoghegan <pg@bowt.ie>
  1 sibling, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 15:18 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-general

I wonder why the errors don't show up under 9.6.6 and only started 
appearing after the pg_upgrade to 10.1?
Both severs naturally used the same OS environment.




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 15:43  Peter Geoghegan <pg@bowt.ie>
  parent: rihad <rihad@mail.ru>
  0 siblings, 1 reply; 18+ messages in thread

From: Peter Geoghegan @ 2017-12-22 15:43 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; +Cc: pgsql-general

I have no idea. Maybe something to do with not actually using the same
collation provider?

The freebsd package contains modifications to make icu work, or at least
did. Possibly, you just stopped using the same collation provider, without
even realizing it, because they switched over to a new provider without
accounting for pg_upgrade. If so, then that's a bug in the package. This is
a total speculation, but makes a certain amount of sense to me.

--
Peter Geoghegan
(Sent from my phone)

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 15:52  rihad <rihad@mail.ru>
  parent: Peter Geoghegan <pg@bowt.ie>
  0 siblings, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 15:52 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-general

On 12/22/2017 07:43 PM, Peter Geoghegan wrote:
> I have no idea. Maybe something to do with not actually using the same 
> collation provider?
>
> The freebsd package contains modifications to make icu work, or at 
> least did. Possibly, you just stopped using the same collation 
> provider, without even realizing it, because they switched over to a 
> new provider without accounting for pg_upgrade. If so, then that's a 
> bug in the package. This is a total speculation, but makes a certain 
> amount of sense to me.

Exactly!

9.6.6 port options include ICU:
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_UNSET+=DTRACE
OPTIONS_FILE_UNSET+=GSSAPI
OPTIONS_FILE_SET+=ICU
OPTIONS_FILE_SET+=INTDATE
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=NLS
OPTIONS_FILE_UNSET+=OPTIMIZED_CFLAGS
OPTIONS_FILE_UNSET+=PAM
OPTIONS_FILE_UNSET+=SSL
OPTIONS_FILE_SET+=TZDATA
OPTIONS_FILE_SET+=XML
OPTIONS_FILE_UNSET+=MIT_KRB5
OPTIONS_FILE_UNSET+=HEIMDAL_KRB5

10.1 options don't:
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_UNSET+=DTRACE
OPTIONS_FILE_UNSET+=GSSAPI
OPTIONS_FILE_SET+=INTDATE
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=NLS
OPTIONS_FILE_UNSET+=OPTIMIZED_CFLAGS
OPTIONS_FILE_UNSET+=PAM
OPTIONS_FILE_UNSET+=SSL
OPTIONS_FILE_SET+=TZDATA
OPTIONS_FILE_SET+=XML

Thank you and others who have responded so much for your tips!




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 16:07  Peter Geoghegan <pg@bowt.ie>
  parent: rihad <rihad@mail.ru>
  0 siblings, 1 reply; 18+ messages in thread

From: Peter Geoghegan @ 2017-12-22 16:07 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; +Cc: pgsql-general

Please report this as a bug to the freebsd package maintainer.

--
Peter Geoghegan
(Sent from my phone)

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 16:16  rihad <rihad@mail.ru>
  parent: Peter Geoghegan <pg@bowt.ie>
  0 siblings, 1 reply; 18+ messages in thread

From: rihad @ 2017-12-22 16:16 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-general

On 12/22/2017 08:07 PM, Peter Geoghegan wrote:
> Please report this as a bug to the freebsd package maintainer.

You mean they would have to bring back ICU support as an option? Ok, 
I'll try to report the problem.




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 16:31  Peter Geoghegan <pg@bowt.ie>
  parent: rihad <rihad@mail.ru>
  0 siblings, 0 replies; 18+ messages in thread

From: Peter Geoghegan @ 2017-12-22 16:31 UTC (permalink / raw)
  To: rihad <rihad@mail.ru>; +Cc: pgsql-general

On Fri, Dec 22, 2017 at 4:16 PM, rihad <rihad@mail.ru> wrote:
> You mean they would have to bring back ICU support as an option? Ok, I'll
> try to report the problem.

The FreeBSD package previously contained a hacked-in ICU library,
meaning that the version of Postgres shipped with FreeBSD was
technically a fork, in order to compensate for the previous lack of
collations/locales in FreeBSD's libc. Now that FreeBSD has built-in
libc collations, and now that ICU is available as an option (a fully
recognized alternative "collation provider") in Postgres 10, it would
make sense for FreeBSD to "unfork", which is what I assume happened
here. As I said, it's not that much of a stretch to suppose that
pg_upgrade was overlooked, because at least everything else would work
fine.

The way that ICU was supported (which presumably changed with the
"unfork") is going to break Postgres assumptions about the
immutability of OS collations. IIRC, the forked code more or less
pretended that ICU functions were the actual OS libc collation
functions (which are assumed immutable). If I have everything right
here, this is more or less equivalent to a total behavioral change in
OS collations, even though the OS collation behavior apparently did
not change.

I'm currently feeling too lazy to check that I guessed right about all
of this, but somebody should look into it.

-- 
Peter Geoghegan




^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 16:58  rihad <rihad@mail.ru>
  1 sibling, 0 replies; 18+ messages in thread

From: rihad @ 2017-12-22 16:58 UTC (permalink / raw)
  To: pg@bowt.ie; +Cc: pgsql-general

Here's the prompt response I got from the maintainer of FreeBSD package, 
girgen@



-------- Forwarded Message --------
Subject: 	Re: pg_upgrading to 10.1 breaks some indices maybe due to 
changing providers for ICU
Date: 	Fri, 22 Dec 2017 17:44:41 +0100
From: 	Palle Girgensohn <girgen@pingpong.net>
To: 	rihad <rihad@mail.ru>



Yes that is a knogen problem. I ahould document it better. The Built in support for icu is not the same as the patch. For upgrade to work and indeed for expected old behaviour of icu to work, the patch still needs to be applied for pg10. This work has not been done yet.

Palle

> 22 dec. 2017 kl. 17:22 skrev rihad <rihad@mail.ru>:
> 
> Hi, please see my original post describing the problem: https://www.postgresql.org/message-id/e6f53eeb-ef46-3095-cd34-88550904fa02%40mail.ru
> 
> and a reply for a possible cause: https://www.postgresql.org/message-id/e6f53eeb-ef46-3095-cd34-88550904fa02%40mail.ru
> 
.

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices
@ 2017-12-22 16:58  rihad <rihad@mail.ru>
  1 sibling, 0 replies; 18+ messages in thread

From: rihad @ 2017-12-22 16:58 UTC (permalink / raw)
  To: pg@bowt.ie; +Cc: pgsql-general

Here's the prompt response I got from the maintainer of FreeBSD package, 
girgen@



-------- Forwarded Message --------
Subject: 	Re: pg_upgrading to 10.1 breaks some indices maybe due to 
changing providers for ICU
Date: 	Fri, 22 Dec 2017 17:44:41 +0100
From: 	Palle Girgensohn <girgen@pingpong.net>
To: 	rihad <rihad@mail.ru>



Yes that is a knogen problem. I ahould document it better. The Built in support for icu is not the same as the patch. For upgrade to work and indeed for expected old behaviour of icu to work, the patch still needs to be applied for pg10. This work has not been done yet.

Palle

> 22 dec. 2017 kl. 17:22 skrev rihad <rihad@mail.ru>:
> 
> Hi, please see my original post describing the problem: https://www.postgresql.org/message-id/e6f53eeb-ef46-3095-cd34-88550904fa02%40mail.ru
> 
> and a reply for a possible cause: https://www.postgresql.org/message-id/e6f53eeb-ef46-3095-cd34-88550904fa02%40mail.ru
> 
.

^ permalink  raw  reply  [nested|flat] 18+ messages in thread


end of thread, other threads:[~2017-12-22 16:58 UTC | newest]

Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 11:53 pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices rihad <rihad@mail.ru>
2017-12-22 13:09 ` Magnus Hagander <magnus@hagander.net>
2017-12-22 14:42   ` rihad <rihad@mail.ru>
2017-12-22 13:09 ` Laurenz Albe <laurenz.albe@cybertec.at>
2017-12-22 14:50   ` rihad <rihad@mail.ru>
2017-12-22 14:55     ` Laurenz Albe <laurenz.albe@cybertec.at>
2017-12-22 11:56 pg_upgrading to 10.1 corrupts (varchar,varchar) UNIQUE indices rihad <rihad@mail.ru>
2017-12-22 13:32 ` Peter Geoghegan <pg@bowt.ie>
2017-12-22 15:01   ` rihad <rihad@mail.ru>
2017-12-22 15:07     ` rihad <rihad@mail.ru>
2017-12-22 15:18   ` rihad <rihad@mail.ru>
2017-12-22 15:43     ` Peter Geoghegan <pg@bowt.ie>
2017-12-22 15:52       ` rihad <rihad@mail.ru>
2017-12-22 16:07         ` Peter Geoghegan <pg@bowt.ie>
2017-12-22 16:16           ` rihad <rihad@mail.ru>
2017-12-22 16:31             ` Peter Geoghegan <pg@bowt.ie>
2017-12-22 16:58 ` rihad <rihad@mail.ru>
2017-12-22 16:58 ` rihad <rihad@mail.ru>

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