From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | Gregory Stark <stark(at)enterprisedb(dot)com>, Postgres <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PGDay.it collation discussion notes |
Date: | 2008-10-18 15:28:41 |
Message-ID: | 9891.1224343721@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> It's quite straightforward. Every expression has a collation, the COLLATE
> keyword just overrides it. And the collation is a parameter of the
> operators/functions that want to use it. Implementation is also
> straightforward: add expr :: expr COLLATE ident to the bison code and a
> collation oid to the Expr node.
It's fairly irritating to think that a string-specific option is going
to become part of the fundamental type system --- it makes no sense to
distinguish different collations for numeric for instance (and in fact
I would want to see the parser throw an error if you tried to attach a
collation to a non-string type). As for inserting a collation OID in
every single variant of Expr, the answer is "no".
Another objection to this design is that it's completely unclear that
functions from text to text should necessarily yield the same collation
that went into them, but if you treat collation as a hard-wired part of
the expression syntax tree you aren't going to be able to do anything else.
(What will you do about functions/operators taking more than one text
argument?)
I think it would be better to treat the collation indicator as part of
string *values* and let it bubble up through expressions that way.
The "expr COLLATE ident" syntax would be a simple run-time operation
that pokes a new collation into a string value. The notion of a column
having a particular collation would then amount to a check constraint on
the values going into the column.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2008-10-18 16:07:25 | Re: PGDay.it collation discussion notes |
Previous Message | Merlin Moncure | 2008-10-18 15:21:10 | Re: Hot Standby: First integrated patch |