"Daniel Verite" <daniel@manitou-mail.org> writes:
> Christoph Berg wrote:
>> If there's no way out, what about changing it the other way, i.e.
>> breaking the case where the column is named by a number? That seems
>> much less of a problem in practice.
> I don't think it would be acceptable.
I had figured it would be ;-) ... but if you object, let's see what
it would take to preserve that.
My feeling is that what we should do is undo the change to use OT_SQLID,
and in indexOfColumn() perform a downcasing/dequoting conversion that
duplicates what OT_SQLID does in psqlscanslash.l. That only adds a couple
dozen lines of code, so it will still be way smaller than the existing
logic in crosstabview.c, and it will match the behavior of the rest of
psql. By postponing that till after the "is it a number" check, we
restore the current behavior that a quoted number won't be taken as a
column number.
(Another approach would be to somehow modify psqlscanslash.l's API so that
we could tell externally whether an argument had been quoted or not. But
that would be much more invasive, and I doubt it's worth it for this one
use-case.)
I'll have a patch after I finish catching up the rest of my mail.
regards, tom lane