Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W23HH-0005g3-Ir for pgsql-docs@arkaria.postgresql.org; Sat, 11 Jan 2014 18:27:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W23HG-0004nZ-Vc for pgsql-docs@arkaria.postgresql.org; Sat, 11 Jan 2014 18:27:23 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W23HF-0004nQ-1A for pgsql-docs@postgresql.org; Sat, 11 Jan 2014 18:27:21 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W23H6-0000Nx-Uo for pgsql-docs@postgresql.org; Sat, 11 Jan 2014 18:27:20 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1W23H6-0005V3-52; Sat, 11 Jan 2014 13:27:12 -0500 Date: Sat, 11 Jan 2014 13:27:12 -0500 From: Bruce Momjian To: Greg Smith Cc: pgsql-docs Subject: Re: Reserved word "date" in tutorial example Message-ID: <20140111182712.GC28089@momjian.us> References: <519B8281.10105@2ndQuadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519B8281.10105@2ndQuadrant.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org On Tue, May 21, 2013 at 10:19:45AM -0400, Greg Smith wrote: > doc/src/sgml/query.sgml includes a tutorial example with this definition: > > CREATE TABLE weather ( > ... > date date > ); > > The fact that "date" is used for both the column name and the type > is highlighted by two later comments: > > (Yes, the column of type date is also named date. This might be > convenient or confusing--you choose.) > > type names are not key words in the syntax, except where required > to support special cases in the SQL standard. > > But as a documentation comment submitted recently points out, "date" > *is* a reserved word in the SQL spec: http://www.postgresql.org/docs/current/interactive/sql-keywords-appendix.html > , just not in PostgreSQL. That makes using it as a column name in > an example an odd choice for a tutorial. The example is using the > ambiguity to point out where the line between what is and isn't > legal is at, and maybe that's a feature instead of a bug. > > There are a few approaches that could improve on this: > > -Keep all of that, but expand the description to link to "SQL Key > Words"--right now "SQL standard" doesn't go to that section--and say > this might be a reserved word in other SQL implementations. This is > the smallest useful improvement. > > -Change the name of the column and remove the two related > descriptions. This will lose the lesson about where the parser's > line is at. > > -Do both: move this example of parser trivia somewhere else, but > remove it from the tutorial material by using a non-reserved column > name there. I reviewed this report and I can't see adding details to a tutorial about the fact that other databases might use "date" as a reserved word. I also can't see that renaming the field really add much. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs