From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix RI_Initial_Check to use a COLLATE clause when needed in its |
Date: | 2011-04-12 01:33:07 |
Message-ID: | E1Q9STb-0000du-Mn@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix RI_Initial_Check to use a COLLATE clause when needed in its query.
If the referencing and referenced columns have different collations,
the parser will be unable to resolve which collation to use unless it's
helped out in this way. The effects are sometimes masked, if we end up
using a non-collation-sensitive plan; but if we do use a mergejoin
we'll see a failure, as recently noted by Robert Haas.
The SQL spec states that the referenced column's collation should be used
to resolve RI checks, so that's what we do. Note however that we currently
don't append a COLLATE clause when writing a query that examines only the
referencing column. If we ever support collations that have varying
notions of equality, that will have to be changed. For the moment, though,
it's preferable to leave it off so that we can use a normal index on the
referencing column.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/921b993677e165607029a52e7f866bbd112345a5
Modified Files
--------------
src/backend/parser/parse_relation.c | 18 ++++++++++
src/backend/utils/adt/ri_triggers.c | 57 +++++++++++++++++++++++++++++++++
src/include/parser/parse_relation.h | 1 +
src/test/regress/expected/collate.out | 29 ++++++++++++++++-
src/test/regress/sql/collate.sql | 24 ++++++++++++++
5 files changed, 128 insertions(+), 1 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-04-12 06:00:10 | pgsql: Be more wary of missing statistics in eqjoinsel_semi(). |
Previous Message | User Achernow | 2011-04-11 20:25:38 | libpqtypes - libpqtypes: updated changelog to reflect the correct |