Re: SELECT returnig a constant

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
Cc: "Ray O'Donnell" <ray(at)rodonnell(dot)ie>, stan <stanb(at)panix(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SELECT returnig a constant
Date: 2019-10-15 15:58:47
Message-ID: CAHOFxGo7RTNmwUnNCNQ83rz42qtJ2MgA3afsWxHGvJiyZRKryg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 15, 2019 at 8:25 AM Geoff Winkless <pgsqladmin(at)geoff(dot)dj> wrote:

> On Tue, 15 Oct 2019 at 14:35, Ray O'Donnell <ray(at)rodonnell(dot)ie> wrote:
> >
> > On 15/10/2019 14:28, stan wrote:
> > > I used to be able to return a constant value in a SELECT statement in
> > > ORACLE. I need to populate a table for testing, and I was going to do
> so
> > > like this:
> > >
> > > SELECT
> > > employee.id ,
> > > project.proj_no ,
> > > work_type.type ,
> > > 'rate' 1
> > > FROM employee
> > > CROSS JOIN project
> > > CROSS JOIN work_type;
> > >
> > > This statement works correctly, till I add the last " 'rate' 1 line,
> then it
> > > returns a syntax error.
>

I would assume you have the value and the alias backwards and you want

SELECT 1 AS "rate"

Both the double quotes around the alias and the AS keyword are optional.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Gauthier 2019-10-15 16:07:30 Securing records using linux grou permissions
Previous Message Moreno Andreo 2019-10-15 15:43:04 Re: Pg11 -- MultiXactId xxxx has not been created yet -- apparent wraparound