pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Sill-II, Stephen <Stephen.Sill-II@ost.dot.gov>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: referencing column names properly
Date: Sat, 8 Feb 2003 22:38:49 -0600
Message-ID: <20030209043849.GA3562@wolff.to> (raw)
In-Reply-To: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov>
References: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov>

On Sat, Feb 08, 2003 at 18:34:31 -0500,
  "Sill-II, Stephen" <Stephen.Sill-II@ost.dot.gov> 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;

You need to use double quotes around the column name. When you do that
case will become significant. If you didn't quote the column name on
the create table command, then the name would have been converted to
lower case.



view thread (5+ messages)  latest in thread

Message-ID: <20030209043849.GA3562@wolff.to>
Permalink:  ../20030209043849.GA3562@wolff.to/
Also on:    postgresql.org/message-id/20030209043849.GA3562@wolff.to

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, Stephen.Sill-II@ost.dot.gov
  Subject: Re: referencing column names properly
  In-Reply-To: <20030209043849.GA3562@wolff.to>

* 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