X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 54D9E4753A1 for ; Sun, 9 Feb 2003 09:18:09 -0500 (EST) Received: from dotmail002.DIR.DOT.GOV (dotmail002.ost.dot.gov [152.119.92.101]) by postgresql.org (Postfix) with SMTP id B60A6474E5C for ; Sun, 9 Feb 2003 09:18:08 -0500 (EST) Received: from 152.119.92.39 by dotmail002.DIR.DOT.GOV (InterScan E-Mail VirusWall NT); Sun, 09 Feb 2003 09:18:06 -0500 Received: by ostex001.ad.ost.dot.gov with Internet Mail Service (5.5.2656.59) id ; Sun, 9 Feb 2003 09:14:50 -0500 Message-ID: <4BAE87828F06EB45B2641B83D370350F45E5@ostex002.ad.ost.dot.gov> From: "Sill-II, Stephen" To: "'Ross J. Reedstrom '" Cc: "''pgsql-sql@postgresql.org' '" Subject: Re: referencing column names properly Date: Sun, 9 Feb 2003 09:18:05 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/178 X-Sequence-Number: 11576 Thanks much! After much experimentation, I figured it out. I remember reading in the postgres oreily book that if you don't quote the identifiers, that it converts them all to lowercase for processing. Does the dash in the name also require the name to be quoted? Thanks again! Stephen Sill II -----Original Message----- From: Ross J. Reedstrom To: Sill-II, Stephen Cc: 'pgsql-sql@postgresql.org' Sent: 2/9/2003 12:50 AM Subject: Re: [SQL] referencing column names properly On Sat, Feb 08, 2003 at 06:34:31PM -0500, Sill-II, Stephen wrote: > I have a table called logs with several columns whose names have '-' in > them, e.g. User-Name > > I'm having trouble referencing these columns with SELECT statements. > > What would the proper way to address these in a statement like this? > > SELECT User-Name, max(Date), max(Time) from logs; SELECT "User-Name", max("Date"), max("Time") from logs; Assuming the MulTiCasIng you show is also in the table. SQL lets you put anything at all in an identifier (table or column name) as long as you quote it with double-quotes (") Ross