Re: Postgres and alias

From: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
To: "Fontana Daniel C (Desartec S(dot)R(dot)L(dot))" <desartecsrl(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Postgres and alias
Date: 2020-08-27 16:03:51
Message-ID: 5FCF655D-DA96-4F9F-86F0-095DFEE5508C@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Daniel,

> On 27. Aug, 2020, at 17:55, Fontana Daniel C (Desartec S.R.L.) <desartecsrl(at)gmail(dot)com> wrote:
>
> Hi, I am migrating a database from Sybase to PostgreSql 12.
>
> This select in sybase works for me, but with postgresql it accuses me
> "THERE IS NO COLUMN ls_numero"
>
> select '1234567890' as ls_number,
> substr (ls_number, 3, 3);
>
> Is it possible to get information from an alias in postgresql? how would the
> code be?

try this:

postgres=# select ls_number, substr (ls_number, 3, 3) from (select '1234567890' as ls_number) a;
ls_number | substr
------------+--------
1234567890 | 345
(1 row)

Cheers,
Paul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-08-27 16:04:25 Re: could not send data to client: Permission denied
Previous Message Stelios Sfakianakis 2020-08-27 15:58:52 Re: Postgres and alias