pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: luciano@geocontrol.com.br
To: pgsql-bugs@postgresql.org
Subject: BUG #6496: Why the SQL is not reported as incorrect? Is there a builtin column named "name"?
Date: Tue, 28 Feb 2012 15:42:51 +0000
Message-ID: <E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6496
Logged by:          Luciano Barcellos
Email address:      luciano@geocontrol.com.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;





view thread (2+ messages)  latest in thread

Message-ID: <E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org>
Permalink:  ../E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: luciano@geocontrol.com.br
  Subject: Re: BUG #6496: Why the SQL is not reported as incorrect? Is there a builtin column named "name"?
  In-Reply-To: <E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org>
  References: <E1S2PCV-0007Nn-Sm@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox