Re: [GENERAL] Naming columns for SQL output ...

From: "Ross J(dot) Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>
To: "Aaron J(dot) Seigo" <aaron(at)gtv(dot)ca>
Cc: Jim Richards <grumpy(at)cyber4(dot)org>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Naming columns for SQL output ...
Date: 1999-09-24 04:28:13
Message-ID: 19990923232813.B21810@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 23, 1999 at 08:12:34PM -0600, Aaron J. Seigo wrote:
> hi..
>
[ Jim Richards <grumpy(at)cyber4(dot)org> wrote: ]
> > How do I name a column in an SQL query. In Oracle I would use
> >
> > select now() 'the time now';
> >
> > how is this done in PostgreSQL?
> >
> if i understand your question:
>
> select now() as 'the time now';

Always test your code ;-)

idas_demo=> select now() as 'the time now';
ERROR: parser: parse error at or near "'"
idas_demo=> select now() as "the time now";
the time now
----------------------
1999-09-23 23:26:29-05
(1 row)

idas_demo=>

Hmm, seems since the string is a fieldname, it needs doublequotes.

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm(at)rice(dot)edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 1999-09-24 05:09:06 Re: [GENERAL] pl/pgsql
Previous Message Alec Smecher 1999-09-24 03:39:53 Counting UPDATE changes?