PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
От:
"Mark Jeacocke" <mbj@ezytools.com>
Дата:
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Mark Jeacocke
Your email address : mbj@ezytools.com
System Configuration
---------------------
Architecture (example: Intel Pentium) : AMD Athlon XP 1600
Operating System (example: Linux 2.0.26 ELF) : RedHat Linux 7.0 Kernel
2.4.2
PostgreSQL version (example: PostgreSQL-7.1.3): PostgreSQL-7.1.3
Compiler used (example: gcc 2.95.2) : Downloaded offical RPMS from
Postgres mirror
Please enter a FULL description of your problem:
------------------------------------------------
Seems to be a parsing problem in the select portion of the SQL statement:
select DISTINCT TABLEID, '' AS ALIAS from TABLE; :FAILS
select DISTINCT TABLEID, 'test' AS ALIAS from TABLE; :FAILS
select DISTINCT TABLEID, Null AS ALIAS from TABLE; :FAILS
select DISTINCT TABLEID, trim('') AS ALIAS from TABLE; :SUCCEEDS
select DISTINCT TABLEID, 2 AS ALIAS from TABLE; :SUCCEEDS
I believe all five queries should succeed.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
See above.
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------Re: PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Mark Jeacocke" writes: > select DISTINCT TABLEID, '' AS ALIAS from TABLE; :FAILS We get this type of complaint regularly. Perhaps DISTINCT should resolve unknown-type inputs to "text", much as we do with CASE and UNION constructs when we see an untyped literal. Thoughts? regards, tom lane PS: in the meantime, Mark, try casting the literal to text.
Re: PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Is this a TODO item? Seems so. Comments? --------------------------------------------------------------------------- Tom Lane wrote: > "Mark Jeacocke" writes: > > select DISTINCT TABLEID, '' AS ALIAS from TABLE; :FAILS > > We get this type of complaint regularly. Perhaps DISTINCT should > resolve unknown-type inputs to "text", much as we do with CASE > and UNION constructs when we see an untyped literal. Thoughts? > > regards, tom lane > > PS: in the meantime, Mark, try casting the literal to text. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026