From: | luciano(at)geocontrol(dot)com(dot)br |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #6496: Why the SQL is not reported as incorrect? Is there a builtin column named "name"? |
Date: | 2012-02-28 15:42:51 |
Message-ID: | E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 6496
Logged by: Luciano Barcellos
Email address: luciano(at)geocontrol(dot)com(dot)br
PostgreSQL version: 8.4.8
Operating system: Debian Squeeze (2.6.32-5-amd64)
Description:
-- Create and populate table
CREATE TABLE public.is_this_a_bug ( "name" VARCHAR(50) );
INSERT INTO public.is_this_a_bug VALUES ( '270I' );
INSERT INTO public.is_this_a_bug VALUES ( '270V' );
INSERT INTO public.is_this_a_bug VALUES ( '520I' );
INSERT INTO public.is_this_a_bug VALUES ( '520V' );
INSERT INTO public.is_this_a_bug VALUES ( '900I' );
INSERT INTO public.is_this_a_bug VALUES ( '900V' );
-- Query table: Ok
SELECT DISTINCT SUBSTRING(bug."name" FROM 1 FOR 3) FROM public.is_this_a_bug
bug;
-- Wrong SQL. Reports no syntax error but yields unexpected data
SELECT s."name" FROM (SELECT DISTINCT SUBSTRING(bug."name" FROM 1 FOR 3)
FROM public.is_this_a_bug bug) s;
-- Fixed SQL.
SELECT s."name" FROM (SELECT DISTINCT SUBSTRING(bug."name" FROM 1 FOR 3) AS
"name" FROM public.is_this_a_bug bug) s;
From | Date | Subject | |
---|---|---|---|
Next Message | rlowe | 2012-02-28 16:23:58 | BUG #6497: Error sent to client, but data written anyway |
Previous Message | Marti Raudsepp | 2012-02-28 14:01:40 | Re: BUG #6489: Alter table with composite type/table |