Re: \crosstabview fixes - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: \crosstabview fixes
Date
Msg-id bc3a2e99-5030-4466-a248-98c5e9841205@mm
Whole thread Raw
In response to Re: \crosstabview fixes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: \crosstabview fixes  (Christoph Berg <myon@debian.org>)
List pgsql-hackers
    Tom Lane wrote:

> > That would be OK with me; it's certainly less of a hack than what's
> > there now.  (I went back and forth about how much effort to put into
> > dealing with the colon syntax; I think the version I have in my patch
> > would be all right, but it's not perfect.)
>
> Here's a patch along those lines.  Any objections?

There's the issue that it can no longer distinguish between numbers as
column positions and column names that consist entirely of numbers.

For example, before the patch:
=# SELECT 'a' as "4", 'b' as "5", 'x'  \crosstabview "4" "5"4 | b
---+---a | x

After the patch:
=# SELECT 'a' as "4", 'b' as "5", 'x' \crosstabview "4" "5"
\crosstabview: invalid column number: "4"

crosstabview's parseColumnRefs() knows that "4" is a column
name because of the quotes, but once it's replaced by the psql
ident parser, I guess the quotes are removed and the argument
becomes a bare number.

I don't quite see how to work around that, short of simply
removing the possibility of addressing columns by their
numbers. Which maybe is a bit sad for the end user, I'm not
sure, but ISTM that's a logical consequence of abandoning
the dedicated parser for columns.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: \crosstabview fixes
Next
From: Christoph Berg
Date:
Subject: Re: \crosstabview fixes